diff --git a/core/authorize.php b/core/authorize.php index ecb7e22a4347f42a793eeb338d8e318c1fb30822..fd9e2f4fa7e08ce15b8698774d53a5fff45f233f 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -69,15 +69,9 @@ function authorize_access_allowed() { require_once __DIR__ . '/includes/module.inc'; require_once __DIR__ . '/includes/ajax.inc'; -// We prepare only a minimal bootstrap. This includes the database and -// variables, however, so we have access to the class autoloader. -drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); - -$request = Request::createFromGlobals(); -\Drupal::getContainer()->set('request', $request); - -// This must go after drupal_bootstrap(), which unsets globals! -global $conf; +// Prepare a minimal bootstrap. +drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); +$request = \Drupal::request(); // We have to enable the user and system modules, even to check access and // display errors via the maintenance theme. diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 8bbdd915bd5b8c21f940454da6b19a5b04d2694c..ac76982b9a6de2d5adfc6ba70d855176ac45f54c 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -139,19 +139,14 @@ const DRUPAL_BOOTSTRAP_PAGE_CACHE = 2; /** - * Fourth bootstrap phase: initialize the variable system. + * Fourth bootstrap phase: load code for subsystems and modules. */ -const DRUPAL_BOOTSTRAP_VARIABLES = 3; - -/** - * Fifth bootstrap phase: load code for subsystems and modules. - */ -const DRUPAL_BOOTSTRAP_CODE = 4; +const DRUPAL_BOOTSTRAP_CODE = 3; /** * Final bootstrap phase: initialize language, path, theme, and modules. */ -const DRUPAL_BOOTSTRAP_FULL = 5; +const DRUPAL_BOOTSTRAP_FULL = 4; /** * Role ID for anonymous users; should match what's in the "role" table. @@ -791,124 +786,6 @@ function settings() { return Settings::getSingleton(); } -/** - * Loads the persistent variable table. - * - * The variable table is composed of values that have been saved in the table - * with variable_set() as well as those explicitly specified in the - * configuration file. - */ -function variable_initialize($conf = array()) { - // NOTE: caching the variables improves performance by 20% when serving - // cached pages. - if ($cached = cache('bootstrap')->get('variables')) { - $variables = $cached->data; - } - else { - // Cache miss. Avoid a stampede. - $name = 'variable_init'; - $lock = \Drupal::lock(); - if (!$lock->acquire($name, 1)) { - // Another request is building the variable cache. - // Wait, then re-run this function. - $lock->wait($name); - return variable_initialize($conf); - } - else { - // Proceed with variable rebuild. - $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed()); - cache('bootstrap')->set('variables', $variables); - $lock->release($name); - } - } - - foreach ($conf as $name => $value) { - $variables[$name] = $value; - } - - return $variables; -} - -/** - * Returns a persistent variable. - * - * Case-sensitivity of the variable_* functions depends on the database - * collation used. To avoid problems, always use lower case for persistent - * variable names. - * - * @param $name - * The name of the variable to return. - * @param $default - * The default value to use if this variable has never been set. - * - * @return - * The value of the variable. Unserialization is taken care of as necessary. - * - * @deprecated This will be removed in Drupal 8.0. Instead, use the - * configuration API. - * - * @see \Drupal\Core\Config::get() - */ -function variable_get($name, $default = NULL) { - global $conf; - - return isset($conf[$name]) ? $conf[$name] : $default; -} - -/** - * Sets a persistent variable. - * - * Case-sensitivity of the variable_* functions depends on the database - * collation used. To avoid problems, always use lower case for persistent - * variable names. - * - * @param $name - * The name of the variable to set. - * @param $value - * The value to set. This can be any PHP data type; these functions take care - * of serialization as necessary. - * - * @deprecated This will be removed in Drupal 8.0. Instead, use the - * configuration API. - * - * @see \Drupal\Core\Config::set() - */ -function variable_set($name, $value) { - global $conf; - - db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); - - cache('bootstrap')->delete('variables'); - - $conf[$name] = $value; -} - -/** - * Unsets a persistent variable. - * - * Case-sensitivity of the variable_* functions depends on the database - * collation used. To avoid problems, always use lower case for persistent - * variable names. - * - * @param $name - * The name of the variable to undefine. - * - * @deprecated This will be removed in Drupal 8.0. Instead, use the - * configuration API. - * - * @see \Drupal\Core\Config::clear() - */ -function variable_del($name) { - global $conf; - - db_delete('variable') - ->condition('name', $name) - ->execute(); - cache('bootstrap')->delete('variables'); - - unset($conf[$name]); -} - /** * Gets the page cache cid for this request. * @@ -1719,24 +1596,19 @@ function drupal_anonymous_user() { * - DRUPAL_BOOTSTRAP_CONFIGURATION: Initializes configuration. * - DRUPAL_BOOTSTRAP_KERNEL: Initalizes a kernel. * - DRUPAL_BOOTSTRAP_PAGE_CACHE: Tries to serve a cached page. - * - DRUPAL_BOOTSTRAP_VARIABLES: Initializes the variable system. * - DRUPAL_BOOTSTRAP_CODE: Loads code for subsystems and modules. * - DRUPAL_BOOTSTRAP_FULL: Fully loads Drupal. Validates and fixes input * data. - * @param $new_phase - * A boolean, set to FALSE if calling drupal_bootstrap from inside a - * function called from drupal_bootstrap (recursion). * * @return * The most recently completed phase. */ -function drupal_bootstrap($phase = NULL, $new_phase = TRUE) { +function drupal_bootstrap($phase = NULL) { // Not drupal_static(), because does not depend on any run-time information. static $phases = array( DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_KERNEL, DRUPAL_BOOTSTRAP_PAGE_CACHE, - DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_CODE, DRUPAL_BOOTSTRAP_FULL, ); @@ -1747,10 +1619,10 @@ function drupal_bootstrap($phase = NULL, $new_phase = TRUE) { // bootstrap state. static $stored_phase = -1; - // When not recursing, store the phase name so it's not forgotten during - // recursion. Additionally, ensure that $final_phase is never rolled back to an - // earlier bootstrap state. - if ($new_phase && $phase > $final_phase) { + // Store the phase name so it's not forgotten during recursion. Additionally, + // ensure that $final_phase is never rolled back to an earlier bootstrap + // state. + if ($phase > $final_phase) { $final_phase = $phase; } if (isset($phase)) { @@ -1778,10 +1650,6 @@ function drupal_bootstrap($phase = NULL, $new_phase = TRUE) { _drupal_bootstrap_page_cache(); break; - case DRUPAL_BOOTSTRAP_VARIABLES: - _drupal_bootstrap_variables(); - break; - case DRUPAL_BOOTSTRAP_CODE: require_once __DIR__ . '/common.inc'; _drupal_bootstrap_code(); @@ -1986,7 +1854,6 @@ function _drupal_bootstrap_page_cache() { $cache_enabled = TRUE; } else { - drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); $config = \Drupal::config('system.performance'); $cache_enabled = $config->get('cache.page.use_internal'); } @@ -2054,16 +1921,6 @@ function _drupal_initialize_db_test_prefix() { } } -/** - * Loads system variables and all enabled bootstrap modules. - */ -function _drupal_bootstrap_variables() { - global $conf; - - // Load variables from the database, but do not overwrite variables set in settings.php. - $conf = variable_initialize(isset($conf) ? $conf : array()); -} - /** * Returns the current bootstrap phase for this Drupal process. * @@ -2200,8 +2057,9 @@ function drupal_valid_test_ua($new_prefix = NULL) { list(, $prefix, $time, $salt, $hmac) = $matches; $check_string = $prefix . ';' . $time . ';' . $salt; // We use the salt from settings.php to make the HMAC key, since - // the database is not yet initialized and we can't access any Drupal variables. - // The file properties add more entropy not easily accessible to others. + // the database is not yet initialized and we can't access the configuration + // system. The file properties add more entropy not easily accessible to + // others. $key = drupal_get_hash_salt() . filectime(__FILE__) . fileinode(__FILE__); $time_diff = REQUEST_TIME - $time; // We can't use Crypt::hmacBase64() yet because this can be called in very @@ -2266,8 +2124,9 @@ function drupal_generate_test_ua($prefix) { if (!isset($key)) { // We use the salt from settings.php to make the HMAC key, since - // the database is not yet initialized and we can't access any Drupal variables. - // The file properties add more entropy not easily accessible to others. + // the database is not yet initialized and we can't access the configuration + // system. The file properties add more entropy not easily accessible to + // others. $key = drupal_get_hash_salt() . filectime(__FILE__) . fileinode(__FILE__); } // Generate a moderately secure HMAC based on the database credentials. diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 24d3269407c5f7365fec742e6a4bc5260c8cf05e..cc2fb5b041ec4c189a6c01117734267b4c0c9e08 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1227,7 +1227,7 @@ function install_database_errors($database, $settings_file) { * @see install_settings_form_validate() */ function install_settings_form_submit($form, &$form_state) { - global $install_state, $conf; + global $install_state; // Update global settings array and save. $settings = array(); diff --git a/core/includes/menu.inc b/core/includes/menu.inc index d54fe068cf1ae4514f18de8ca92adb5208716a77..bdffb10b612f23240c10a74f448c8b0caf951172 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2217,11 +2217,9 @@ function theme_menu_local_tasks(&$variables) { * * @return * An array of menu machine names, in order of preference. The - * 'system.menu.active_menus_default' config item may be used to assert a menu + * 'system.menu:active_menus_default' config item may be used to assert a menu * order different from the order of creation, or to prevent a particular menu * from being used at all in the active trail. - * E.g., $conf['system.menu']['active_menus_default'] = array('tools', - * 'main'). */ function menu_set_active_menu_names($menu_names = NULL) { $active = &drupal_static(__FUNCTION__); diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 96dcd2f90af04c62c55ea67654ab7deeda53916a..8456eeefc4d102342cdddd40cf9c97fc78aab047 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -14,10 +14,10 @@ * It also applies when the database is unavailable or bootstrap was not * complete. Seven is always used for the initial install and update * operations. In other cases, Bartik is used, but this can be overridden by - * setting a "maintenance_theme" key in the $conf variable in settings.php. + * setting a "maintenance_theme" key in the $settings variable in settings.php. */ function _drupal_maintenance_theme() { - global $theme, $theme_key, $conf; + global $theme, $theme_key; // If $theme is already set, assume the others are set too, and do nothing. if (isset($theme)) { diff --git a/core/includes/update.inc b/core/includes/update.inc index fe74fe00bc143e109d815d0d267962c2590c1c98..9383a07273216fbd680e67dfd98ef75a7812b2b7 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -121,6 +121,8 @@ function update_prepare_d8_bootstrap() { // Do not attempt to dump and write it. $kernel = new DrupalKernel('update', drupal_classloader(), FALSE); $kernel->boot(); + $request = Request::createFromGlobals(); + \Drupal::getContainer()->set('request', $request); // If any of the required settings needs to be written, then settings.php // needs to be writable. @@ -317,9 +319,8 @@ function update_prepare_d8_bootstrap() { update_add_cache_columns($table); } - // Bootstrap variables so we can update theme while preparing the update - // process. - drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); + // Bootstrap to cache system. + drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); // Update the 'language_default' system variable, if configured. // Required to run before drupal_install_config_directories(), since that @@ -460,6 +461,7 @@ function update_prepare_d8_bootstrap() { new Settings($settings); $kernel = new DrupalKernel('update', drupal_classloader(), FALSE); $kernel->boot(); + \Drupal::getContainer()->set('request', $request); // Clear the D7 caches, to ensure that for example the theme_registry does not // take part in the upgrade process. diff --git a/core/lib/Drupal/Component/PhpStorage/PhpStorageFactory.php b/core/lib/Drupal/Component/PhpStorage/PhpStorageFactory.php index 82a9b4a7880ea17c9d5c55f47a649f7ccb4abac6..0939799286e3629d4297ecfcf54a643705b9d0a5 100644 --- a/core/lib/Drupal/Component/PhpStorage/PhpStorageFactory.php +++ b/core/lib/Drupal/Component/PhpStorage/PhpStorageFactory.php @@ -34,12 +34,12 @@ class PhpStorageFactory { * An instantiated storage controller for the specified name. */ static function get($name) { - $conf = Settings::getSingleton()->get('php_storage'); - if (isset($conf[$name])) { - $configuration = $conf[$name]; + $overrides = Settings::getSingleton()->get('php_storage'); + if (isset($overrides[$name])) { + $configuration = $overrides[$name]; } - elseif (isset($conf['default'])) { - $configuration = $conf['default']; + elseif (isset($overrides['default'])) { + $configuration = $overrides['default']; } else { $configuration = array( diff --git a/core/lib/Drupal/Core/Mail/PhpMail.php b/core/lib/Drupal/Core/Mail/PhpMail.php index b7f94bb5c70b6b2780d843cbf941723b00125228..7bf290c10775ebb9463d202e639198921c5c2b58 100644 --- a/core/lib/Drupal/Core/Mail/PhpMail.php +++ b/core/lib/Drupal/Core/Mail/PhpMail.php @@ -33,7 +33,7 @@ public function format(array $message) { } /** - * Sends an e-mail message, using Drupal variables and default settings. + * Sends an e-mail message. * * @param array $message * A message array, as described in hook_mail_alter(). diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php deleted file mode 100644 index e95f134690d0c220564141b6070c48b97a686165..0000000000000000000000000000000000000000 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php +++ /dev/null @@ -1,123 +0,0 @@ - 'Variable migration', - 'description' => 'Tests migration of variables into configuration objects.', - 'group' => 'Configuration', - ); - } - - function setUp() { - parent::setUp(); - require_once DRUPAL_ROOT . '/core/includes/update.inc'; - } - - /** - * Tests update_variables_to_config(). - */ - function testConfigurationUpdate() { - // Ensure that the variable table has the object. The variable table will - // remain in place for Drupal 8 to provide an upgrade path for overridden - // variables. - db_insert('variable') - ->fields(array('name', 'value')) - ->values(array('config_upgrade_foo', serialize($this->testContent))) - ->values(array('config_upgrade_bar', serialize($this->testContent))) - ->execute(); - - // Perform migration. - update_variables_to_config('config_upgrade.test', array( - 'config_upgrade_bar' => 'parent.bar', - 'config_upgrade_foo' => 'foo', - // A default configuration value for which no variable exists. - 'config_upgrade_baz' => 'parent.baz', - )); - - // Verify that variables have been converted and default values exist. - $config = \Drupal::config('config_upgrade.test'); - $this->assertIdentical($config->get('foo'), $this->testContent); - $this->assertIdentical($config->get('parent.bar'), $this->testContent); - $this->assertIdentical($config->get('parent.baz'), 'Baz'); - - // Verify that variables have been deleted. - $variables = db_query('SELECT name FROM {variable} WHERE name IN (:names)', array(':names' => array('config_upgrade_bar', 'config_upgrade_foo')))->fetchCol(); - $this->assertFalse($variables); - - // Add another variable to migrate into the same config object. - db_insert('variable') - ->fields(array('name', 'value')) - ->values(array('config_upgrade_additional', serialize($this->testContent))) - ->execute(); - - // Perform migration into the exsting config object. - update_variables_to_config('config_upgrade.test', array( - 'config_upgrade_additional' => 'parent.additional', - )); - - // Verify that new variables have been converted and existing still exist. - $config = \Drupal::config('config_upgrade.test'); - $this->assertIdentical($config->get('foo'), $this->testContent); - $this->assertIdentical($config->get('parent.bar'), $this->testContent); - $this->assertIdentical($config->get('parent.baz'), 'Baz'); - $this->assertIdentical($config->get('parent.additional'), $this->testContent); - - // Verify that variables have been deleted. - $variables = db_query('SELECT name FROM {variable} WHERE name IN (:names)', array(':names' => array('config_upgrade_additional')))->fetchCol(); - $this->assertFalse($variables); - - // Verify that a default module configuration file is required to exist. - try { - update_variables_to_config('config_upgrade.missing.default.config', array()); - $this->fail('Exception was not thrown on missing default module configuration file.'); - } - catch (ConfigException $e) { - $this->pass('Exception was thrown on missing default module configuration file.'); - } - - // For this test it is essential that update_variables_to_config has already - // run on the config object. - \Drupal::config('config_upgrade.test') - ->set('numeric_keys.403', '') - ->set('numeric_keys.404', '') - ->save(); - - db_insert('variable') - ->fields(array('name', 'value')) - ->values(array('config_upgrade_403', serialize('custom403'))) - ->values(array('config_upgrade_404', serialize('custom404'))) - ->execute(); - - // Perform migration. - update_variables_to_config('config_upgrade.test', array( - 'config_upgrade_403' => 'numeric_keys.403', - 'config_upgrade_404' => 'numeric_keys.404', - )); - - $this->assertIdentical(\Drupal::config('config_upgrade.test')->get('numeric_keys'), array(403 => 'custom403', 404 => 'custom404')); - } -} diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php b/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php index ec309f6cf6fde23586d973353c4c6d8d9c731f4c..b575e6be09e03a0a06c7b79998f8b3df09cf0e7b 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php @@ -27,7 +27,6 @@ class EditTestBase extends DrupalUnitTestBase { protected function setUp() { parent::setUp(); - $this->installSchema('system', 'variable'); $this->installSchema('entity_test', array('entity_test', 'entity_test_rev')); $this->installConfig(array('field', 'filter')); } diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php index 28dc5ebe3e1aee662081a1bad07a5ceaebd281fe..7c0dc5cab5ad4ed20618f045c51758247bd193f9 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php @@ -264,7 +264,6 @@ public function testBaseFieldComponent() { */ public function testRenameDeleteBundle() { $this->enableModules(array('field_test', 'node', 'system', 'text')); - $this->installSchema('system', array('variable')); $this->installSchema('node', array('node')); // Create a node bundle, display and form display object. diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php index 4119240b8fe61c2f2c82f99fa53b6fee1220ff54..f035f371e59b63866e455fc55b151c9837a66559 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceFieldTest.php @@ -75,7 +75,6 @@ public static function getInfo() { public function setUp() { parent::setUp(); - $this->installSchema('system', 'variable'); $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision')); // Setup a field and instance. diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php index f90d5f13d3ec114e46d580641198769f95ca7029..4f83cc5f22564dd2864d5be485367dc3b6ebdfaa 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php @@ -36,7 +36,7 @@ abstract class FieldUnitTestBase extends DrupalUnitTestBase { function setUp() { parent::setUp(); $this->installSchema('entity_test', 'entity_test'); - $this->installSchema('system', array('sequences', 'variable', 'config_snapshot')); + $this->installSchema('system', array('sequences', 'config_snapshot')); $this->installSchema('user', array('users', 'users_roles')); // Set default storage backend and configure the theme system. diff --git a/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php b/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php index 596eb5cd3772489e919cc0871cf4b1c5229b9582..3b2372cc3d139baecbf04d85c8eba0b42eb12ef3 100644 --- a/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php +++ b/core/modules/hal/lib/Drupal/hal/Tests/NormalizerTestBase.php @@ -58,7 +58,7 @@ abstract class NormalizerTestBase extends DrupalUnitTestBase { */ function setUp() { parent::setUp(); - $this->installSchema('system', array('variable', 'url_alias', 'router')); + $this->installSchema('system', array('url_alias', 'router')); $this->installSchema('user', array('users')); $this->installSchema('entity_test', array('entity_test')); $this->installConfig(array('field', 'language')); diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageTestBase.php b/core/modules/language/lib/Drupal/language/Tests/LanguageTestBase.php index a1780b78c7c820b3460c18ceb0500525fdf9c265..3fd2907198274a046ab22e03f0b170587267898e 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageTestBase.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageTestBase.php @@ -35,7 +35,6 @@ abstract class LanguageTestBase extends DrupalUnitTestBase { protected function setUp() { parent::setUp(); - $this->installSchema('system', array('variable')); $this->installConfig(array('language')); $this->state = $this->container->get('state'); diff --git a/core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php b/core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php index 3a8feed83b2b5f34e867afa7564e8feef7dfbfd7..7c53a1cf31e4bec1bff7c309b85722fb2a72d8ce 100644 --- a/core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php +++ b/core/modules/language/lib/Drupal/language/Tests/Views/LanguageTestBase.php @@ -24,7 +24,6 @@ abstract class LanguageTestBase extends ViewUnitTestBase { protected function setUp() { parent::setUp(); - $this->installSchema('system', 'variable'); $this->installConfig(array('language')); // Create English and another language beside English. diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index 8111e17e895082ece502cc11c741d50559f1fc3a..92b161fe44a15582f2d9c62d157dbdc33661f25f 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -182,7 +182,6 @@ protected function tearDown() { * @see \DrupalUnitTestBase::disableModules() */ public function containerBuild(ContainerBuilder $container) { - global $conf; // Keep the container object around for tests. $this->container = $container; diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index ec40407a3753de2bd5cc1b8a03b81983712ce19a..b284941d118fcc32d3086af6bbad863affda0b94 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -957,31 +957,28 @@ protected function resetAll() { drupal_flush_all_caches(); $this->container = \Drupal::getContainer(); - // Reload global $conf array and permissions. + // Reset static variables and reload permissions. $this->refreshVariables(); $this->checkPermissions(array(), TRUE); } /** - * Refreshes the in-memory set of variables. + * Refreshes in-memory configuration and state information. * - * Useful after a page request is made that changes a variable in a different - * thread. + * Useful after a page request is made that changes configuration or state in + * a different thread. * * In other words calling a settings page with $this->drupalPostForm() with a - * changed value would update a variable to reflect that change, but in the - * thread that made the call (thread running the test) the changed variable + * changed value would update configuration to reflect that change, but in the + * thread that made the call (thread running the test) the changed values * would not be picked up. * - * This method clears the variables cache and loads a fresh copy from the - * database to ensure that the most up-to-date set of variables is loaded. + * This method clears the cache and loads a fresh copy. */ protected function refreshVariables() { - global $conf; - cache('bootstrap')->delete('variables'); - $conf = variable_initialize(); // Clear the tag cache. drupal_static_reset('Drupal\Core\Cache\CacheBackendInterface::tagCache'); + \Drupal::service('config.factory')->reset(); \Drupal::state()->resetCache(); } diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php index ed132e89dd90f02698580048d5629b0c281df715..59675f1cefc5a334ee032eebc7e403a7c7ddf597 100644 --- a/core/modules/statistics/statistics.php +++ b/core/modules/statistics/statistics.php @@ -11,7 +11,7 @@ // Load the Drupal bootstrap. require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php'; require_once dirname(dirname(__DIR__)) . '/includes/bootstrap.inc'; -drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); +drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); if (\Drupal::config('statistics.settings')->get('count_content_views')) { $nid = filter_input(INPUT_POST, 'nid', FILTER_VALIDATE_INT); diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/VariableTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/VariableTest.php deleted file mode 100644 index 9729ea39df3bd8e07c6c0373ed3c5de96f775f9b..0000000000000000000000000000000000000000 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/VariableTest.php +++ /dev/null @@ -1,63 +0,0 @@ - 'Variable test', - 'description' => 'Make sure the variable system functions correctly.', - 'group' => 'Bootstrap' - ); - } - - /** - * Tests variables then deletes them. - */ - function testVariable() { - // Setting and retrieving values. - $variable = $this->randomName(); - variable_set('simpletest_bootstrap_variable_test', $variable); - $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), 'Setting and retrieving values'); - - // Make sure the variable persists across multiple requests. - $this->drupalGet('system-test/variable-get'); - $this->assertText($variable, 'Variable persists across multiple requests'); - - // Deleting variables. - $default_value = $this->randomName(); - variable_del('simpletest_bootstrap_variable_test'); - $variable = variable_get('simpletest_bootstrap_variable_test', $default_value); - $this->assertIdentical($variable, $default_value, 'Deleting variables'); - } - - /** - * Makes sure that the default variable parameter is passed through okay. - */ - function testVariableDefaults() { - // Tests passing nothing through to the default. - $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), 'Variables are correctly defaulting to NULL.'); - - // Tests passing 5 to the default parameter. - $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), 'The default variable parameter is passed through correctly.'); - } - -} diff --git a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php index 2639f3bb9247cbc0c8f41b3a3f6c6c97f335a146..ae61ae5706effc89b41de58858c249c8411f24fe 100644 --- a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php @@ -27,13 +27,12 @@ public static function getInfo() { function setUp() { parent::setUp(); - global $conf; - $conf['php_storage']['service_container']= array( + $this->settingsSet('php_storage', array('service_container' => array( 'bin' => 'service_container', 'class' => 'Drupal\Component\PhpStorage\MTimeProtectedFileStorage', 'directory' => DRUPAL_ROOT . '/' . $this->public_files_directory . '/php', 'secret' => drupal_get_hash_salt(), - ); + ))); // Use a non-persistent cache to avoid queries to non-existing tables. $this->settingsSet('cache', array('default' => 'cache.backend.memory')); } @@ -65,8 +64,9 @@ function testCompileDIC() { // Now use the read-only storage implementation, simulating a "production" // environment. - global $conf; - $conf['php_storage']['service_container']['class'] = 'Drupal\Component\PhpStorage\FileReadOnlyStorage'; + $php_storage = settings()->get('php_storage'); + $php_storage['service_container']['class'] = 'Drupal\Component\PhpStorage\FileReadOnlyStorage'; + $this->settingsSet('php_storage', $php_storage); $kernel = new DrupalKernel('testing', $classloader); $kernel->updateModules($module_enabled); $kernel->boot(); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php index ee1c0d02ffea8954fe2864650f18b02906a23ff8..5f474507e8f48be62febeb2aebe0569a011a191e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityLanguageTestBase.php @@ -50,7 +50,6 @@ function setUp() { $this->languageManager = $this->container->get('language_manager'); - $this->installSchema('system', 'variable'); $this->installSchema('entity_test', array( 'entity_test_mul', 'entity_test_mul_property_data', diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php index f97a44f0d52182dc0d03b4924f049a9332db503a..b33285ce5242880e74eccacf5a6261edac349984 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -58,7 +58,6 @@ public static function getInfo() { function setUp() { parent::setUp(); $this->installSchema('entity_test', array('entity_test_mulrev', 'entity_test_mulrev_revision', 'entity_test_mulrev_property_data', 'entity_test_mulrev_property_revision')); - $this->installSchema('system', array('variable')); $this->installConfig(array('language')); $figures = drupal_strtolower($this->randomName()); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUriTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUriTest.php index 381d8b0bbcfdb667a60471d0cadf73c3b4f806a3..f548360ae688ee3484a4e8afb3341ca5a91357f7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUriTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityUriTest.php @@ -22,7 +22,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); - $this->installSchema('system', array('variable', 'url_alias')); + $this->installSchema('system', array('url_alias')); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageTest.php index a76281a915d95189f8d4106a03796ad31456d879..ad286d62c2800312d9b03b1c0ef0f46cc054f039 100644 --- a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/DatabaseStorageTest.php @@ -35,8 +35,7 @@ protected function setUp() { $this->container ->register('keyvalue.database', 'Drupal\Core\KeyValueStore\KeyValueDatabaseFactory') ->addArgument(new Reference('database')); - global $conf; - $conf['keyvalue_default'] = 'keyvalue.database'; + $this->settingsSet('keyvalue_default', 'keyvalue.database'); } protected function tearDown() { diff --git a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/MemoryStorageTest.php b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/MemoryStorageTest.php index 54471a7781743e088aa05b3392195b2c6c490330..ca065fa036e69a0e415e356a0fbc3bb0428216e6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/MemoryStorageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/KeyValueStore/MemoryStorageTest.php @@ -31,9 +31,6 @@ protected function setUp() { parent::setUp(); $this->container ->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory'); - if (isset($conf['keyvalue_default'])) { - $this->originalKeyValue = $conf['keyvalue_default']; - } $this->settingsSet('keyvalue_default', 'keyvalue.memory'); } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index ac8dd2232fb4bd47a7218ca77b3db53c5e5c37e3..25f75c7934ac18c4dd846cefb0a023e99fccb0c3 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -575,29 +575,6 @@ function system_install() { * Implements hook_schema(). */ function system_schema() { - // NOTE: {variable} needs to be created before all other tables, as - // some database drivers, e.g. Oracle and DB2, will require variable_get() - // and variable_set() for overcoming some database specific limitations. - $schema['variable'] = array( - 'description' => 'Named variable/value pairs created by Drupal core or any other module or theme. All variables are cached in memory at the start of every Drupal request so developers should not be careless about what is stored here.', - 'fields' => array( - 'name' => array( - 'description' => 'The name of the variable.', - 'type' => 'varchar', - 'length' => 128, - 'not null' => TRUE, - 'default' => '', - ), - 'value' => array( - 'description' => 'The value of the variable.', - 'type' => 'blob', - 'not null' => TRUE, - 'size' => 'big', - ), - ), - 'primary key' => array('name'), - ); - $schema['batch'] = array( 'description' => 'Stores details about batches (processes that run in multiple HTTP requests).', 'fields' => array( @@ -994,7 +971,7 @@ function system_schema() { ); $schema['semaphore'] = array( - 'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Drupal variables since they must not be cached.', + 'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as state since they must not be cached.', 'fields' => array( 'name' => array( 'description' => 'Primary Key: Unique name.', diff --git a/core/modules/system/tests/modules/config_upgrade/config/config_upgrade.test.yml b/core/modules/system/tests/modules/config_upgrade/config/config_upgrade.test.yml deleted file mode 100644 index fc448c10d767b217ceda1558e50d942a4783f363..0000000000000000000000000000000000000000 --- a/core/modules/system/tests/modules/config_upgrade/config/config_upgrade.test.yml +++ /dev/null @@ -1,7 +0,0 @@ -parent: - bar: Bar - baz: Baz -foo: Foo -numeric_keys: - 403: '' - 404: '' diff --git a/core/modules/system/tests/modules/config_upgrade/config_upgrade.info.yml b/core/modules/system/tests/modules/config_upgrade/config_upgrade.info.yml deleted file mode 100644 index b439c463f736c23ab559431bbeadad8dbc698d6d..0000000000000000000000000000000000000000 --- a/core/modules/system/tests/modules/config_upgrade/config_upgrade.info.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 'Config upgrade tests' -type: module -description: 'A support module for update_variables_to_config testing.' -core: 8.x -package: Testing -version: VERSION -hidden: true diff --git a/core/modules/system/tests/modules/config_upgrade/config_upgrade.module b/core/modules/system/tests/modules/config_upgrade/config_upgrade.module deleted file mode 100644 index 461e96e5b4951a0b222c9c8490b276c019ce8f3d..0000000000000000000000000000000000000000 --- a/core/modules/system/tests/modules/config_upgrade/config_upgrade.module +++ /dev/null @@ -1,6 +0,0 @@ -installSchema('system', array('menu_router', 'variable', 'key_value_expire')); + $this->installSchema('system', array('menu_router', 'key_value_expire')); } diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php index 77841f37fd15a6f15ec664100ceed232b8e81166..1ef7ca860e9338bb375da24c60b6f1645c1a6e3c 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterBooleanOperatorTest.php @@ -45,7 +45,7 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->installSchema('system', array('menu_router', 'variable', 'key_value_expire')); + $this->installSchema('system', array('menu_router', 'key_value_expire')); } /** diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php index 9b74533ef75774602d8fb336bcca2ea47e7260fe..0c0c5179f675c00776592cc462df79212475a7cd 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterEqualityTest.php @@ -38,7 +38,7 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->installSchema('system', array('menu_router', 'variable', 'key_value_expire')); + $this->installSchema('system', array('menu_router', 'key_value_expire')); } function viewsData() { diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php index 0c1f32a9236bfc5e10c9716a05d753eca6874b4b..bd024e2ace3bd75b4c2107c6115334162b03ef12 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterInOperatorTest.php @@ -39,7 +39,7 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->installSchema('system', array('menu_router', 'variable', 'key_value_expire')); + $this->installSchema('system', array('menu_router', 'key_value_expire')); } function viewsData() { diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php index a1f50ef18909ee0737bf5f4a852ca1ef955864df..ad0a627465443a6065b0c45ec037d17fe83943c4 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterNumericTest.php @@ -39,7 +39,7 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->installSchema('system', array('menu_router', 'variable', 'key_value_expire')); + $this->installSchema('system', array('menu_router', 'key_value_expire')); } function viewsData() { diff --git a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php index f00eaf3ee061623bc9fe0fcaece69ed4faf9ae74..5a62bed44f5c580a2f6c577f1e6dd6c0cb785c72 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Handler/FilterStringTest.php @@ -38,7 +38,7 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->installSchema('system', array('menu_router', 'variable', 'key_value_expire')); + $this->installSchema('system', array('menu_router', 'key_value_expire')); } function viewsData() { diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php index 8d2fad6b8ab861551a09bb3745ba75d9ebd29dad..b654289e3dbe6e47a210665f738a79a29eb65c93 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/WizardPluginBaseUnitTest.php @@ -43,7 +43,6 @@ public static function getInfo() { protected function setUp() { parent::setUp(); - $this->installSchema('system', 'variable'); $this->installConfig(array('language')); $this->enableModules(array('views_ui')); diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 230afd6ec206b1a9b21514f216797620713caa7f..d48c638a8c972e15c2d2b59bff53d552f295c3c5 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -485,7 +485,7 @@ function simpletest_script_run_phpunit($test_id, $class) { * Bootstrap Drupal and run a single test. */ function simpletest_script_run_one_test($test_id, $test_class) { - global $args, $conf; + global $args; try { // Bootstrap Drupal. @@ -497,8 +497,8 @@ function simpletest_script_run_one_test($test_id, $test_class) { $container->set('request', $request); // Override configuration according to command line parameters. - $conf['simpletest.settings']['verbose'] = $args['verbose']; - $conf['simpletest.settings']['clear_results'] = !$args['keep-results']; + $GLOBALS['conf']['simpletest.settings']['verbose'] = $args['verbose']; + $GLOBALS['conf']['simpletest.settings']['clear_results'] = !$args['keep-results']; $test = new $test_class($test_id); $test->dieOnFail = (bool) $args['die-on-fail']; diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php index 9ee7301687e7c157038c790f0e18bdbac1031f8c..cb4c810a88a8677fb999870362bd12bd9f4081d6 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/FileStorageTest.php @@ -25,17 +25,17 @@ public static function getInfo() { public function setUp() { parent::setUp(); $dir_path = sys_get_temp_dir() . '/php'; - $conf['php_storage']['simpletest'] = array( + $settings['php_storage']['simpletest'] = array( 'class' => 'Drupal\Component\PhpStorage\FileStorage', 'directory' => $dir_path, ); - $conf['php_storage']['readonly'] = array( + $settings['php_storage']['readonly'] = array( 'class' => 'Drupal\Component\PhpStorage\FileReadOnlyStorage', 'directory' => $dir_path, // Let this read from the bin where the other instance is writing. 'bin' => 'simpletest', ); - new Settings($conf); + new Settings($settings); } /** diff --git a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php index 1e28e362d0b3a4063c55665e1049cec0fffa5a61..214b1a71808cc3b67415f3302031386aea51ea81 100644 --- a/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php +++ b/core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php @@ -36,12 +36,12 @@ public static function getInfo() { function setUp() { parent::setUp(); $this->secret = $this->randomName(); - $conf['php_storage']['simpletest'] = array( + $settings['php_storage']['simpletest'] = array( 'class' => $this->storageClass, 'directory' => sys_get_temp_dir() . '/php', 'secret' => $this->secret, ); - new Settings($conf); + new Settings($settings); } /** diff --git a/core/update.php b/core/update.php index 075bfdb7bb79b94ee2c646f7f5923b8b69653554..db6b9d2aabcb376fad28e7efd393ce3ceed21532 100644 --- a/core/update.php +++ b/core/update.php @@ -347,11 +347,8 @@ function update_check_requirements($skip_warnings = FALSE) { update_prepare_d8_bootstrap(); // Determine if the current user has access to run update.php. -drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); - -// A request object from the HTTPFoundation to tell us about the request. -$request = Request::createFromGlobals(); -\Drupal::getContainer()->set('request', $request); +drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); +$request = \Drupal::request(); require_once DRUPAL_ROOT . '/' . settings()->get('session_inc', 'core/includes/session.inc'); drupal_session_initialize();