diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5402dae..90cfec5 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2622,6 +2622,9 @@ function drupal_common_theme() { 'variables' => array('content' => NULL, 'show_messages' => TRUE), 'template' => 'install-page', ), + 'maintenance_access_denied' => array( + 'variables' => array('script_name' => 'update.php', 'settings_name' => 'update_free_access', 'login' => TRUE, 'postfix' => ''), + ), 'task_list' => array( 'variables' => array('items' => NULL, 'active' => NULL, 'variant' => NULL), ), diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index d206e79..dc5c444 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -199,13 +199,13 @@ function theme_authorize_message($variables) { * @return * Rendered HTML warning with 403 status. */ -function maintenance_access_denied_page($script_name = 'update.php', $settings_name = 'update_free_access', $login = TRUE, $postfix = '') { +function theme_maintenance_access_denied($variables) { drupal_add_http_header('Status', '403 Forbidden'); header(\Drupal::request()->server->get('SERVER_PROTOCOL') . ' 403 Forbidden'); - watchdog('access denied', $script_name, NULL, WATCHDOG_WARNING); + watchdog('access denied', $variables['script_name'], NULL, WATCHDOG_WARNING); drupal_set_title('Access denied'); $output = '

Access denied. You are not authorized to access this page.'; - if ($login) { + if ($variables['login']) { $output .= 'Log in using either an account with the administer software updates permission or the site maintenance account (the account you created during installation). If you cannot log in, you will have to'; } else { @@ -214,17 +214,16 @@ function maintenance_access_denied_page($script_name = 'update.php', $settings_n $output .= 'edit settings.php to bypass this access check. To do this:

  1. With a text editor find the settings.php file on your system. From the main Drupal directory that you installed all the files into, go to sites/your_site_name if such directory exists, or else to sites/default which applies otherwise.
  2. -
  3. There is a line inside your settings.php file that says $settings[\'' . $settings_name . '\'] = FALSE;. Change it to $settings[\'' . $settings_name . '\'] = TRUE;.
  4. -
  5. As soon as the ' . $script_name . ' script is done, you must change the settings.php file back to its original form with $settings[\'' . $settings_name .'\'] = FALSE;.
  6. +
  7. There is a line inside your settings.php file that says $settings[\'' . $variables['settings_name'] . '\'] = FALSE;. Change it to $settings[\'' . $variables['settings_name'] . '\'] = TRUE;.
  8. +
  9. As soon as the ' . $variables['script_name'] . ' script is done, you must change the settings.php file back to its original form with $settings[\'' . $variables['settings_name'] .'\'] = FALSE;.
  10. '; - if ($login) { + if ($variables['login']) { $output .= 'To avoid having this problem in the future, remember to log in to your website using either an account with the administer software updates permission or the site maintenance account (the account you created during installation) before you backup your database at the beginning of the update process.'; } - if ($postfix) { - $output .= $postfix; + if ($variables['postfix']) { + $output .= $variables['postfix']; } $output .= '
'; return $output; } - diff --git a/core/rebuild.php b/core/rebuild.php index 937cf3b..5a1d0aa 100644 --- a/core/rebuild.php +++ b/core/rebuild.php @@ -37,11 +37,17 @@ require_once DRUPAL_ROOT . '/core/includes/update.inc'; $install_state = array('interactive' => FALSE) + install_state_defaults(); install_begin_request($install_state, FALSE); - $output = maintenance_access_denied_page('rebuild.php', 'rebuild_access', FALSE, 'Read more information, see the handbook.'); drupal_add_http_header('Content-Type', 'text/html; charset=utf-8'); + $content = array( + '#theme' => 'maintenance_access_denied', + '#script_name' => 'rebuild.php', + '#settings_name' => 'rebuild_access', + '#login' => FALSE, + '#postfix' => 'Read more information, see the handbook.', + ); $maintenance_page = array( '#theme' => 'maintenance_page', - '#content' => $output, + '#content' => drupal_render($content), '#show_messages' => FALSE, ); print drupal_render($maintenance_page); diff --git a/core/update.php b/core/update.php index e4f252b..393bbb7 100644 --- a/core/update.php +++ b/core/update.php @@ -438,7 +438,8 @@ function update_check_requirements($skip_warnings = FALSE) { } } else { - $output = maintenance_access_denied_page(); + $content = array('#theme' => 'maintenance_access_denied'); + $output = drupal_render($content); } if (isset($output) && $output) { // Explicitly start a session so that the update.php token will be accepted.