diff --git a/core/includes/update.inc b/core/includes/update.inc
index 5a567f4..554fb3d 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -72,6 +72,107 @@ function update_check_incompatibility($name, $type = 'module') {
}
/**
+ * Returns whether the settings file requirement has been satisfied.
+ *
+ * @return array
+ * A requirements info array.
+ */
+function update_settings_file_requirements() {
+ $requirements = array();
+
+ // Check whether settings.php needs to be rewritten.
+ $settings_file = conf_path() . '/settings.php';
+ $writable = drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_WRITABLE);
+ $requirements['settings file']['title'] = 'Settings file';
+ if ($writable) {
+ $requirements['settings file'] += array(
+ 'value' => 'settings.php is writable.',
+ );
+ }
+ else {
+ $requirements['settings file'] += array(
+ 'value' => 'settings.php is not writable.',
+ 'severity' => REQUIREMENT_ERROR,
+ 'description' => 'Drupal requires write permissions to ' . $settings_file . ' during the update process. If you are unsure how to grant file permissions, consult the online handbook.',
+ );
+ }
+ return $requirements;
+}
+
+/**
+ * Checks whether the minimum system schema version has been satisfied.
+ *
+ * Upgrading from a 7.x site database should block the update process.
+ * Ensure that the site is running Drupal 8 before proceeding. Not that this
+ * has to happen AFTER the database bootstraps because of
+ * drupal_get_installed_schema_version().
+ *
+ * @return array
+ * A requirements info array.
+ */
+function update_migrate_requirements() {
+ $requirements = array();
+ try {
+ $system_schema = drupal_get_installed_schema_version('system');
+ }
+ catch (\Exception $e) {
+ $system_schema = db_query('SELECT schema_version FROM {system} WHERE name = :system', array(':system' => 'system'))->fetchField();
+ }
+ if ($system_schema < \Drupal::CORE_MINIMUM_SCHEMA_VERSION) {
+ $requirements = array(
+ 'drupal 7 version' => array(
+ 'title' => 'Drupal 7 version',
+ 'value' => 'Your site database is from a Drupal 7 or earlier site.',
+ 'severity' => REQUIREMENT_ERROR,
+ 'description' => 'Migrate your Drupal 7 installation to a Drupal 8 installation using the Migrate module. Updating directly from Drupal 7 to Drupal 8 is not supported.',
+ ),
+ );
+ }
+ return $requirements;
+}
+
+/**
+ * Checks update requirements and reports errors and (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($skip_warnings = FALSE) {
+ // Upgrading from a 7.x site database should block the update process.
+ $requirements = update_migrate_requirements();
+ // If the user is not upgrading for a system schema prior to 8.x, gather
+ // any additional extra requirements.
+ if (empty($requirements)) {
+ // Check requirements of all loaded modules.
+ $requirements = \Drupal::moduleHandler()->invokeAll('requirements', array('update'));
+ $requirements += update_settings_file_requirements();
+ }
+ $severity = drupal_requirements_severity($requirements);
+
+ // 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 = array(
+ '#theme' => 'status_report',
+ '#requirements' => $requirements,
+ );
+ $status_report = drupal_render($status);
+ $status_report .= 'Check the messages and try again.';
+ drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
+ $maintenance_page = array(
+ '#theme' => 'maintenance_page',
+ '#content' => $status_report,
+ );
+ print drupal_render($maintenance_page);
+ exit();
+ }
+}
+
+/**
* Performs extra steps required to bootstrap when using a Drupal 7 database.
*
* Users who still have a Drupal 7 database (and are in the process of
@@ -111,27 +212,6 @@ function update_prepare_d8_bootstrap() {
$kernel = new DrupalKernel('update', drupal_classloader(), FALSE);
$kernel->boot();
- // If any of the required settings needs to be written, then settings.php
- // needs to be writable.
- if (!$settings_exist) {
- $settings_file = conf_path() . '/settings.php';
- $writable = drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_WRITABLE);
- $requirements['settings file']['title'] = 'Settings file';
- if ($writable) {
- $requirements['settings file'] += array(
- 'value' => 'settings.php is writable.',
- );
- }
- else {
- $requirements['settings file'] += array(
- 'value' => 'settings.php is not writable.',
- 'severity' => REQUIREMENT_ERROR,
- 'description' => 'Drupal requires write permissions to ' . $settings_file . ' during the update process. If you are unsure how to grant file permissions, consult the online handbook.',
- );
- }
- update_extra_requirements($requirements);
- }
-
// Bootstrap the database.
require_once __DIR__ . '/database.inc';
@@ -139,26 +219,6 @@ function update_prepare_d8_bootstrap() {
// below.
require_once __DIR__ . '/module.inc';
- // Ensure that the site is running Drupal 8 before proceeding. Not that this
- // has to happen AFTER the database bootstraps because of
- // drupal_get_installed_schema_version().
- try {
- $system_schema = drupal_get_installed_schema_version('system');
- }
- catch (\Exception $e) {
- $system_schema = db_query('SELECT schema_version FROM {system} WHERE name = :system', array(':system' => 'system'))->fetchField();
- }
- if ($system_schema < \Drupal::CORE_MINIMUM_SCHEMA_VERSION) {
- $requirements = array(
- 'drupal 7 version' => array(
- 'title' => 'Drupal 7 version',
- 'value' => 'Your site database is from a Drupal 7 or earlier site.',
- 'severity' => REQUIREMENT_ERROR,
- 'description' => 'Migrate your Drupal 7 installation to a Drupal 8 installation using the Migrate module. Updating directly from Drupal 7 to Drupal 8 is not supported.',
- ),
- );
- update_migrate_requirements($requirements);
- }
// Moves install_profile from variable to settings. You can't do that in
// system.install because _system_rebuild_module_data() needs the profile
// directly. Check that it has not been set already. This is the case for
diff --git a/core/update.php b/core/update.php
index 5983cbd..dd301cf 100644
--- a/core/update.php
+++ b/core/update.php
@@ -285,71 +285,6 @@ function update_task_list($active = NULL) {
drupal_add_region_content('sidebar_first', drupal_render($task_list));
}
-/**
- * Returns and stores extra requirements that apply during the update process.
- */
-function update_extra_requirements($requirements = NULL) {
- $extra_requirements = &drupal_static(__FUNCTION__);
- if (!isset($extra_requirements)) {
- $extra_requirements = array();
- }
- $extra_requirements += $requirements;
- return $extra_requirements;
-}
-
-/**
- * Returns and stores migration requirements that apply during the
- * update process.
- */
-function update_migrate_requirements($requirements = array()) {
- $migrate_requirements = &drupal_static(__FUNCTION__);
- if (!isset($migrate_requirements)) {
- $migrate_requirements = array();
- }
- $migrate_requirements += $requirements;
- return $migrate_requirements;
-}
-
-/**
- * Checks update requirements and reports errors and (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($skip_warnings = FALSE) {
- // Upgrading from a 7.x site database should block the update process.
- $requirements = update_migrate_requirements();
- if (empty($requirements)) {
- // Check requirements of all loaded modules.
- $requirements = \Drupal::moduleHandler()->invokeAll('requirements', array('update'));
- $requirements += update_extra_requirements();
- }
- $severity = drupal_requirements_severity($requirements);
-
- // 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 = array(
- '#theme' => 'status_report',
- '#requirements' => $requirements,
- );
- $status_report = drupal_render($status);
- $status_report .= 'Check the messages and try again.';
- drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
- $maintenance_page = array(
- '#theme' => 'maintenance_page',
- '#content' => $status_report,
- );
- print drupal_render($maintenance_page);
- exit();
- }
-}
-
-
// 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.
ini_set('display_errors', FALSE);
@@ -403,6 +338,8 @@ function update_check_requirements($skip_warnings = FALSE) {
// Check the update requirements for Drupal. Only report on errors at this
// stage, since the real requirements check happens further down.
+ // The request will exit() if any requirement violations are reported in the
+ // following function invocation.
update_check_requirements(TRUE);
// Redirect to the update information page if all requirements were met.