Commit 9771f15f authored by Dries's avatar Dries
Browse files

- Patch #179143 by Gabor, JirkaRybka, chx, ChrisKennedy, et al: do not fire...

- Patch #179143 by Gabor, JirkaRybka, chx, ChrisKennedy, et al: do not fire bootstrap hooks during update.
parent db2c726a
...@@ -294,6 +294,8 @@ function drupal_get_destination() { ...@@ -294,6 +294,8 @@ function drupal_get_destination() {
* @see drupal_get_destination() * @see drupal_get_destination()
*/ */
function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) { function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) {
global $update_mode;
if (isset($_REQUEST['destination'])) { if (isset($_REQUEST['destination'])) {
extract(parse_url(urldecode($_REQUEST['destination']))); extract(parse_url(urldecode($_REQUEST['destination'])));
} }
...@@ -306,7 +308,10 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response ...@@ -306,7 +308,10 @@ function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response
$url = str_replace(array("\n", "\r"), '', $url); $url = str_replace(array("\n", "\r"), '', $url);
// Allow modules to react to the end of the page request before redirecting. // Allow modules to react to the end of the page request before redirecting.
module_invoke_all('exit', $url); // We do not want this while running update.php.
if (empty($update_mode)) {
module_invoke_all('exit', $url);
}
// Even though session_write_close() is registered as a shutdown function, we // Even though session_write_close() is registered as a shutdown function, we
// need all session data written to the database before redirecting. // need all session data written to the database before redirecting.
...@@ -1853,7 +1858,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ...@@ -1853,7 +1858,7 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
* References to JavaScript files are placed in a certain order: first, all * References to JavaScript files are placed in a certain order: first, all
* 'core' files, then all 'module' and finally all 'theme' JavaScript files * 'core' files, then all 'module' and finally all 'theme' JavaScript files
* are added to the page. Then, all settings are output, followed by 'inline' * are added to the page. Then, all settings are output, followed by 'inline'
* JavaScript code. * JavaScript code. If running update.php, all preprocessing is disabled.
* *
* @parameter $scope * @parameter $scope
* (optional) The scope for which the JavaScript rules should be returned. * (optional) The scope for which the JavaScript rules should be returned.
...@@ -1865,7 +1870,8 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer ...@@ -1865,7 +1870,8 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
* All JavaScript code segments and includes for the scope as HTML tags. * All JavaScript code segments and includes for the scope as HTML tags.
*/ */
function drupal_get_js($scope = 'header', $javascript = NULL) { function drupal_get_js($scope = 'header', $javascript = NULL) {
if (function_exists('locale_inc_callback')) { global $update_mode;
if (empty($update_mode) && function_exists('locale_inc_callback')) {
locale_inc_callback('_locale_update_js_files'); locale_inc_callback('_locale_update_js_files');
} }
...@@ -1881,7 +1887,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { ...@@ -1881,7 +1887,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
$preprocessed = ''; $preprocessed = '';
$no_preprocess = array('core' => '', 'module' => '', 'theme' => ''); $no_preprocess = array('core' => '', 'module' => '', 'theme' => '');
$files = array(); $files = array();
$preprocess_js = variable_get('preprocess_js', FALSE); $preprocess_js = (variable_get('preprocess_js', FALSE) && empty($update_mode));
$directory = file_directory_path(); $directory = file_directory_path();
$is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC); $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
...@@ -2459,6 +2465,7 @@ function xmlrpc($url) { ...@@ -2459,6 +2465,7 @@ function xmlrpc($url) {
function _drupal_bootstrap_full() { function _drupal_bootstrap_full() {
static $called; static $called;
global $update_mode;
if ($called) { if ($called) {
return; return;
...@@ -2485,8 +2492,10 @@ function _drupal_bootstrap_full() { ...@@ -2485,8 +2492,10 @@ function _drupal_bootstrap_full() {
// Load all enabled modules // Load all enabled modules
module_load_all(); module_load_all();
// Let all modules take action before menu system handles the request // Let all modules take action before menu system handles the request
module_invoke_all('init'); // We do not want this while running update.php.
if (empty($update_mode)) {
module_invoke_all('init');
}
} }
/** /**
......
...@@ -813,6 +813,11 @@ function update_task_list($active = NULL) { ...@@ -813,6 +813,11 @@ function update_task_list($active = NULL) {
include_once './includes/bootstrap.inc'; include_once './includes/bootstrap.inc';
update_fix_system_table(); update_fix_system_table();
// Bootstrap Drupal in a safe way, without calling hook_init() and hook_exit(),
// to avoid possible warnings. We need to set the global variable after
// DRUPAL_BOOTSTRAP_CONFIGURATION, which unsets globals, but before the rest.
drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION);
$update_mode = TRUE;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_maintenance_theme(); drupal_maintenance_theme();
......
Supports Markdown
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