Download & Extend

Take advantage of refactored installation system

Project:Project Issue File Review
Version:6.x-2.x-dev
Component:Code
Category:task
Priority:normal
Assigned:boombatower
Status:active

Issue Summary

Since the installation system has been re-factored (and is going through a more few changes) so that it can now be invoked programmatically, it makes sense to take advantage of that.

The idea of using a core installer "script" has been around for a long time and is the only way to allow radical changes to the installer/system to be tested. Since PIFR will download and patch the code before installing it we will no longer have to disable it when such changes are made.

I have closed #330504: Create auto-install script since it now seems out of date.

Comments

#2

Assigned to:Anonymous» boombatower

So what I need to do is get a D7 install, and simpletest module enabled. I'll take a look at the code, but if there are those who already know that would be great.

#3

Updated http://drupal.org/node/366978 and related issues.

#4

subscribe

#5

Assuming the latest code at #524728: Refactor install.php to allow Drupal to be installed from the command line goes in, the code for PIFR would look something like this:

<?php
// Hm, do these cause problems for PIFR, if you are running the code from within
// a Drupal installation rather than as a separate PHP process?
define('DRUPAL_ROOT', '/path/to/the/D7/checkout');
define('MAINTENANCE_MODE', 'install');

// Installation settings for the D7 site; change these as needed.
$settings = array(
 
'parameters' => array(
   
'profile' => 'default',
   
'locale' => 'en',
  ),
 
'forms' => array(
   
'install_settings_form' => array(
     
'driver' => 'mysql',
     
'database' => 'my_db_name',
     
'username' => 'my_db_username',
     
'password' => 'my_db_password',
    ),
   
'install_configure_form' => array(
     
'site_name' => 'My site',
     
'site_mail' => 'admin@example.com',
     
'account' => array(
       
'name' => 'admin',
       
'mail' => 'admin@example.com',
       
'pass' => array(
         
'pass1' => 'my_site_password',
         
'pass2' => 'my_site_password',
        ),
      ),
     
'update_status_module' => array(1 => TRUE),
     
'clean_url' => TRUE,
    ),
  ),
);

// Start the installer.
require_once DRUPAL_ROOT . '/includes/installer.inc';
install_drupal($settings);
?>

That should get Drupal installed. Enabling the Simpletest module might be a bit different, since the install_drupal() function only has whatever functionality installation profiles provide, and core doesn't have any profiles that ship with Simpletest already enabled.

If you were running this as a separate PHP process, then it could probably be done just by calling drupal_install_modules(), but I assume that's not what you're going for. So it seems like this needs a little more thought for this API to be able to work inside an already-existing Drupal installation. Hm.

#6

Yea, another option would be for PIFR to insert a file in the checkout D7 directory and run it.

#7

Looks like things are finally ready to be used this way http://arancaytar.ermarian.net/2009/12/17/install-drupal-7-script.

Hooray!

#8

That blog post is a great summary, but nothing has changed recently... it's been ready all along :)

Still seems like there will be problems with including a D7 script inside D6 (since function names will conflict). Not sure how to handle that except by running it as a separate PHP process, which might get messy.

I've also wondered a bit whether focusing efforts on #630446: Allow SimpleTest to test the Drupal installer makes more sense? PIFR currently does a great job testing the web-based installation, and that is certainly something we don't want to stop testing. So if PIFR sticks to running the web-based installer but SimpleTest itself can try out different programmatic installations, maybe that is the best way to cover everything, rather than trying to change PIFR.

#9

Yea, I was thinking about that and I belive it makes the most sense for SimpleTest to test the web installer. If nothing has changed (the format is newer then the last time I tried it), then it won't work, but from looking at it it looks a bit better.

My thought was to just generated a file with the array and include for installer code and just dumb in checkout directory along with d7 then just run it. The key benefit is that the installer interface can be changed without pifr having to be updated. Of course for d6 it will still need to perform the web installer.