diff --git a/core/authorize.php b/core/authorize.php index ecb7e22..fd9e2f4 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 8bbdd91..ac76982 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. @@ -792,124 +787,6 @@ function settings() { } /** - * 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. * * @param \Symfony\Component\HttpFoundation\Request $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'); } @@ -2055,16 +1922,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. * * The current phase is the one most recently completed by drupal_bootstrap(). @@ -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 24d3269..cc2fb5b 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 d54fe06..bdffb10 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 96dcd2f..8456eee 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 fe74fe0..9383a07 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 82a9b4a..0939799 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 b7f94bb..7bf290c 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 e95f134..0000000 --- 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 ec309f6..b575e6b 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 28dc5eb..7c0dc5c 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 4119240..f035f37 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 f90d5f1..4f83cc5 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 @@ 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 596eb5c..3b2372c 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 @@ */ 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 a1780b7..3fd2907 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 @@ 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 3a8feed..7c53a1c 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 @@ 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 0e40243..cdf835b 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -152,7 +152,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 ec40407..b284941 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 ed132e8..59675f1 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 9729ea3..0000000 --- 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 2639f3b..ae61ae5 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 ee1c0d0..5f47450 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 f97a44f..b33285c 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 381d8b0..f548360 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 a76281a..ad286d6 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 54471a7..ca065fa 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 ac8dd22..25f75c7 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 fc448c1..0000000 --- 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 b439c46..0000000 --- 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 461e96e..0000000 --- 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 77841f3..1ef7ca8 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 9b74533..0c0c517 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 0c1f32a..bd024e2 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 a1f50ef..ad0a627 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 f00eaf3..5a62bed 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 8d2fad6..b654289 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 230afd6..d48c638 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 9ee7301..cb4c810 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 1e28e36..214b1a7 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 075bfdb..db6b9d2 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();