Commit a9aed498 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

fix delete functionality

parent 19a44507
......@@ -361,10 +361,16 @@ function _provision_drupal_recursive_delete($path) {
$ret = 0;
}
}
$ret = $ret && rmdir($path);
$rm = rmdir($path);
provision_log( ($rm) ? 'notice' : 'error', t("deleting @path directory @status", array('@path' => $path, '@status' => ($rm) ? 'successful' : 'failed')));
$ret = $ret && $rm;
}
else {
$ret = $ret && unlink($path);
$rm = unlink($path);
if (!$rm) {
provision_log('error', "deleting $path file failed");
}
$ret = $ret && $rm;
}
return $ret;
}
......@@ -373,16 +379,14 @@ function _provision_drupal_recursive_delete($path) {
* Remove any directories for the site in sites/
*/
function provision_drupal_provision_delete($url, $data) {
provision_log('notice', "deleting sites/$url directory");
return _provision_drupal_recursive_delete("sites/$url");
}
function provision_drupal_find_sites() {
$sites = file_scan_directory('./sites', 'site\.php$', array('.', '..', 'CVS', '.svn'), 0, TRUE, 'name', 0);
$sitephp = file_scan_directory('./sites', 'site\.php$', array('.', '..', 'CVS', '.svn'), 0, TRUE, 'name', 0);
$settingsphp = file_scan_directory('./sites', 'site\.php$', array('.', '..', 'CVS', '.svn'), 0, TRUE, 'name', 0);
}
function provision_drupal_restore($url, $backup_file, &$data) {
provision_shell_exec("tar -zxf %s -C sites/%s", $backup_file, $url); # checkout over old sites dir.
}
......
......@@ -631,9 +631,17 @@ function _provision_restore($site, $backup_file) {
provision_set_error(PROVISION_SITE_NOT_FOUND);
provision_output($url, $data);
}
if (!is_file($backup_file)) {
provision_log("File specified does not exist.");
provision_set_error(PROVISION_PERM_ERROR);
provision_output($url, $data);
}
$data = provision_get_site_data($url);
_provision_backup_site($url, $data); # Backup site for posterity, before rolling back.
provision_shell_exec("tar -zxf %s -C %s/%s.tmp", $backup_file, provision_backup_path(), $url); # check out old directory.
$rolled_back = provision_invoke("restore", $url, $data);
$data['site_installed'] = TRUE;
provision_save_site_data($url, $data);
}
......@@ -681,8 +689,5 @@ function _provision_delete($url) {
$rolled_back = provision_invoke("delete", $url, $data);
$data['site_installed'] = FALSE;
$data['site_enabled'] = FALSE;
provision_save_site_data($url, $data);
provision_output($url, $data);
}
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