diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-09-30 15:08:10 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-09-30 15:08:10 -0700 |
commit | 25a927031c218d7bd49da1bad5f97bef690a7518 (patch) | |
tree | f60cbcc9d9aabc492193442ab555dce753bd1fc6 /includes | |
parent | e120a6e886a40eaf135f6032aa47e3eeeb58b3af (diff) | |
download | brdo-25a927031c218d7bd49da1bad5f97bef690a7518.tar.gz brdo-25a927031c218d7bd49da1bad5f97bef690a7518.tar.bz2 |
Issue #1289364 by swentel: Fixed SchemaCache generates empty cid.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 2 | ||||
-rw-r--r-- | includes/install.core.inc | 22 | ||||
-rw-r--r-- | includes/install.inc | 63 |
3 files changed, 79 insertions, 8 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 39c1b0852..545beba21 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -2778,7 +2778,7 @@ class SchemaCache extends DrupalCacheArray { public function __construct() { // Cache by request method. - parent::__construct('schema:runtime:' . $_SERVER['REQUEST_METHOD'] == 'GET', 'cache'); + parent::__construct('schema:runtime:' . ($_SERVER['REQUEST_METHOD'] == 'GET'), 'cache'); } protected function resolveCacheMiss($offset) { diff --git a/includes/install.core.inc b/includes/install.core.inc index a74dfdf0f..094c9b871 100644 --- a/includes/install.core.inc +++ b/includes/install.core.inc @@ -710,8 +710,10 @@ function install_display_output($output, $install_state) { * * @return * A themed status report, or an exception if there are requirement errors. - * Otherwise, no output is returned, so that the next task can be run - * in the same page request. + * If there are only requirement warnings, a themed status report is shown + * initially, but the user is allowed to bypass it by providing 'continue=1' + * in the URL. Otherwise, no output is returned, so that the next task can be + * run in the same page request. */ function install_verify_requirements(&$install_state) { // Check the installation requirements for Drupal and this profile. @@ -723,22 +725,30 @@ function install_verify_requirements(&$install_state) { // Check the severity of the requirements reported. $severity = drupal_requirements_severity($requirements); - if ($severity == REQUIREMENT_ERROR) { + // If there are errors, always display them. If there are only warnings, skip + // them if the user has provided a URL parameter acknowledging the warnings + // and indicating a desire to continue anyway. See drupal_requirements_url(). + if ($severity == REQUIREMENT_ERROR || ($severity == REQUIREMENT_WARNING && empty($install_state['parameters']['continue']))) { if ($install_state['interactive']) { drupal_set_title(st('Requirements problem')); $status_report = theme('status_report', array('requirements' => $requirements)); - $status_report .= st('Check the error messages and <a href="!url">proceed with the installation</a>.', array('!url' => check_url(request_uri()))); + $status_report .= st('Check the error messages and <a href="!url">proceed with the installation</a>.', array('!url' => check_url(drupal_requirements_url($severity)))); return $status_report; } else { - // Throw an exception showing all unmet requirements. + // Throw an exception showing any unmet requirements. $failures = array(); foreach ($requirements as $requirement) { + // Skip warnings altogether for non-interactive installations; these + // proceed in a single request so there is no good opportunity (and no + // good method) to warn the user anyway. if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) { $failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description']; } } - throw new Exception(implode("\n\n", $failures)); + if (!empty($failures)) { + throw new Exception(implode("\n\n", $failures)); + } } } } diff --git a/includes/install.inc b/includes/install.inc index 089cdee8f..88a663a4f 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -999,7 +999,6 @@ function drupal_install_fix_file($file, $mask, $message = TRUE) { } } - /** * Send the user to a different installer page. * @@ -1017,6 +1016,68 @@ function install_goto($path) { } /** + * Returns the URL of the current script, with modified query parameters. + * + * This function can be called by low-level scripts (such as install.php and + * update.php) and returns the URL of the current script. Existing query + * parameters are preserved by default, but new ones can optionally be merged + * in. + * + * This function is used when the script must maintain certain query parameters + * over multiple page requests in order to work correctly. In such cases (for + * example, update.php, which requires the 'continue=1' parameter to remain in + * the URL throughout the update process if there are any requirement warnings + * that need to be bypassed), using this function to generate the URL for links + * to the next steps of the script ensures that the links will work correctly. + * + * @param $query + * (optional) An array of query parameters to merge in to the existing ones. + * + * @return + * The URL of the current script, with query parameters modified by the + * passed-in $query. The URL is not sanitized, so it still needs to be run + * through check_url() if it will be used as an HTML attribute value. + * + * @see drupal_requirements_url() + */ +function drupal_current_script_url($query = array()) { + $uri = $_SERVER['SCRIPT_NAME']; + $query = array_merge(drupal_get_query_parameters(), $query); + if (!empty($query)) { + $uri .= '?' . drupal_http_build_query($query); + } + return $uri; +} + +/** + * Returns a URL for proceeding to the next page after a requirements problem. + * + * This function can be called by low-level scripts (such as install.php and + * update.php) and returns a URL that can be used to attempt to proceed to the + * next step of the script. + * + * @param $severity + * The severity of the requirements problem, as returned by + * drupal_requirements_severity(). + * + * @return + * A URL for attempting to proceed to the next step of the script. The URL is + * not sanitized, so it still needs to be run through check_url() if it will + * be used as an HTML attribute value. + * + * @see drupal_current_script_url() + */ +function drupal_requirements_url($severity) { + $query = array(); + // If there are no errors, only warnings, append 'continue=1' to the URL so + // the user can bypass this screen on the next page load. + if ($severity == REQUIREMENT_WARNING) { + $query['continue'] = 1; + } + return drupal_current_script_url($query); +} + +/** * Functional equivalent of t(), used when some systems are not available. * * Used during the install process, when database, theme, and localization |