platform->name); $new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/'))); drush_backend_invoke_args("provision-save", array($new_platform), array( 'context_type' => 'platform', 'server' => '@server_master', 'web_server' => '@server_master', 'root' => $platform, 'makefile' => drush_get_option('makefile', dirname(__FILE__) . '/aegir.make'), )); provision_backend_invoke($new_platform, 'provision-verify'); drush_set_option('new_platform', $new_platform); // exit if an error has occured. if (drush_get_error()) { return false; } } else { // add a server record : $server = '@server_master'; /** * @deprecated in drush3 it's 'options', in drush 4 it's 'cli', drop * 'options' when we drop drush3 support */ $context = drush_get_context('cli') ? 'cli' : 'options'; drush_backend_invoke_args("provision-save", array($server), array( 'context_type' => 'server', 'aegir_root' => dirname(rtrim($data['config_path'], '/')), 'remote_host' => php_uname('n'), 'script_user' => $data['script_user'], // apache or nginx or.. 'http_service_type' => drush_get_option('http_service_type', 'apache', $context), 'web_group' => $data['web_group'], 'master_url' => $data['master_url'], 'restart_cmd' => $data['restart_cmd'], // mysql 'db_service_type' => 'mysql', 'master_db' => $data['master_db'], )); provision_backend_invoke($server, 'provision-verify'); drush_set_option('server_name', $server); // exit if an error has occured. if (drush_get_error()) { return false; } $old_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($data['publish_path'], '/'))); drush_backend_invoke_args("provision-save", array($old_platform), array( 'context_type' => 'platform', 'server' => $server, 'web_server' => $server, 'root' => $data['publish_path'], )); provision_backend_invoke($old_platform, 'provision-verify'); drush_set_option('old_platform', $old_platform); // exit if an error has occured. if (drush_get_error()) { return false; } $new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/'))); drush_backend_invoke_args("provision-save", array($new_platform), array( 'context_type' => 'platform', 'server' => $server, 'web_server' => $server, 'root' => $platform, 'makefile' => drush_get_option('makefile', dirname(__FILE__) . '/aegir.make'), )); provision_backend_invoke($new_platform, 'provision-verify'); drush_set_option('new_platform', $new_platform); // exit if an error has occured. if (drush_get_error()) { return false; } $site_name = '@hostmaster'; drush_backend_invoke_args("provision-save", array($site_name), array( 'context_type' => 'site', 'platform' => $old_platform, 'db_server' => $server, 'uri' => $site, 'profile' => 'hostmaster', )); provision_backend_invoke($site_name, 'provision-verify'); drush_set_option('site_name', $site_name); // exit if an error has occured. if (drush_get_error()) { return false; } } } /** * Prepare the hostmaster site for migration * * @deprecated most of the stuff here needs to be removed in favor of * hosting-pause, but since that exists only starting with rc3, we * need to copy the content of it here. once 1.0 is released, we can * remove that code and just keep hosting-pause. */ function drush_provision_pre_hostmaster_migrate($site, $platform) { // wipe out cron entry exec('crontab -r'); // we can't rely on update.php to run that because it will run too late. this can be removed in 0.5 and above provision_backend_invoke(drush_get_option('site_name'), 'sqlq', array("UPDATE {system} SET weight = 0 WHERE type='module' AND name='hosting';")); } function drush_provision_hostmaster_migrate($site, $platform) { provision_backend_invoke(drush_get_option('site_name'), 'provision-migrate', array(drush_get_option('new_platform'))); } function drush_provision_post_hostmaster_migrate($site, $platform) { // we pass the context names we generated to the task so we can enforce that the names // stay the same. provision_backend_invoke(drush_get_option('site_name'), 'hostmaster-resume', array(), array( 'old_platform_name' => drush_get_option('old_platform'), 'new_platform_name' => drush_get_option('new_platform'), )); }