This was discussed before, but a clean solution was not found. What we need is a way to install Drupal while it is running using the standard web interface. Without hacking it by placing a detect for simpletest in the installer or the like, I think the only way to do it would be to make a copy of the code in a writeable folder like /sites/default/files (w/e site) and then run the installer out of that directory through the web.
I have the install script that is being used on t.d.o. It doesn't click the links of the first few pages in an attempt to be minimal and have to be changed the least. Part of that is due to the way the minimalist SimpleTest browser was designed. It doesn't work when clicking relative links and such since it assumes they are in the active site as the base url. Which they aren't, they are inside base_url/sites/default/files/something/install.php
// Install Drupal.
$d = new DrupalWebTestCase();
// Step: Select an installation profile.
// Step: Choose language.
$d->drupalGet('install.php', array('query' => 'profile=default&locale=en'));
// Step: Database configuration.
$edit = array();
$edit['database'] = $db;
$edit['username'] = $user;
$edit['password'] = $pass;
$edit['db_prefix'] = '';
$d->drupalPost(NULL, $edit, t('Save and continue'));
// Step: Site configuration.
$edit = array();
$edit['site_name'] = 'checkout';
$edit['site_mail'] = 'admin@example.com';
$edit['account[name]'] = 'admin';
$edit['account[mail]'] = 'admin@example.com';
$edit['account[pass][pass1]'] = $pass = $d->randomName(12);
$edit['account[pass][pass2]'] = $pass;
$edit['clean_url'] = 0;
$edit['update_status_module[1]'] = FALSE;
$d->drupalPost(NULL, $edit, t('Save and continue'));
It should be able to just install itself in a prefixed directory like SimpleTest normally does, but it needs to remove the copied code afterwards so that it always copies the latest version of itself.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | auto-install.php_.patch | 4.7 KB | boombatower |
| #6 | auto-install.php_.patch | 4.44 KB | boombatower |
Comments
Comment #1
boombatower commentedIf this can be done then I can modify t.d.o to use it and it can be maintained like a test. Meaning changes to the installer won't hose t.d.o.
I already had to update the SimpleTest browser with the meta refresh patch which allows SimpleTest to run batch API pages.
Comment #2
cyberswat commentedsubscribing
Comment #3
boombatower commentedOne thought, should we make this a test or more of an automatic installation script and put it with the other scripts?
Comment #4
boombatower commentedThis could be made a test if we required a vhost setup with apache...or put some code atop index.php, update.php, and install.php that would switch the HTTP_HOST value when given specified parameters (although that could be dangerous).
Comment #5
boombatower commentedForgot to set status: I have started (hour ago).
Comment #6
boombatower commentedGoing the route of auto-install script which is much more feasible (for numerous technical reasons) and possibly more useful.
Initial pass...doesn't work at all. (got side tracked with: #345632: SimpleTest: correct assertTitle logic)
Currently it does on:
drupal_get_path() apparently returns ''.
Might be due to this when bootstrapping:
Thoughts?
Comment #7
boombatower commentedComment #8
boombatower commentedJust needed:
Comment #9
boombatower commentedUpdated script. This will require a bit of tweaking since DrupalWebTestCase now uses protected modifiers.
Postponing until: #340283: Abstract SimpleTest browser in to its own object
Comment #10
adrian commentedwe have an install script for Aegir.
It creates a drush command called 'provision install', and creates a mysql database and virtual host entry of the site for you.
we will also be plugging into unit testing in the future.
Comment #11
boombatower commentedCore needs one in order for testing.drupal.org to function properly all the time.
Comment #12
josh waihi commentedhave you thought about simpletest implementing install tests. Then these tests could be called to install drupal. This would also take a step out of the PIFR process and merge it into the runningof the tests.
Comment #13
boombatower commentedWe ran into a number of problems with that. One being SimpleTest would need to have virtual hosts setup or something in order to allow it to run the installer...since the current code base it is running on is already installed....it is also A LOT more useful as a script.
This is extremely easy to do once someone (or me when I get time) finishes the abstract browser patch which is also useful in its own right. Making a test has a number of technical issues as webchick and I discussed in IRC a long time ago...and is not as useful of a solution.
Comment #14
dave reidI have a few patches that change the installer that are doomed to stay CNW until this lands. :)
Comment #15
boombatower commentedSeems to be available with: #524728: Refactor install.php to allow Drupal to be installed from the command line