Commit fe144b28 authored by Steven Jones's avatar Steven Jones

Start making us Drush 5 compatible.

parent 9a3857d0
......@@ -146,10 +146,10 @@ function drush_provision_hostmaster_install($site = NULL) {
'db_service_type' => 'mysql',
'master_db' => $master_db,
);
drush_backend_invoke_args("provision-save", array($dbserver), $dbserver_context);
drush_invoke_process('@none', "provision-save", array($dbserver), $dbserver_context);
provision_backend_invoke($dbserver, 'provision-verify');
}
drush_backend_invoke_args("provision-save", array($server), $master_context);
drush_invoke_process('@none', "provision-save", array($server), $master_context);
provision_backend_invoke($server, 'provision-verify');
// exit if an error has occured.
......@@ -161,12 +161,8 @@ function drush_provision_hostmaster_install($site = NULL) {
return;
}
if (!function_exists('drush_make_drush_command')) {
drush_backend_invoke('dl', array('drush_make-' . drush_get_option('drush_make_version'), 'destination' => $aegir_root . '/.drush/'));
}
$platform_name = '@platform_hostmaster';
drush_backend_invoke_args("provision-save", array($platform_name), array(
drush_invoke_process('@none', "provision-save", array($platform_name), array(
'context_type' => 'platform',
'server' => $server,
'web_server' => $server,
......@@ -186,7 +182,7 @@ function drush_provision_hostmaster_install($site = NULL) {
}
$site_name = '@hostmaster';
drush_backend_invoke_args("provision-save", array($site_name), array(
drush_invoke_process('@none', "provision-save", array($site_name), array(
'context_type' => 'site',
'platform' => $platform_name,
'db_server' => $dbserver,
......
......@@ -44,7 +44,7 @@ We are making the following assumptions:
drush_set_option('old_platform', d('@hostmaster')->platform->name);
$new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/')));
drush_backend_invoke_args("provision-save", array($new_platform), array(
drush_invoke_process('@none', "provision-save", array($new_platform), array(
'context_type' => 'platform',
'server' => '@server_master',
'web_server' => '@server_master',
......@@ -67,7 +67,7 @@ We are making the following assumptions:
* 'options' when we drop drush3 support
*/
$context = drush_get_context('cli') ? 'cli' : 'options';
drush_backend_invoke_args("provision-save", array($server), array(
drush_invoke_process('@none', "provision-save", array($server), array(
'context_type' => 'server',
'aegir_root' => dirname(rtrim($data['config_path'], '/')),
'remote_host' => php_uname('n'),
......@@ -91,7 +91,7 @@ We are making the following assumptions:
$old_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($data['publish_path'], '/')));
drush_backend_invoke_args("provision-save", array($old_platform), array(
drush_invoke_process('@none', "provision-save", array($old_platform), array(
'context_type' => 'platform',
'server' => $server,
'web_server' => $server,
......@@ -105,7 +105,7 @@ We are making the following assumptions:
}
$new_platform = '@platform_' . preg_replace("/[!\W]/", "", basename(rtrim($platform, '/')));
drush_backend_invoke_args("provision-save", array($new_platform), array(
drush_invoke_process('@none', "provision-save", array($new_platform), array(
'context_type' => 'platform',
'server' => $server,
'web_server' => $server,
......@@ -121,7 +121,7 @@ We are making the following assumptions:
$site_name = '@hostmaster';
drush_backend_invoke_args("provision-save", array($site_name), array(
drush_invoke_process('@none', "provision-save", array($site_name), array(
'context_type' => 'site',
'platform' => $old_platform,
'db_server' => $server,
......
......@@ -62,7 +62,7 @@ function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
$options['db_server'] = $db_server;
}
drush_backend_invoke_args('provision-save', array($new_uri), $options);
drush_invoke_process('@none', 'provision-save', array($new_uri), $options);
# note that we reset the aliases so they don't conflict with the original site
provision_backend_invoke($new_uri, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
......
......@@ -87,7 +87,7 @@ function drush_provision_drupal_pre_provision_deploy($backup_file) {
$site_packages = drush_get_option('packages', array(), 'site');
$drupal_packages = drush_get_option('packages', array(), 'drupal');
$merged_modules = $drupal_packages['base']['modules'];
$merged_modules = isset($drupal_packages['base']['modules']) ? $drupal_packages['base']['modules'] : array();
if (isset($site_packages['profiles'])) {
$profiles = array_keys($site_packages['profiles']);
$profile = $profiles[0];
......
......@@ -80,10 +80,16 @@ function install_main() {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
// We have an existing settings.php.
if (function_exists('drush_sql_read_db_spec')) {
// Drush 5.
if (function_exists('_drush_sql_get_db_spec')) {
$db_spec = _drush_sql_get_db_spec();
}
// Drush 4.
elseif (function_exists('drush_sql_read_db_spec')) {
$db_spec = drush_sql_read_db_spec();
}
// Drush 3.
else {
$db_spec = drush_core_site_install_db_spec();
}
......
......@@ -97,7 +97,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = NULL) {
drush_set_option('new_site_path', "{$options['root']}/sites/{$options['uri']}");
drush_backend_invoke_args('provision-save', array($target), $options);
drush_invoke_process('@none', 'provision-save', array($target), $options);
provision_backend_invoke($target, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
if (!drush_get_error()) {
drush_log(dt("Bringing site out of maintenance"));
......@@ -113,7 +113,7 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = NULL) {
* Implementation of drush_hook_COMMAND_rollback().
*/
function drush_provision_drupal_provision_migrate_rollback($platform) {
drush_backend_invoke_args('provision-save', array(d()->name), array('platform' => drush_get_option('old_platform'), 'root' => NULL, 'uri' => NULL));
drush_invoke_process('@none', 'provision-save', array(d()->name), array('platform' => drush_get_option('old_platform'), 'root' => NULL, 'uri' => NULL));
}
/**
......
......@@ -55,7 +55,7 @@ function drush_provision_drupal_pre_provision_verify() {
}
$options[] = d()->makefile;
$options[] = d()->root;
drush_backend_invoke("make", $options);
drush_invoke_process('@none', "make", $options);
if (drush_get_error()) {
return drush_set_error("DRUSH_MAKE_FAILED",
"Could not download platform using drush make. No platform present");
......
......@@ -399,21 +399,22 @@ function _scrub_object($input) {
/**
* Execute a command against a specific context object.
*
* @arg string $target
* the context to operate on, @ prefix is optional
* @arg string $command
* drush command passed to drush_backend_invoke_args()
* @arg string $arguments
* drush arguments passed to drush_backend_invoke_args()
* @arg string $data
* drush data passed to drush_backend_invoke_args()
* @arg string $mode
* drush IPC mode (GET/POST) passed to drush_backend_invoke_args()
*
* @see drush_backend_invoke_args()
* @param $target
* the context to operate on, @ prefix is optional.
* @param $command
* drush command passed to drush_invoke_process().
* @param $arguments
* drush arguments passed to drush_invoke_process().
* @param $data
* drush data passed to drush_invoke_process().
* @param $mode
* drush IPC mode (GET/POST) passed to drush_invoke_process().
*
* @see drush_invoke_process()
*/
function provision_backend_invoke($target, $command, $arguments = array(), $data = array(), $mode = 'GET') {
return drush_backend_invoke_args('@' . ltrim($target, '@') . ' ' . $command, $arguments, $data + array('root' => NULL, 'uri' => NULL), $mode);
$context = '@' . ltrim($target, '@');
return drush_invoke_process($context, $context . ' ' . $command, $arguments, $data /*+ array('root' => NULL, 'uri' => NULL)*/, array('method' => $mode, 'integrate' => TRUE));
}
/**
......
......@@ -133,13 +133,13 @@ function drush_provision_tests_install_platform($platform_name, $platform_alias
PROVISION_TESTS_BUILDS_REPO . "/$platform_name.build",
"/var/aegir/platforms/$platform_alias"
);
drush_backend_invoke('make', $args);
drush_invoke_process('@none', 'make', $args);
$args = array(
'root' => "/var/aegir/platforms/$platform_alias",
"@platform_$platform_alias",
'context_type' => 'platform',
);
drush_backend_invoke('provision-save', $args);
drush_invoke_process('@none', 'provision-save', $args);
provision_backend_invoke('@hostmaster', 'hosting-import', array("@platform_$platform_alias",));
drush_provision_tests_run_remaining_tasks();
}
......@@ -167,7 +167,7 @@ function drush_provision_tests_install_site($platform_name, $site, $profile_name
'db_server' => '@server_localhost',
'root' => "/var/aegir/platforms/$platform_name",
);
drush_backend_invoke('provision-save', $args);
drush_invoke_process('@none', 'provision-save', $args);
provision_backend_invoke("@$site.aegir.example.com", 'provision-install');
provision_backend_invoke('@hostmaster', 'hosting-task', array("@platform_$platform_name", 'verify'), array('force' => TRUE));
drush_provision_tests_run_remaining_tasks();
......
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