Commit f8545ace authored by ergonlogic's avatar ergonlogic Committed by helmo

Issue #2731471 by Jon Pugh, ergonlogic: Provision backup-delete command is too...

Issue #2731471 by Jon Pugh, ergonlogic: Provision backup-delete command is too strict if it doesn't have "backups" passed to it
parent f6c152ba
......@@ -9,32 +9,33 @@
*
* These are the hooks that will be executed by the drush_invoke function
* when deleting a backup file from the backend.
*
* @param string $backup
* A comma-separated list of backup filenames.
*/
function drush_provision_drupal_provision_backup_delete($backup = NULL) {
if ($backup) {
function drush_provision_drupal_provision_backup_delete($backup) {
$backups = explode(',', $backup);
foreach ($backups as $filename) {
$success = provision_file()->unlink($filename)
->succeed('Removed backup file @path')
->fail('Could not remove backup file @path');
}
}
else {
drush_set_error(dt('No backup files provided'));
}
}
/**
* Implements drush_hook_post_COMMAND().
*
* If we have a client name and backups provided, cleanup the backup
* symlinks created for that client.
* If we have a client name, cleanup the backup symlinks created for that
* client.
*
* Will not provoke a rollback if there is no symlink, for backward
* compatibility.
*
* @param string $backup
* A comma-separated list of backup filenames.
*/
function drush_provision_drupal_post_provision_backup_delete($backup = NULL) {
if ($backup && d()->client_name) {
function drush_provision_drupal_post_provision_backup_delete($backup) {
if (d()->client_name) {
$backup_dir = d()->server->clients_path . '/' . d()->client_name . '/backups';
$backups = explode(',', $backup);
foreach ($backups as $filename) {
......
......@@ -282,6 +282,7 @@ function provision_drush_command() {
$items['provision-backup-delete'] = array(
'description' => 'Delete a backup file.',
'arguments' => array('backup-file' => dt('The backup file to delete. This will be a gzipped tarball.')),
'required-arguments' => TRUE,
'examples' => array(
'drush @site provision-backup-delete /path/to/site_backup.tgz' => 'Delete a backup of this site as defined by the site Drush alias generated with provision-save.',
),
......
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