Commit 2c3bcc37 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Move provision_errors_on, provision_errors_off and the update sql logging...

Move provision_errors_on, provision_errors_off and the update sql logging function upstream into drush.
parent 7602c3bd
......@@ -53,7 +53,7 @@ function update_main() {
while (!$finished) {
// do update
$ret = module_invoke($module, 'update_' . $update);
provision_drupal_install_log($ret);
_drush_log_update_sql($ret);
$finished = 1;
if (isset($ret['#finished'])) {
$finished = $ret['#finished'];
......
......@@ -274,7 +274,7 @@ function update_create_batch_table() {
function update_main() {
// Some unavoidable errors happen because the database is not yet up-to-date.
// Our custom error handler is not yet installed, so we just suppress them.
_provision_errors_off();
drush_errors_off();
require_once './includes/bootstrap.inc';
// Minimum load of components.
......@@ -306,11 +306,11 @@ function update_main() {
// This must happen *after* drupal_bootstrap(), since it calls
// variable_(get|set), which only works after a full bootstrap.
provision_drupal_install_log(update_create_batch_table());
_drush_log_update_sql(update_create_batch_table());
// Turn error reporting back on. From now on, only fatal errors (which are
// not passed through the error handler) will cause a message to be printed.
_provision_errors_on();
drush_errors_on();
......@@ -318,8 +318,8 @@ function update_main() {
include_once './includes/batch.inc';
drupal_load_updates();
provision_drupal_install_log(update_fix_d6_requirements());
provision_drupal_install_log(update_fix_compatibility());
_drush_log_update_sql(update_fix_d6_requirements());
_drush_log_update_sql(update_fix_compatibility());
$start = array();
$modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE);
......@@ -398,7 +398,7 @@ function _update_do_one($module, $number, &$context) {
$function = $module .'_update_'. $number;
if (function_exists($function)) {
$ret = $function($context['sandbox']);
provision_drupal_install_log($ret);
_drush_log_update_sql($ret);
}
if (isset($ret['#finished'])) {
......
......@@ -429,7 +429,7 @@ function _drush_exception_handler($exception) {
function update_main() {
// Some unavoidable errors happen because the database is not yet up-to-date.
// Our custom error handler is not yet installed, so we just suppress them.
_provision_errors_off();
drush_errors_off();
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
......@@ -481,14 +481,14 @@ function update_main() {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
drupal_maintenance_theme();
_provision_errors_on();
drush_errors_on();
set_error_handler('_drush_error_handler');
set_exception_handler('_drush_exception_handler');
drupal_load_updates();
provision_drupal_install_log(update_fix_d6_requirements());
provision_drupal_install_log(update_fix_compatibility());
_drush_log_update_sql(update_fix_d6_requirements());
_drush_log_update_sql(update_fix_compatibility());
$start = array();
$start['system'] = array();
......@@ -571,7 +571,7 @@ function _update_do_one($module, $number, &$context) {
drush_log("Running $function");
$ret = $function($context['sandbox']);
}
provision_drupal_install_log($ret);
_drush_log_update_sql($ret);
}
catch (Exception $e) {
drush_log(var_dump($e, TRUE));
......
......@@ -376,19 +376,6 @@ function _provision_drupal_delete_aliases($aliases) {
}
}
function provision_drupal_install_log($ret) {
if (sizeof($ret)) {
foreach ($ret as $info) {
if (is_array($info)) {
if (!$info['success']) {
drush_set_error('PROVISION_DRUPAL_INSTALL_FAILED', $msg);
}
drush_log($info['query'], ($info['success']) ? 'success' : 'error');
}
}
}
}
require_once('cvs_deploy.inc');
function provision_find_packages() {
......
......@@ -13,6 +13,8 @@
* @see provisionvalues
*/
drush_errors_on();
/**
* @defgroup sitedata Site data management utility functions.
* @{
......@@ -108,13 +110,13 @@ function provision_save_platform_data() {
* Generate the text for a config file using php
*/
function provision_render_config($template, $variables) {
_provision_errors_off();
drush_errors_off();
extract($variables, EXTR_SKIP); // Extract the variables to a local namespace
ob_start(); // Start output buffering
eval('?>'. $template); // Generate content
$contents = ob_get_contents(); // Get the contents of the buffer
ob_end_clean(); // End buffering and discard
_provision_errors_on();
drush_errors_on();
return $contents; // Return the contents
}
......@@ -282,20 +284,6 @@ function provision_password($length = 10) {
return $pass;
}
function _provision_errors_on() {
$errors =& drush_get_context('DRUPAL_ERROR_REPORTING', E_ALL ^ E_NOTICE);
$errors = error_reporting($errors);
ini_set('display_errors', TRUE);
}
_provision_errors_on();
function _provision_errors_off() {
$errors =& drush_get_context('DRUPAL_ERROR_REPORTING', 0);
$errors = error_reporting(0);
ini_set('display_errors', FALSE);
}
/**
* This is a helper function which changes deeply nested objects into arrays
*
......
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