From 56467535980b9b01559b2ea6f087c7d4c5b3615f Mon Sep 17 00:00:00 2001 From: webchick Date: Mon, 7 Nov 2011 22:40:10 -0800 Subject: Issue #951644 by catch, David_Rothstein, aschiwi, xjm: Fixed Requirement warnings (e.g. for PHP memory limit) are not shown on install or update unless there is a requirement error also. --- update.php | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'update.php') diff --git a/update.php b/update.php index 23ffa577f..5e771a824 100644 --- a/update.php +++ b/update.php @@ -245,7 +245,8 @@ function update_info_page() { $output .= "
  • Install your new files in the appropriate location, as described in the handbook.
  • \n"; $output .= "\n"; $output .= "

    When you have performed the steps above, you may proceed.

    \n"; - $output .= '

    '; + $form_action = check_url(drupal_current_script_url(array('op' => 'selection', 'token' => $token))); + $output .= '

    '; $output .= "\n"; return $output; } @@ -316,20 +317,26 @@ function update_extra_requirements($requirements = NULL) { } /** - * Check update requirements and report any errors. + * Check update requirements and report any errors or (optionally) warnings. + * + * @param $skip_warnings + * (optional) If set to TRUE, requirement warnings will be ignored, and a + * report will only be issued if there are requirement errors. Defaults to + * FALSE. */ -function update_check_requirements() { +function update_check_requirements($skip_warnings = FALSE) { // Check requirements of all loaded modules. $requirements = module_invoke_all('requirements', 'update'); $requirements += update_extra_requirements(); $severity = drupal_requirements_severity($requirements); - // If there are issues, report them. - if ($severity == REQUIREMENT_ERROR) { + // If there are errors, always display them. If there are only warnings, skip + // them if the caller has indicated they should be skipped. + if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING && !$skip_warnings)) { update_task_list('requirements'); drupal_set_title('Requirements problem'); $status_report = theme('status_report', array('requirements' => $requirements)); - $status_report .= 'Check the error messages and try again.'; + $status_report .= 'Check the error messages and try again.'; print theme('update_page', array('content' => $status_report)); exit(); } @@ -385,8 +392,9 @@ if (empty($op) && update_access_allowed()) { // Set up theme system for the maintenance page. drupal_maintenance_theme(); - // Check the update requirements for Drupal. - update_check_requirements(); + // Check the update requirements for Drupal. Only report on errors at this + // stage, since the real requirements check happens further down. + update_check_requirements(TRUE); // Redirect to the update information page if all requirements were met. install_goto('update.php?op=info'); @@ -418,8 +426,12 @@ if (update_access_allowed()) { update_fix_compatibility(); - // Check the update requirements for all modules. - update_check_requirements(); + // Check the update requirements for all modules. If there are warnings, but + // no errors, skip reporting them if the user has provided a URL parameter + // acknowledging the warnings and indicating a desire to continue anyway. See + // drupal_requirements_url(). + $skip_warnings = !empty($_GET['continue']); + update_check_requirements($skip_warnings); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : ''; switch ($op) { @@ -433,7 +445,12 @@ if (update_access_allowed()) { case 'Apply pending updates': if (isset($_GET['token']) && $_GET['token'] == drupal_get_token('update')) { - update_batch($_POST['start'], $base_url . '/update.php?op=results', $base_url . '/update.php'); + // Generate absolute URLs for the batch processing (using $base_root), + // since the batch API will pass them to url() which does not handle + // update.php correctly by default. + $batch_url = $base_root . drupal_current_script_url(); + $redirect_url = $base_root . drupal_current_script_url(array('op' => 'results')); + update_batch($_POST['start'], $redirect_url, $batch_url); break; } -- cgit v1.2.3