$backup_file)), 'backup'); $olddir = getcwd(); // we need to do this because some retarded implementations of tar (e.g. SunOS) don't support -C chdir(drush_get_option('sites_path') . "/$url"); if (substr($backup_file, -2) == 'gz') { // same as above: some do not support -z $command = "tar cpf - . | gzip -c > %s"; } else { $command = "tar cpf %s ."; } $result = provision_shell_exec($command, $backup_file); chdir($olddir); if (!$result && !drush_get_option('force', false)) { drush_set_error('PROVISION_BACKUP_FAILED', dt("Could not back up sites directory for drupal")); } } /** * Remove the backup file if something went wrong */ function drush_provision_drupal_provision_backup_rollback() { $backup_file = drush_get_option('backup_file'); if (file_exists($backup_file)) { provision_path('unlink', $backup_file, TRUE, dt("Removed stale backup file $backup_file"), dt("Failed deleting backup file $backup_file")); } }