array('domain.com' => dt('The domain of the site to install.')), 'description' => dt('Provision a new site using the provided data.'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision import'] = array( 'arguments' => array('domain.com' => dt('The domain of the site to import.')), 'description' => dt('Turn an already running site into a provisioned site.'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision backup'] = array( 'arguments' => array('domain.com' => dt('The domain of the site to back up.')), 'optional arguments' => array('backup-file' => dt('The file to save the backup to. This will be a gzipped tarball.')), 'description' => dt('Generate a back up for the site.'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision enable'] = array( 'arguments' => array('domain.com' => dt('The domain of the site to enable (only if enabled).')), 'description' => 'Enable a disabled site.', 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision disable'] = array( 'arguments' => array('domain.com' => dt('The domain of the site to disable (only if disabled).')), 'description' => 'Disable a site.', 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision verify'] = array( 'arguments' => array('domain.com' => dt('The domain of the site to verify).')), 'description' => 'Verify that the provisioning framework is correctly installed.', 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT, ); $items['provision restore'] = array( 'description' => 'Restore the site to a previous backup. This will also generate a backup of the site as it was.', 'arguments' => array('domain.com' => dt('The domain of the site to be restored'), 'site_backup.tar.gz' => dt('The backup to restore the site to.')), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision deploy'] = array( 'description' => 'Deploy an existing backup to a new url.', 'arguments' => array('domain.com' => dt('The domain to deploy the site package to.'), 'site_backup.tar.gz' => dt('The backup to deploy.')), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision migrate'] = array( 'description' => 'Migrate a site between platforms.', 'arguments' => array('domain.com' => dt('The domain to migrate. Any outstanding updates will be run.'), '/path/to/platform' => dt('The platform to migrate the site to.')), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision delete'] = array( 'description' => 'Delete a site.', 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); return $items; } /** * Generate a provision.settings.php file to configure provision */ function _provision_generate_config() { drush_log(dt("Generating drushrc.php file")); provision_path("chmod", drush_get_option('docroot_path') . '/drushrc.php', 0600, dt('Changed permissions of drushrc.php to @confirm'), dt('Could not change permissions of drushrc.php to @confirm')); provision_save_platform_data(); provision_path("chmod", drush_get_option('docroot_path') . '/drushrc.php', 0400, dt('Changed permissions of drushrc.php to @confirm'), dt('Could not change permissions of drushrc.php to @confirm')); return TRUE; } function _provision_default_restart_cmd() { $command = '/usr/sbin/apachectl'; # a proper default for most of the world foreach (explode(':', $_SERVER['PATH']) as $path) { $options[] = "$path/apache2ctl"; $options[] = "$path/apachectl"; } # try to detect the apache restart command $options[] = '/usr/local/sbin/apachectl'; # freebsd $options[] = '/usr/sbin/apache2ctl'; # debian + apache2 $options[] = $command; foreach ($options as $test) { if (is_executable($test)) { $command = $test; break; } } return "sudo $command graceful"; } function _provision_default_web_group() { $info = posix_getgrgid(posix_getgid()); $common_groups = array( 'httpd', 'www-data', 'apache', 'nogroup', 'nobody', $info['name']); foreach ($common_groups as $group) { if (provision_posix_groupname($group)) { return $group; break; } } return null; }