Commit 0b4a2986 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

#374797 - move to drush_log and drush_set_error. Tackle all the PROVISION_*_ERROR constants

parent 5e6c4cec
......@@ -22,7 +22,7 @@ function provision_drupal_provision_backup_validate(&$data, $url = NULL, $backup
if ( provision_path("exists", $backup_file, FALSE,
dt("Backing site up to @path."),
dt("Back up file @path already exists."),
PROVISION_FRAMEWORK_ERROR)) {
PROVISION_BACKUP_ALREADY_EXISTS)) {
$data['backup_file'] = $backup_file;
}
}
......
......@@ -30,7 +30,7 @@ function provision_drupal_provision_deploy_validate(&$data, $url = null, $backup
$exists = provision_path("exists", $backup_file, TRUE,
dt("Deploying site from @path"),
dt("Could not find backup file @path"),
PROVISION_FRAMEWORK_ERROR);
PROVISION_BACKUP_NOT_FOUND);
if ($exists) {
$data['backup_file'] = $backup_file;
}
......@@ -43,7 +43,7 @@ function provision_drupal_provision_pre_deploy(&$data, $url, $backup_file) {
$extracted = provision_path("extract", $data['backup_file'], PROVISION_SITES_PATH ."/$url",
dt('Successfully extracted the contents of @path'),
dt('Failed to extract the contents of @path'),
PROVISION_PERM_ERROR, PROVISION_FRAMEWORK_ERROR);
PROVISION_BACKUP_EXTRACTION_FAILED);
if ($extracted) {
$old_data = provision_get_site_data($url);
$data['old_site_url'] = $old_data['site_url'];
......
......@@ -218,19 +218,19 @@ function _provision_drupal_create_directories($url, $profile = NULL) {
provision_path("mkdir", $path, TRUE,
dt("Created <code>@path</code>"),
dt("Could not create <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
DRUSH_PERM_ERROR);
}
provision_path("chmod", $path, $perm,
dt("Changed permissions of <code>@path</code> to @confirm"),
dt("Could not change permissions <code>@path</code> to @confirm"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
DRUSH_PERM_ERROR);
}
foreach ($grps as $path) {
provision_path("chown", $path, PROVISION_SCRIPT_USER,
dt("Changed ownership of <code>@path</code>"),
dt("Could not change ownership <code>@path</code>"),
PROVISION_PERM_ERROR | PROVISION_INSTALL_ERROR );
DRUSH_PERM_ERROR );
provision_path("chgrp", $path, PROVISION_WEB_GROUP,
dt("Changed group ownership of <code>@path</code>"),
dt("Could not change group ownership <code>@path</code>"));
......
......@@ -30,7 +30,7 @@ function provision_drupal_provision_restore_validate(&$data, $url = null, $resto
$exists = provision_path("exists", $restore_file, TRUE,
dt("Restoring site from @path"),
dt("Could not find backup file @path"),
PROVISION_FRAMEWORK_ERROR);
PROVISION_BACKUP_NOT_FOUND);
if ($exists) {
$data['restore_file'] = $restore_file;
}
......@@ -45,7 +45,7 @@ function provision_drupal_provision_pre_restore(&$data, $url, $restore_file) {
provision_path("extract", $data['restore_file'], PROVISION_SITES_PATH ."/$url.restore",
dt('Successfully extracted the contents of @path'),
dt('Failed to extract the contents of @path'),
PROVISION_PERM_ERROR, PROVISION_FRAMEWORK_ERROR);
PROVISION_BACKUP_EXTRACTION_FAILED);
}
/**
......@@ -64,7 +64,7 @@ function provision_drupal_provision_restore(&$data, $url) {
provision_path("switch_paths", $old, $new ,
dt('Swapping out the @path and @confirm directories was successful.'),
dt('Swapping the @path and @confirm directories has failed.'),
PROVISION_PERM_ERROR);
DRUSH_PERM_ERROR);
// make sure it has the latest site data available
_provision_drupal_create_settings_file($data, $url);
provision_save_site_data($data, $url);
......
......@@ -19,7 +19,7 @@ function provision_drupal_provision_verify(&$data, $url = null) {
_provision_create_dir(PROVISION_CONFIG_PATH, dt('Provision configuration'), 0700);
_provision_create_dir(PROVISION_BACKUP_PATH, dt('Web server configuration'), 0700);
provision_path("writable", "sites", TRUE, dt("Drupal sites directory is writable by the provisioning script"),
dt("Drupal sites directory is not writable by the provisioning script"), PROVISION_PERM_ERROR);
dt("Drupal sites directory is not writable by the provisioning script"), PROVISION_SITES_DIR_NOT_WRITABLE);
$data['sites'] = array_keys((array) provision_drupal_find_sites()); // return list of hosted sites. used to determine whether or not to import.
$data['platform'] = array('short_name' => 'drupal', 'version' => drush_drupal_version());
......
......@@ -52,7 +52,7 @@ function provision_init() {
// Do not allow the program to be run as the root user. ever
$name = posix_getpwuid(posix_geteuid());
if ($name['name'] == 'root') {
return drush_set_error(PROVISION_ROOT_USER_ERROR, dt('You are running the provision script as the root user. Exiting'));
return drush_set_error(PROVISION_IS_ROOT, dt('You are running the provision script as the root user. Exiting'));
}
// Set up defines for platform
......
......@@ -298,24 +298,24 @@ function _provision_create_dir($path, $name, $perms) {
$exists = provision_path("mkdir", $path, TRUE,
$name . ' ' . dt("path has been created."),
$name . ' ' . dt("path could not be created."),
PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR);
DRUSH_PERM_ERROR);
}
if ($exists) {
provision_path("chown", $path, PROVISION_SCRIPT_USER,
$name . ' ' . dt("ownership of path has been changed to @confirm."),
$name . ' ' . dt("ownership of path could not be changed to @confirm."),
PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR);
DRUSH_PERM_ERROR);
provision_path("chmod", $path, $perms,
$name . ' ' . dt("permissions of path have been changed to @confirm."),
$name . ' ' . dt("permissions of path could not be changed to @confirm."),
PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR );
DRUSH_PERM_ERROR );
$writable = provision_path("writable", $path, TRUE,
$name . ' ' . dt("path is writable."),
$name . ' ' . dt("path is not writable."),
PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR);
DRUSH_PERM_ERROR);
}
......
......@@ -42,7 +42,7 @@ function _provision_apache_create_vhost_config($data, $url, $template = NULL) {
drush_log(dt("Generate virtual host configuration file."));
$writable = provision_path("writable", PROVISION_VHOST_PATH, TRUE , NULL,
dt("Virtual host configuration path @path is not writable."),
PROVISION_PERM_ERROR | PROVISION_FRAMEWORK_ERROR);
PROVISION_VHOST_PATH_NOT_WRITABLE);
$data['extra_config'] = "# Extra configuration from modules:\n";
foreach (drush_command_implements('provision_vhost_config') as $module) {
$data['extra_config'] .= "# -- $module settings --\n";
......@@ -66,7 +66,7 @@ function _provision_apache_restart_apache($cause_error = FALSE) {
$return = drush_shell_exec(escapeshellcmd(PROVISION_RESTART_CMD));
if (!$return) {
if ($cause_error) {
return drush_set_error(PROVISION_WEB_RESTART_ERROR, dt("Web server could not be restarted. Changes might not be available until this has been done."));
return drush_set_error(PROVISION_WEB_RESTART_FAILED, dt("Web server could not be restarted. Changes might not be available until this has been done."));
}
else {
drush_log(dt("Web server could not be restarted. Changes might not be available until this has been done."), "warning");
......
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