function drush_hosting_site_pre_hosting_task in Hosting 7.4
Same name and namespace in other branches
- 5 site/hosting_site.drush.inc \drush_hosting_site_pre_hosting_task()
- 6.2 site/hosting_site.drush.inc \drush_hosting_site_pre_hosting_task()
- 7.3 site/hosting_site.drush.inc \drush_hosting_site_pre_hosting_task()
Implements drush_HOOK_pre_COMMAND()
Map values of site node into command line arguments
File
- site/
hosting_site.drush.inc, line 98 - Drush hooks for the Hosting site module.
Code
function drush_hosting_site_pre_hosting_task($task) {
$task =& drush_get_context('HOSTING_TASK');
if ($task->task_type == 'restore') {
$backup = hosting_site_get_backup($task->task_args['bid']);
$task->args[1] = $backup['filename'];
}
if ($task->task_type == 'backup-delete') {
foreach ($task->task_args as $bid => $filename) {
if ($filename !== '0') {
$backups[] = $filename;
}
}
$task->args[1] = implode(',', $backups);
}
if ($task->task_type == 'deploy') {
// Create an array so as to not disrupt task_args.
$task_arguments = $task->task_args;
// Drush command arguments.
$task->args[] = $task_arguments['target_git_reference'];
unset($task_arguments['target_git_reference']);
// Drush command options.
$task->options['reset'] = intval($task_arguments['git_reset']);
unset($task_arguments['git_reset']);
// Load the rest of the task args into drush options.
foreach ($task_arguments as $arg => $value) {
$task->options[$arg] = $value;
}
}
}