Commit 857912bc authored by Adrian Rossouw's avatar Adrian Rossouw

Change migrate behaviour when alpha 9 + is installed.

parent 1adadaf9
...@@ -5,77 +5,106 @@ ...@@ -5,77 +5,106 @@
*/ */
function drush_provision_hostmaster_migrate_validate($site, $platform) { function drush_provision_hostmaster_migrate_validate($site, $platform) {
$data = drush_get_merged_options(); $data = drush_get_merged_options();
// add a server record :
$server = '@server_master';
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', 'options'),
'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'); $alias_file = drush_server_home() . '/.drush/server_master.alias.drushrc.php';
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, '/'))); // If the alias file exists, it means we are migrating from a post alpha9 release.
drush_backend_invoke_args("provision-save", array($new_platform), array( if (file_exists($alias_file)) {
'context_type' => 'platform', provision_backend_invoke('@server_master', 'provision-verify');
'server' => $server, provision_backend_invoke('@hostmaster', 'provision-verify');
'web_server' => $server,
'root' => $platform,
'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;
}
drush_set_option('site_name', '@hostmaster');
drush_set_option('old_platform', d('@hostmaster')->platform);
$site_name = '@hostmaster'; $new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/')));
drush_backend_invoke_args("provision-save", array($site_name), array( drush_backend_invoke_args("provision-save", array($new_platform), array(
'context_type' => 'site', 'context_type' => 'platform',
'platform' => $old_platform, 'server' => '@server_master',
'db_server' => $server, 'web_server' => '@server_master',
'uri' => $site, 'root' => $platform,
'profile' => 'hostmaster', 'makefile' => dirname(__FILE__) . '/aegir.make',
)); ));
provision_backend_invoke($site_name, 'provision-verify'); provision_backend_invoke($new_platform, 'provision-verify');
drush_set_option('site_name', $site_name); drush_set_option('new_platform', $new_platform);
// exit if an error has occured. // exit if an error has occured.
if (drush_get_error()) { if (drush_get_error()) {
return false; return false;
}
} }
else {
// add a server record :
$server = '@server_master';
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', 'options'),
'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' => 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;
}
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment