diff --git a/core/includes/install.inc b/core/includes/install.inc index 256c79e..d017773 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -634,8 +634,14 @@ function drupal_install_system() { $system_path = drupal_get_path('module', 'system'); require_once DRUPAL_ROOT . '/' . $system_path . '/system.install'; + + // Set the schema version to the number of the last update provided by the + // module, or the minimum core schema version. + $system_version = \Drupal::CORE_MINIMUM_SCHEMA_VERSION; $system_versions = drupal_get_schema_versions('system'); - $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; + if ($system_versions) { + $system_version = max(max($system_versions), $system_version); + } \Drupal::keyValue('system.schema')->set('system', $system_version); // System module needs to be enabled and the system/module lists need to be diff --git a/core/includes/schema.inc b/core/includes/schema.inc index d0fd30b..59c79c0 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -8,6 +8,7 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Database\Database; use Drupal\Core\Utility\SchemaCache; +use Drupal\Core\Extension\ExtensionSchemaVersionException; /** * @addtogroup schemaapi @@ -20,11 +21,6 @@ const SCHEMA_UNINSTALLED = -1; /** - * Indicates that a module has been installed. - */ -const SCHEMA_INSTALLED = 0; - -/** * Gets the schema definition of a table, or the whole database schema. * * The returned schema will include any modifications made by any @@ -143,7 +139,17 @@ function drupal_get_schema_versions($module) { } } // Ensure that updates are applied in numerical order. - foreach ($updates as &$module_updates) { + foreach ($updates as $module => &$module_updates) { + // No module is allowed to define a schema update of exactly + // \Drupal::CORE_MINIMUM_SCHEMA_VERSION because this is reserved for the + // minimum installed version. + if (in_array(\Drupal::CORE_MINIMUM_SCHEMA_VERSION, $module_updates)) { + throw new ExtensionSchemaVersionException(format_string("%module's hook_update_N() implementations must use N greater than @version.", array( + '%module' => $module, + '@version' => \Drupal::CORE_MINIMUM_SCHEMA_VERSION, + ))); + } + sort($module_updates, SORT_NUMERIC); } } diff --git a/core/includes/update.inc b/core/includes/update.inc index b17624f..0649254 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -19,16 +19,6 @@ use Symfony\Component\HttpFoundation\Request; /** - * Minimum schema version of Drupal 7 required for upgrade to Drupal 8. - * - * Upgrades from Drupal 7 to Drupal 8 require that Drupal 7 be running - * the most recent version, or the upgrade could fail. We can't easily - * check the Drupal 7 version once the update process has begun, so instead - * we check the schema version of system.module. - */ -const REQUIRED_D7_SCHEMA_VERSION = '7069'; - -/** * Disables any extensions that are incompatible with the current core version. */ function update_fix_compatibility() { @@ -148,9 +138,8 @@ function update_prepare_d8_bootstrap() { // below. require_once __DIR__ . '/module.inc'; - // If the site has not updated to Drupal 8 yet, check to make sure that it is - // running an up-to-date version of Drupal 7 before proceeding. Note this has - // to happen AFTER the database bootstraps because of + // 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'); @@ -158,282 +147,16 @@ function update_prepare_d8_bootstrap() { catch (\Exception $e) { $system_schema = db_query('SELECT schema_version FROM {system} WHERE name = :system', array(':system' => 'system'))->fetchField(); } - if ($system_schema < 8000) { - $has_required_schema = $system_schema >= REQUIRED_D7_SCHEMA_VERSION; + if ($system_schema < \Drupal::MINIMUM_CORE_SCHEMA_VERSION) { $requirements = array( 'drupal 7 version' => array( 'title' => 'Drupal 7 version', - 'value' => $has_required_schema ? 'You are running a current version of Drupal 7.' : 'You are not running a current version of Drupal 7', - 'severity' => $has_required_schema ? NULL : REQUIREMENT_ERROR, - 'description' => $has_required_schema ? '' : 'Please update your Drupal 7 installation to the most recent version before attempting to upgrade to Drupal 8', + 'value' => 'Your site database is from a Drupal 7 or earlier site.', + 'severity' => REQUIREMENT_ERROR, + 'description' => 'Please 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_extra_requirements($requirements); - - // @todo update.php stages seem to be completely screwed up; the initial - // requirements check is not supposed to change the system. All of the - // following code seems to have been mistakenly/unknowingly added here and - // does not belong into update_prepare_d8_bootstrap(). - if ($has_required_schema) { - if (!db_table_exists('key_value')) { - $specs = array( - 'description' => 'Generic key-value storage table. See the state system for an example.', - 'fields' => array( - 'collection' => array( - 'description' => 'A named collection of key and value pairs.', - 'type' => 'varchar', - 'length' => 128, - 'not null' => TRUE, - 'default' => '', - ), - 'name' => array( - 'description' => 'The key of the key-value pair. As KEY is a SQL reserved keyword, name was chosen instead.', - 'type' => 'varchar', - 'length' => 128, - 'not null' => TRUE, - 'default' => '', - ), - 'value' => array( - 'description' => 'The value.', - 'type' => 'blob', - 'not null' => TRUE, - 'size' => 'big', - 'translatable' => TRUE, - ), - ), - 'primary key' => array('collection', 'name'), - ); - db_create_table('key_value', $specs); - } - if (!db_table_exists('cache_tags')) { - $table = array( - 'description' => 'Cache table for tracking cache tags related to the cache bin.', - 'fields' => array( - 'tag' => array( - 'description' => 'Namespace-prefixed tag string.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), - 'invalidations' => array( - 'description' => 'Number incremented when the tag is invalidated.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'deletions' => array( - 'description' => 'Number incremented when the tag is deleted.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - ), - 'primary key' => array('tag'), - ); - db_create_table('cache_tags', $table); - } - if (!db_table_exists('cache_config')) { - $spec = array( - 'description' => 'Cache table for configuration data.', - 'fields' => array( - 'cid' => array( - 'description' => 'Primary Key: Unique cache ID.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), - 'data' => array( - 'description' => 'A collection of data to cache.', - 'type' => 'blob', - 'not null' => FALSE, - 'size' => 'big', - ), - 'expire' => array( - 'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'created' => array( - 'description' => 'A Unix timestamp indicating when the cache entry was created.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'serialized' => array( - 'description' => 'A flag to indicate whether content is serialized (1) or not (0).', - 'type' => 'int', - 'size' => 'small', - 'not null' => TRUE, - 'default' => 0, - ), - 'tags' => array( - 'description' => 'Space-separated list of cache tags for this entry.', - 'type' => 'text', - 'size' => 'big', - 'not null' => FALSE, - ), - 'checksum_invalidations' => array( - 'description' => 'The tag invalidation sum when this entry was saved.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - 'checksum_deletions' => array( - 'description' => 'The tag deletion sum when this entry was saved.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - ), - ), - 'indexes' => array( - 'expire' => array('expire'), - ), - 'primary key' => array('cid'), - ); - db_create_table('cache_config', $spec); - } - - require_once DRUPAL_ROOT . '/core/modules/system/system.install'; - $tables = array( - 'cache', - 'cache_bootstrap', - 'cache_block', - 'cache_field', - 'cache_filter', - 'cache_form', - 'cache_image', - 'cache_menu', - 'cache_page', - 'cache_path', - 'cache_update', - ); - - foreach ($tables as $table) { - update_add_cache_columns($table); - } - - // Bootstrap variables so we can update theme while preparing the update - // process. - drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); - - // Update the 'language_default' system variable, if configured. - // Required to run before drupal_install_config_directories(), since that - // triggers a call into system_stream_wrappers(), which calls t(), which - // calls into language_default(). - $language_default = update_variable_get('language_default'); - if (!empty($language_default) && (isset($language_default->id) || isset($language_default->language))) { - if (!isset($language_default->id)) { - $language_default->id = $language_default->language; - } - unset($language_default->language); - // In D8, the 'language_default' is not anymore an object, but an array, - // so make sure that the new value that is saved into this variable is an - // array. - update_variable_set('language_default', (array) $language_default); - } - - $module_config = \Drupal::config('system.module'); - $theme_config = \Drupal::config('system.theme'); - $disabled_themes = \Drupal::config('system.theme.disabled'); - $schema_store = \Drupal::keyValue('system.schema'); - - // Load system.module, because update_prepare_d8_bootstrap() is called in - // the initial minimal update.php bootstrap that performs the core - // requirements check. - require_once DRUPAL_ROOT . '/core/modules/system/system.module'; - - // Make sure that the bootstrap cache is cleared as that might contain - // incompatible data structures. - cache('bootstrap')->deleteAll(); - - // Retrieve all installed extensions from the {system} table. - // Uninstalled extensions are ignored and not converted. - $result = db_query('SELECT name, status, weight, schema_version, type FROM {system} WHERE type = :theme OR (type = :module AND schema_version <> :schema_uninstalled)', array( - ':theme' => 'theme', - ':module' => 'module', - ':schema_uninstalled' => SCHEMA_UNINSTALLED, - )); - - $module_data = _system_rebuild_module_data(); - - // Migrate each extension into configuration, varying by the extension's - // status, and record its schema version. - foreach ($result as $record) { - // Before migrating any extension into configuration, make sure the - // extensions name length is not higher than the limit. - if (drupal_strlen($record->name) > 50) { - $requirements['module name too long ' . $record->name] = array( - 'title' => 'Module name too long', - 'value' => format_string('@name is @count characters long.', array('@name' => $record->name, '@count' => drupal_strlen($record->name))), - 'description' => 'Module names longer than 50 characters are no longer supported.', - 'severity' => REQUIREMENT_ERROR, - ); - update_extra_requirements($requirements); - } - - if ($record->type == 'module') { - if ($record->status && isset($module_data[$record->name])) { - $module_config->set('enabled.' . $record->name, $record->weight); - } - } - elseif ($record->type == 'theme') { - if ($record->status) { - $theme_config->set('enabled.' . $record->name, 0); - } - else { - $disabled_themes->set($record->name, 0); - } - } - $schema_store->set($record->name, $record->schema_version); - } - $sorted_modules = module_config_sort($module_config->get('enabled')); - $module_config->set('enabled', $sorted_modules)->save(); - $sorted_with_filenames = array(); - foreach (array_keys($sorted_modules) as $m) { - $sorted_with_filenames[$m] = drupal_get_filename('module', $m); - } - \Drupal::moduleHandler()->setModuleList($sorted_with_filenames); - $theme_config->save(); - $disabled_themes->save(); - - // Migrate the private key to state. This is used to create the token for - // the upgrade batch so needs to be be done before the upgrade has begun. - update_variables_to_state(array( - 'drupal_private_key' => 'system.private_key', - )); - - // Update the dynamic include paths that might be used before running the - // proper update functions. - update_prepare_stored_includes(); - // Update the environment for the language bootstrap if needed. - update_prepare_d8_language(); - // Rebuild kernel after new language fields are added in the database - // because the translation service depends on them being there. - \Drupal::service('kernel')->updateModules($sorted_with_filenames, $sorted_with_filenames); - - // Change language column to langcode in url_alias. - if (db_table_exists('url_alias') && db_field_exists('url_alias', 'language')) { - db_drop_index('url_alias', 'alias_language_pid'); - db_drop_index('url_alias', 'source_language_pid'); - $langcode_spec = array( - 'description' => "The language code this alias is for; if 'und', the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.", - 'type' => 'varchar', - 'length' => 12, - 'not null' => TRUE, - 'default' => '', - ); - $langcode_indexes = array('indexes' => - array( - 'alias_langcode_pid' => array('alias', 'langcode', 'pid'), - 'source_langcode_pid' => array('source', 'langcode', 'pid'), - ), - ); - db_change_field('url_alias', 'language', 'langcode', $langcode_spec, $langcode_indexes); - } - } } // Moves install_profile from variable to settings. You can't do that in // system.install because _system_rebuild_module_data() needs the profile @@ -670,70 +393,6 @@ function update_prepare_d8_language() { } /** - * Performs Drupal 7.x to 8.x required update.php updates. - * - * This function runs when update.php is run the first time for 8.x, - * even before updates are selected or performed. It is important - * that if updates are not ultimately performed that no changes are - * made which make it impossible to continue using the prior version. - */ -function update_fix_d8_requirements() { - if (drupal_get_installed_schema_version('system') < 8000 && !update_variable_get('update_d8_requirements', FALSE)) { - - // Make sure that file.module is enabled as it is required for the user - // picture upgrade path. - \Drupal::moduleHandler()->install(array('file')); - - $schema = array( - 'description' => 'Generic key/value storage table with an expiration.', - 'fields' => array( - 'collection' => array( - 'description' => 'A named collection of key and value pairs.', - 'type' => 'varchar', - 'length' => 128, - 'not null' => TRUE, - 'default' => '', - ), - 'name' => array( - // KEY is an SQL reserved word, so use 'name' as the key's field name. - 'description' => 'The key of the key/value pair.', - 'type' => 'varchar', - 'length' => 128, - 'not null' => TRUE, - 'default' => '', - ), - 'value' => array( - 'description' => 'The value of the key/value pair.', - 'type' => 'blob', - 'not null' => TRUE, - 'size' => 'big', - ), - 'expire' => array( - 'description' => 'The time since Unix epoch in seconds when this item expires. Defaults to the maximum possible time.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 2147483647, - ), - ), - 'primary key' => array('collection', 'name'), - 'indexes' => array( - 'all' => array('name', 'collection', 'expire'), - ), - ); - db_create_table('key_value_expire', $schema); - - // Views module is required to convert all previously existing listings into - // views configurations. - // Like any other module APIs and services, Views' services are not available - // in update.php. Existing listings are migrated into configuration, using - // the limited standard tools of raw database queries and \Drupal::config(). - \Drupal::moduleHandler()->install(array('views')); - - update_variable_set('update_d8_requirements', TRUE); - } -} - -/** * Forces a module to a given schema version. * * This function is rarely necessary. @@ -984,7 +643,7 @@ function update_get_update_list() { $modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE); foreach ($modules as $module => $schema_version) { // Skip uninstalled and incompatible modules. - if ($schema_version == SCHEMA_UNINSTALLED || update_check_incompatibility($module)) { + if ($schema_version == SCHEMA_UNINSTALLED || $schema_version < \Drupal::CORE_MINIMUM_SCHEMA_VERSION || update_check_incompatibility($module)) { continue; } // Otherwise, get the list of updates defined by this module. diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php index 9c14801..af16bd5 100644 --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -87,6 +87,11 @@ class Drupal { const CORE_COMPATIBILITY = '8.x'; /** + * Core minimum schema version. + */ + const CORE_MINIMUM_SCHEMA_VERSION = 8000; + + /** * The currently active container object. * * @var \Symfony\Component\DependencyInjection\ContainerInterface diff --git a/core/lib/Drupal/Core/Extension/ExtensionSchemaVersionException.php b/core/lib/Drupal/Core/Extension/ExtensionSchemaVersionException.php new file mode 100644 index 0000000..2b166ac --- /dev/null +++ b/core/lib/Drupal/Core/Extension/ExtensionSchemaVersionException.php @@ -0,0 +1,13 @@ +assertTrue($update_dependencies['system'][8000]['update_test_1'] == 8000, 'An update function that has a dependency on two separate modules has the first dependency recorded correctly.'); - $this->assertTrue($update_dependencies['system'][8000]['update_test_2'] == 8001, 'An update function that has a dependency on two separate modules has the second dependency recorded correctly.'); - $this->assertTrue($update_dependencies['system'][8001]['update_test_1'] == 8002, 'An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.'); + $this->assertTrue($update_dependencies['system'][8001]['update_test_1'] == 8001, 'An update function that has a dependency on two separate modules has the first dependency recorded correctly.'); + $this->assertTrue($update_dependencies['system'][8001]['update_test_2'] == 8002, 'An update function that has a dependency on two separate modules has the second dependency recorded correctly.'); + $this->assertTrue($update_dependencies['system'][8002]['update_test_1'] == 8003, 'An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/DependencyMissingTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/DependencyMissingTest.php index 6c71371..d0ab4a3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Update/DependencyMissingTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/DependencyMissingTest.php @@ -38,11 +38,11 @@ function setUp() { function testMissingUpdate() { $starting_updates = array( - 'update_test_2' => 8000, + 'update_test_2' => 8001, ); $update_graph = update_resolve_dependencies($starting_updates); - $this->assertTrue($update_graph['update_test_2_update_8000']['allowed'], "The module's first update function is allowed to run, since it does not have any missing dependencies."); - $this->assertFalse($update_graph['update_test_2_update_8001']['allowed'], "The module's second update function is not allowed to run, since it has a direct dependency on a missing update."); - $this->assertFalse($update_graph['update_test_2_update_8002']['allowed'], "The module's third update function is not allowed to run, since it has an indirect dependency on a missing update."); + $this->assertTrue($update_graph['update_test_2_update_8001']['allowed'], "The module's first update function is allowed to run, since it does not have any missing dependencies."); + $this->assertFalse($update_graph['update_test_2_update_8002']['allowed'], "The module's second update function is not allowed to run, since it has a direct dependency on a missing update."); + $this->assertFalse($update_graph['update_test_2_update_8003']['allowed'], "The module's third update function is not allowed to run, since it has an indirect dependency on a missing update."); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/DependencyOrderingTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/DependencyOrderingTest.php index b007546..11d404e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Update/DependencyOrderingTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/DependencyOrderingTest.php @@ -39,12 +39,12 @@ function setUp() { */ function testUpdateOrderingSingleModule() { $starting_updates = array( - 'update_test_1' => 8000, + 'update_test_1' => 8001, ); $expected_updates = array( - 'update_test_1_update_8000', 'update_test_1_update_8001', 'update_test_1_update_8002', + 'update_test_1_update_8003', ); $actual_updates = array_keys(update_resolve_dependencies($starting_updates)); $this->assertEqual($expected_updates, $actual_updates, 'Updates within a single module run in the correct order.'); @@ -55,14 +55,14 @@ function testUpdateOrderingSingleModule() { */ function testUpdateOrderingModuleInterdependency() { $starting_updates = array( - 'update_test_2' => 8000, - 'update_test_3' => 8000, + 'update_test_2' => 8001, + 'update_test_3' => 8001, ); $update_order = array_keys(update_resolve_dependencies($starting_updates)); // Make sure that each dependency is satisfied. - $first_dependency_satisfied = array_search('update_test_2_update_8000', $update_order) < array_search('update_test_3_update_8000', $update_order); + $first_dependency_satisfied = array_search('update_test_2_update_8001', $update_order) < array_search('update_test_3_update_8001', $update_order); $this->assertTrue($first_dependency_satisfied, 'The dependency of the second module on the first module is respected by the update function order.'); - $second_dependency_satisfied = array_search('update_test_3_update_8000', $update_order) < array_search('update_test_2_update_8001', $update_order); + $second_dependency_satisfied = array_search('update_test_3_update_8001', $update_order) < array_search('update_test_2_update_8002', $update_order); $this->assertTrue($second_dependency_satisfied, 'The dependency of the first module on the second module is respected by the update function order.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php index d581147..b09b30b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php @@ -99,7 +99,7 @@ function testRequirements() { $this->assertNoText('This is a requirements warning provided by the update_script_test module.'); $this->drupalPostForm(NULL, array(), t('Continue')); $this->drupalPostForm(NULL, array(), 'Apply pending updates'); - $this->assertText(t('The update_script_test_update_8000() update was executed successfully.'), 'End of update process was reached.'); + $this->assertText(t('The update_script_test_update_8001() update was executed successfully.'), 'End of update process was reached.'); // Confirm that all caches were cleared. $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.'); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index cabea75..c5ee902 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -2192,22 +2192,24 @@ function hook_install() { * The numbers are composed of three parts: * - 1 digit for Drupal core compatibility. * - 1 digit for your module's major release version (e.g., is this the 8.x-1.* - * (1) or 8.x-2.* (2) series of your module?). This digit should be 0 for - * initial porting of your module to a new Drupal core API. - * - 2 digits for sequential counting, starting with 00. + * (1) or 8.x-2.* (2) series of your module). + * - 2 digits for sequential counting, starting with 01. * * Examples: - * - mymodule_update_8000(): This is the required update for mymodule to run - * with Drupal core API 8.x when upgrading from Drupal core API 7.x. * - mymodule_update_8100(): This is the first update to get the database ready * to run mymodule 8.x-1.*. * - mymodule_update_8200(): This is the first update to get the database ready - * to run mymodule 8.x-2.*. Users can directly update from 7.x-2.* to 8.x-2.* - * and they get all 80xx and 82xx updates, but not 81xx updates, because - * those reside in the 8.x-1.x branch only. + * to run mymodule 8.x-2.*. + * + * As of Drupal 8.0, the database upgrade system no longer supports updating a + * database from an earlier major version of Drupal: update.php can be used to + * upgrade from 7.x-1.x to 7.x-2.x, or 8.x-1.x to 8.x-2.x, but not from 7.x to + * 8.x. Therefore, only update hooks numbered 8001 or later will run for + * Drupal 8. 8000 is reserved for the minimum core schema version and defining + * mymodule_update_8000() will result in an exception. Use the + * @link https://drupal.org/node/2127611 Migration API @endlink instead to + * migrate data from an earlier major version of Drupal. * - * A good rule of thumb is to remove updates older than two major releases of - * Drupal. See hook_update_last_removed() to notify Drupal about the removals. * For further information about releases and release numbers see: * @link http://drupal.org/node/711070 Maintaining a drupal.org project with Git @endlink * @@ -2332,21 +2334,21 @@ function hook_update_N(&$sandbox) { * @see hook_update_N() */ function hook_update_dependencies() { - // Indicate that the mymodule_update_8000() function provided by this module - // must run after the another_module_update_8002() function provided by the + // Indicate that the mymodule_update_8001() function provided by this module + // must run after the another_module_update_8003() function provided by the // 'another_module' module. - $dependencies['mymodule'][8000] = array( - 'another_module' => 8002, + $dependencies['mymodule'][8001] = array( + 'another_module' => 8003, ); - // Indicate that the mymodule_update_8001() function provided by this module - // must run before the yet_another_module_update_8004() function provided by + // Indicate that the mymodule_update_8002() function provided by this module + // must run before the yet_another_module_update_8005() function provided by // the 'yet_another_module' module. (Note that declaring dependencies in this // direction should be done only in rare situations, since it can lead to the // following problem: If a site has already run the yet_another_module // module's database updates before it updates its codebase to pick up the // newest mymodule code, then the dependency declared here will be ignored.) - $dependencies['yet_another_module'][8004] = array( - 'mymodule' => 8001, + $dependencies['yet_another_module'][8005] = array( + 'mymodule' => 8002, ); return $dependencies; } @@ -2368,9 +2370,9 @@ function hook_update_dependencies() { * @see hook_update_N() */ function hook_update_last_removed() { - // We've removed the 5.x-1.x version of mymodule, including database updates. - // The next update function is mymodule_update_5200(). - return 5103; + // We've removed the 8.x-1.x version of mymodule, including database updates. + // The next update function is mymodule_update_8200(). + return 8103; } /** diff --git a/core/modules/system/tests/modules/update_script_test/update_script_test.install b/core/modules/system/tests/modules/update_script_test/update_script_test.install index 594dfa3..d09f5a9 100644 --- a/core/modules/system/tests/modules/update_script_test/update_script_test.install +++ b/core/modules/system/tests/modules/update_script_test/update_script_test.install @@ -40,6 +40,6 @@ function update_script_test_requirements($phase) { /** * Dummy update function to run during the tests. */ -function update_script_test_update_8000() { - return t('The update_script_test_update_8000() update was executed successfully.'); +function update_script_test_update_8001() { + return t('The update_script_test_update_8001() update was executed successfully.'); } diff --git a/core/modules/system/tests/modules/update_test_1/update_test_1.install b/core/modules/system/tests/modules/update_test_1/update_test_1.install index bfb7170..e4394ed 100644 --- a/core/modules/system/tests/modules/update_test_1/update_test_1.install +++ b/core/modules/system/tests/modules/update_test_1/update_test_1.install @@ -18,30 +18,24 @@ function update_test_1_update_dependencies() { // the correct array structure. Therefore, we use updates from System module // (which have already run), so that they will not get in the way of other // tests. - $dependencies['system'][8000] = array( + $dependencies['system'][8001] = array( // Compare to update_test_2_update_dependencies(), where the same System // module update function is forced to depend on an update function from a // different module. This allows us to test that both dependencies are // correctly recorded. - 'update_test_1' => 8000, + 'update_test_1' => 8001, ); - $dependencies['system'][8001] = array( + $dependencies['system'][8002] = array( // Compare to update_test_2_update_dependencies(), where the same System // module update function is forced to depend on a different update // function within the same module. This allows us to test that only the // dependency on the higher-numbered update function is recorded. - 'update_test_1' => 8002, + 'update_test_1' => 8003, ); return $dependencies; } /** - * Dummy update_test_1 update 8000. - */ -function update_test_1_update_8000() { -} - -/** * Dummy update_test_1 update 8001. */ function update_test_1_update_8001() { @@ -52,3 +46,9 @@ function update_test_1_update_8001() { */ function update_test_1_update_8002() { } + +/** + * Dummy update_test_1 update 8003. + */ +function update_test_1_update_8003() { +} diff --git a/core/modules/system/tests/modules/update_test_2/update_test_2.install b/core/modules/system/tests/modules/update_test_2/update_test_2.install index c73271a..d262911 100644 --- a/core/modules/system/tests/modules/update_test_2/update_test_2.install +++ b/core/modules/system/tests/modules/update_test_2/update_test_2.install @@ -14,33 +14,27 @@ function update_test_2_update_dependencies() { // Combined with update_test_3_update_dependencies(), we are declaring here // that these two modules run updates in the following order: - // 1. update_test_2_update_8000() - // 2. update_test_3_update_8000() - // 3. update_test_2_update_8001() - // 4. update_test_2_update_8002() - $dependencies['update_test_2'][8001] = array( - 'update_test_3' => 8000, + // 1. update_test_2_update_8001() + // 2. update_test_3_update_8001() + // 3. update_test_2_update_8002() + // 4. update_test_2_update_8003() + $dependencies['update_test_2'][8002] = array( + 'update_test_3' => 8001, ); // These are coordinated with the corresponding dependencies declared in // update_test_1_update_dependencies(). - $dependencies['system'][8000] = array( - 'update_test_2' => 8001, - ); $dependencies['system'][8001] = array( - 'update_test_1' => 8001, + 'update_test_2' => 8002, + ); + $dependencies['system'][8002] = array( + 'update_test_1' => 8002, ); return $dependencies; } /** - * Dummy update_test_2 update 8000. - */ -function update_test_2_update_8000() { -} - -/** * Dummy update_test_2 update 8001. */ function update_test_2_update_8001() { @@ -51,3 +45,9 @@ function update_test_2_update_8001() { */ function update_test_2_update_8002() { } + +/** + * Dummy update_test_2 update 8003. + */ +function update_test_2_update_8003() { +} diff --git a/core/modules/system/tests/modules/update_test_3/update_test_3.install b/core/modules/system/tests/modules/update_test_3/update_test_3.install index 96830c8..ae2da4b 100644 --- a/core/modules/system/tests/modules/update_test_3/update_test_3.install +++ b/core/modules/system/tests/modules/update_test_3/update_test_3.install @@ -11,14 +11,14 @@ * @see update_test_2_update_dependencies() */ function update_test_3_update_dependencies() { - $dependencies['update_test_3'][8000] = array( - 'update_test_2' => 8000, + $dependencies['update_test_3'][8001] = array( + 'update_test_2' => 8001, ); return $dependencies; } /** - * Dummy update_test_3 update 8000. + * Dummy update_test_3 update 8001. */ -function update_test_3_update_8000() { +function update_test_3_update_8001() { } diff --git a/core/update.php b/core/update.php index 527a703..a254c17 100644 --- a/core/update.php +++ b/core/update.php @@ -391,10 +391,6 @@ function update_check_requirements($skip_warnings = FALSE) { install_goto('core/update.php?op=info'); } -// Allow update_fix_d8_requirements() to run before code that can break on a -// Drupal 7 database. -drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); -update_fix_d8_requirements(); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_maintenance_theme();