delete.backup.provision.inc

Provision hooks for the provision backup-delete command.

Functions

Namesort descending Description
drush_provision_drupal_post_provision_backup_delete Implementation of drush_hook_post_provision_backup_delete()
drush_provision_drupal_provision_backup_delete

File

platform/delete.backup.provision.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provision hooks for the provision backup-delete command.
  5. */
  6. /**
  7. * Provision backup-delete command
  8. *
  9. * These are the hooks that will be executed by the drush_invoke function
  10. * when deleting a backup file from the backend.
  11. */
  12. function drush_provision_drupal_provision_backup_delete($backup = null) {
  13. if($backup) {
  14. $backups = explode(',', $backup);
  15. foreach ($backups as $filename) {
  16. $success = provision_file()->unlink($filename)
  17. ->succeed('Removed backup file @path')
  18. ->fail('Could not remove backup file @path');
  19. }
  20. }
  21. else {
  22. drush_set_error(dt('No backup files provided'));
  23. }
  24. }
  25. /**
  26. * Implementation of drush_hook_post_provision_backup_delete()
  27. *
  28. * If we have a client name and backups provided, cleanup the backup
  29. * symlinks created for that client.
  30. *
  31. * Will not provoke a rollback if there is no symlink, for backward
  32. * compatibility.
  33. */
  34. function drush_provision_drupal_post_provision_backup_delete($backup = null) {
  35. if ($backup && d()->client_name) {
  36. $backup_dir = d()->server->clients_path . '/' . d()->client_name . '/backups';
  37. $backups = explode(',', $backup);
  38. foreach ($backups as $filename) {
  39. provision_file()->unlink($backup_dir . '/' . basename($filename))
  40. ->succeed('Deleted backup symlink @path');
  41. }
  42. }
  43. }