diff --git a/core/includes/module.inc b/core/includes/module.inc index d674866..17f087c 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -8,7 +8,7 @@ use Drupal\Component\Graph\Graph; /** - * Loads all the modules that have been enabled in the system table. + * Loads all enabled modules. * * @param bool $bootstrap * Whether to load only the reduced set of modules loaded in "bootstrap mode" @@ -387,7 +387,7 @@ function module_load_include($type, $module, $name = NULL) { } /** - * Loads an include file for each module enabled in the {system} table. + * Loads an include file for each enabled module. */ function module_load_all_includes($type, $name = NULL) { $modules = module_list(); diff --git a/core/includes/schema.inc b/core/includes/schema.inc index bff33d3..f46739c 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -166,7 +166,7 @@ function drupal_get_schema_versions($module) { * @param string $module * A module name. * @param bool $reset - * Set to TRUE after modifying the system table. + * Set to TRUE after installing or uninstalling an extension. * @param bool $array * Set to TRUE if you want to get information about all modules in the * system. diff --git a/core/includes/update.inc b/core/includes/update.inc index 99dd714..1dc1548 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -18,7 +18,7 @@ * 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 in the system table. + * we check the schema version of system.module. */ const REQUIRED_D7_SCHEMA_VERSION = '7069'; @@ -217,6 +217,8 @@ function update_prepare_d8_bootstrap() { // requirements check. require_once DRUPAL_ROOT . '/core/modules/system/system.module'; + // 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', @@ -224,7 +226,8 @@ function update_prepare_d8_bootstrap() { )); $module_data = _system_rebuild_module_data(); - // Loop through each extension from the system table. + // Migrate each extension into configuration, varying by the extension's + // status, and record its schema version. foreach ($result as $record) { if ($record->type == 'module') { if ($record->status && isset($module_data[$record->name])) { @@ -233,7 +236,6 @@ function update_prepare_d8_bootstrap() { else { $disabled_modules->set($record->name, $record->weight); } - $schema_store->set($record->name, $record->schema_version); } elseif ($record->type == 'theme') { if ($record->status) { @@ -243,6 +245,7 @@ function update_prepare_d8_bootstrap() { $disabled_themes->set($record->name, 0); } } + $schema_store->set($record->name, $record->schema_version); } $module_config->set('enabled', module_config_sort($module_config->get('enabled')))->save(); $disabled_modules->save(); diff --git a/core/lib/Drupal/Core/Updater/Theme.php b/core/lib/Drupal/Core/Updater/Theme.php index 16bb515..4bd716a 100644 --- a/core/lib/Drupal/Core/Updater/Theme.php +++ b/core/lib/Drupal/Core/Updater/Theme.php @@ -72,7 +72,7 @@ public static function canUpdate($project_name) { * Overrides Drupal\Core\Updater\Updater::postInstall(). */ public function postInstall() { - // Update the system table. + // Update the theme info. clearstatcache(); system_rebuild_theme_data(); } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php index 112fee8..1d2ec67 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php @@ -47,11 +47,12 @@ function testLocaleCompare() { // modules not hidden. locale_test_system_info_alter() modifies the project // info of the locale_test and locale_test_disabled modules. variable_set('locale_translation_test_system_info_alter', TRUE); - // Reset system lists to reflect changes. + + // Reset static system list caches to reflect info changes. + drupal_static_reset('locale_translation_project_list'); system_list_reset(); // Check if interface translation data is collected from hook_info. - drupal_static_reset('locale_translation_project_list'); $projects = locale_translation_project_list(); $this->assertEqual($projects['locale_test']['info']['interface translation server pattern'], 'core/modules/locale/test/modules/locale_test/%project-%version.%language.po', 'Interface translation parameter found in project info.'); $this->assertEqual($projects['locale_test']['name'] , 'locale_test', format_string('%key found in project info.', array('%key' => 'interface translation project'))); diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/RangeQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/RangeQueryTest.php index f85750b..60db2b3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Database/RangeQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Database/RangeQueryTest.php @@ -7,12 +7,10 @@ namespace Drupal\system\Tests\Database; -use Drupal\simpletest\WebTestBase; - /** * Range query tests. */ -class RangeQueryTest extends WebTestBase { +class RangeQueryTest extends DatabaseTestBase { /** * Modules to enable. @@ -34,12 +32,12 @@ public static function getInfo() { */ function testRangeQuery() { // Test if return correct number of rows. - $range_rows = db_query_range("SELECT name FROM {variable} ORDER BY name", 2, 3)->fetchAll(); + $range_rows = db_query_range("SELECT name FROM {test} ORDER BY name", 1, 3)->fetchAll(); $this->assertEqual(count($range_rows), 3, 'Range query work and return correct number of rows.'); // Test if return target data. - $raw_rows = db_query('SELECT name FROM {variable} ORDER BY name')->fetchAll(); - $raw_rows = array_slice($raw_rows, 2, 3); - $this->assertEqual($range_rows, $raw_rows, 'Range query work and return target data.'); + $raw_rows = db_query('SELECT name FROM {test} ORDER BY name')->fetchAll(); + $raw_rows = array_slice($raw_rows, 1, 3); + $this->assertEqual($range_rows, $raw_rows); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php index 110f5a8..7c2d0d0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php @@ -7,12 +7,10 @@ namespace Drupal\system\Tests\Database; -use Drupal\simpletest\WebTestBase; - /** * Temporary query tests. */ -class TemporaryQueryTest extends WebTestBase { +class TemporaryQueryTest extends DatabaseTestBase { /** * Modules to enable. @@ -43,7 +41,7 @@ function testTemporaryQuery() { $this->drupalGet('database_test/db_query_temporary'); $data = json_decode($this->drupalGetContent()); if ($data) { - $this->assertEqual($this->countTableRows("filter"), $data->row_count, 'The temporary table contains the correct amount of rows.'); + $this->assertEqual($this->countTableRows('test'), $data->row_count, 'The temporary table contains the correct amount of rows.'); $this->assertFalse(db_table_exists($data->table_name), 'The temporary table is, indeed, temporary.'); } else { @@ -51,10 +49,10 @@ function testTemporaryQuery() { } // Now try to run two db_query_temporary() in the same request. - $table_name_system = db_query_temporary('SELECT name FROM {variable}', array()); - $table_name_users = db_query_temporary('SELECT uid FROM {users}', array()); + $table_name_test = db_query_temporary('SELECT name FROM {test}', array()); + $table_name_task = db_query_temporary('SELECT pid FROM {test_task}', array()); - $this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("variable"), 'A temporary table was created successfully in this request.'); - $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), 'A second temporary table was created successfully in this request.'); + $this->assertEqual($this->countTableRows($table_name_test), $this->countTableRows('test'), 'A temporary table was created successfully in this request.'); + $this->assertEqual($this->countTableRows($table_name_task), $this->countTableRows('test_task'), 'A second temporary table was created successfully in this request.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php index 603af18..8d004ab 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php @@ -22,20 +22,21 @@ public static function getInfo() { } /** - * Tests that {system}.info is rebuilt after a module that implements + * Tests that theme .info data is rebuild after enabling a module. + * + * Tests that info data is rebuilt after a module that implements * hook_system_info_alter() is enabled. Also tests if core *_list() functions * return freshly altered info. */ function testSystemInfoAlter() { - // Enable seven and the test module. Flush all caches, which we assert is - // the only thing necessary to use the rebuilt {system}.info. + // Enable seven and the test module. theme_enable(array('seven')); module_enable(array('module_test'), FALSE); - $this->resetAll(); $this->assertTrue(module_exists('module_test'), t('Test module is enabled.')); + // Verify that the rebuilt and altered theme info is returned. $info = system_get_info('theme', 'seven'); - $this->assertTrue(isset($info['regions']['test_region']), t('Altered theme info was added to {system}.info.')); + $this->assertTrue(isset($info['regions']['test_region']), t('Altered theme info was returned by system_get_info().')); $seven_regions = system_region_list('seven'); $this->assertTrue(isset($seven_regions['test_region']), t('Altered theme info was returned by system_region_list().')); $system_list_themes = system_list('theme'); @@ -44,13 +45,12 @@ function testSystemInfoAlter() { $list_themes = list_themes(); $this->assertTrue(isset($list_themes['seven']->info['regions']['test_region']), t('Altered theme info was returned by list_themes().')); - // Disable the module and verify that {system}.info is rebuilt without it. + // Disable the module and verify that rebuilt .info does not contain it. module_disable(array('module_test'), FALSE); - $this->resetAll(); $this->assertFalse(module_exists('module_test'), t('Test module is disabled.')); $info = system_get_info('theme', 'seven'); - $this->assertFalse(isset($info['regions']['test_region']), t('Altered theme info was removed from {system}.info.')); + $this->assertFalse(isset($info['regions']['test_region']), t('Altered theme info was not returned by system_get_info().')); $seven_regions = system_region_list('seven'); $this->assertFalse(isset($seven_regions['test_region']), t('Altered theme info was not returned by system_region_list().')); $system_list_themes = system_list('theme'); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index dd263cd..0f6d668 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -2167,10 +2167,7 @@ function hook_cache_flush() { * @see drupal_flush_all_caches() */ function hook_rebuild() { - // Rehash blocks for active themes. We don't use list_themes() here, - // because if MAINTENANCE_MODE is defined it skips reading the database, - // and we can't tell which themes are active. - $themes = db_query("SELECT name FROM {system} WHERE type = 'theme' AND status = 1"); + $themes = list_themes(); foreach ($themes as $theme) { _block_rehash($theme->name); } @@ -2983,8 +2980,8 @@ function hook_update_last_removed() { * - variables that the module has set using variable_set() or system_settings_form() * - modifications to existing tables * - * The module should not remove its entry from the {system} table. Database - * tables defined by hook_schema() will be removed automatically. + * The module should not remove its entry from the module configuration. + * Database tables defined by hook_schema() will be removed automatically. * * The uninstall hook must be implemented in the module's .install file. It * will fire when the module gets uninstalled but before the module's database diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 7b34f3f..cc8fc9c 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2655,8 +2655,8 @@ function system_check_directory($form_element) { /** * Returns an array of information about enabled modules or themes. * - * This function returns the information from the {system} table corresponding - * to the cached contents of the .info file for each active module or theme. + * This function returns the contents of the .info file for each enabled module + * or theme. * * @param $type * Either 'module' or 'theme'. @@ -2841,7 +2841,7 @@ function system_rebuild_module_data() { } /** - * Refresh bootstrap column in the system table. + * Refreshes the list of bootstrap modules. * * This is called internally by module_enable/disable() to flag modules that * implement hooks used during bootstrap, such as hook_boot(). These modules diff --git a/core/modules/system/tests/modules/database_test/database_test.module b/core/modules/system/tests/modules/database_test/database_test.module index 93135c9..339f1f9 100644 --- a/core/modules/system/tests/modules/database_test/database_test.module +++ b/core/modules/system/tests/modules/database_test/database_test.module @@ -84,7 +84,7 @@ function database_test_menu() { * table should automatically dropped. */ function database_test_db_query_temporary() { - $table_name = db_query_temporary('SELECT status FROM {filter}', array()); + $table_name = db_query_temporary('SELECT age FROM {test}', array()); return new JsonResponse(array( 'table_name' => $table_name, 'row_count' => db_select($table_name)->countQuery()->execute()->fetchField(), diff --git a/core/modules/update/update.authorize.inc b/core/modules/update/update.authorize.inc index d22f235..4557453 100644 --- a/core/modules/update/update.authorize.inc +++ b/core/modules/update/update.authorize.inc @@ -66,7 +66,8 @@ function update_authorize_run_update($filetransfer, $projects) { * The FileTransfer object created by authorize.php for use during this * operation. * @param string $project - * The canonical project short name (e.g., {system}.name). + * The canonical project short name; i.e., the name of the module, theme, or + * profile. * @param string $updater_name * The name of the Drupal\Core\Updater\Updater class to use for installing * this project.