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..a6ae774 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. @@ -542,8 +537,7 @@ function drupal_settings_initialize() { global $base_url, $base_path, $base_root, $script_path; // Export these settings.php variables to the global namespace. - global $databases, $cookie_domain, $conf, $db_prefix, $drupal_hash_salt, $base_secure_url, $base_insecure_url, $config_directories; - $conf = array(); + global $databases, $cookie_domain, $db_prefix, $drupal_hash_salt, $base_secure_url, $base_insecure_url, $config_directories; // Make conf_path() available as local variable in settings.php. $conf_path = conf_path(); @@ -792,124 +786,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 +1595,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 +1618,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 +1649,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 +1853,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 +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. * * The current phase is the one most recently completed by drupal_bootstrap(). @@ -2227,14 +2083,14 @@ function drupal_valid_test_ua($new_prefix = NULL) { * Very strictly for internal use only. * * Loads settings.php from the simpletest public files directory. These files - * can change the global $conf, the global $config_directories, the return - * value of conf_path(), and settings(). + * can change the global $config_directories, the return value of conf_path(), + * and settings(). * * @param string $test_prefix * The simpletest prefix. */ function _drupal_load_test_overrides($test_prefix) { - global $conf, $config_directories; + global $config_directories; // Do not use the parent site's config directories. Use only the child site's. // @see \Drupal\simpletest\TestBase::prepareConfigDirectories() @@ -2249,7 +2105,7 @@ function _drupal_load_test_overrides($test_prefix) { if (file_exists($filename)) { $settings = settings()->getAll(); $conf_path = &drupal_static('conf_path'); - // This can override $conf, $conf_path, $settings, and $config_directories. + // This can override $conf_path, $settings, and $config_directories. include $filename; // Keep the overriden $conf_path alive across drupal_static_reset() calls. // @see conf_path() diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 0259cec..cf0dda4 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(); @@ -1485,6 +1485,7 @@ function install_file_translation_service() { * The path to the installation directory. */ function install_translations_directory() { + // @todo global $config, https://drupal.org/node/1881582 if (isset($GLOBALS['conf']['locale.settings']['translation.path'])) { $directory = $GLOBALS['conf']['locale.settings']['translation.path']; } diff --git a/core/includes/menu.inc b/core/includes/menu.inc index c3a2162..618d73b 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..8482a7f 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -107,6 +107,7 @@ function update_prepare_d8_bootstrap() { // Enable UpdateServiceProvider service overrides. // @see update_flush_all_caches() + // @todo global $config, https://drupal.org/node/1881582 $GLOBALS['conf']['container_service_providers']['UpdateServiceProvider'] = 'Drupal\Core\DependencyInjection\UpdateServiceProvider'; $GLOBALS['conf']['update_service_provider_overrides'] = TRUE; @@ -121,6 +122,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 +320,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 +462,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. @@ -1327,7 +1330,7 @@ function update_retrieve_dependencies() { /** * Gets the value of a variable from the database during 7.x-8.x upgrades. * - * Use this during the 7.x-8.x upgrade path instead of variable_get(). + * Use this during the 7.x-8.x upgrade path. * * @param string $name * The name of the variable. @@ -1352,7 +1355,7 @@ function update_variable_get($name, $default = NULL) { /** * Sets a persistent variable during the 7.x-8.x upgrade path. * - * Use this during the 7.x-8.x upgrade path instead of variable_set(). + * Use this during the 7.x-8.x upgrade path. * * @param string $name * The name of the variable to set. @@ -1378,7 +1381,7 @@ function update_variable_set($name, $value) { /** * Delete a variable from the database during the 7.x-8.x upgrade path. * - * Use this during the 7.x-8.x upgrade path instead of variable_del(). + * Use this during the 7.x-8.x upgrade path. * * @param string $name * The name of the variable to delete. @@ -1443,8 +1446,8 @@ function update_variables_to_config($config_name, array $variable_map) { foreach ($variable_map as $variable_name => $config_key) { // This function migrates variables regardless of their value, including // NULL values. Any possibly required customizations need to be performed - // manually, either via variable_set() before calling this function or via - // \Drupal::config() after calling this function. + // manually, either via update_variable_set() before calling this function + // or via \Drupal::config() after calling this function. if (isset($variables[$variable_name])) { $value = unserialize($variables[$variable_name]); $config->set($config_key, $value); 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/Config/ConfigFactory.php b/core/lib/Drupal/Core/Config/ConfigFactory.php index e277787..30dbf9a 100644 --- a/core/lib/Drupal/Core/Config/ConfigFactory.php +++ b/core/lib/Drupal/Core/Config/ConfigFactory.php @@ -156,6 +156,7 @@ public function get($name) { $this->cache[$cache_key]->setModuleOverride($module_overrides[$name]); } // Apply any settings.php overrides. + // @todo global $config, https://drupal.org/node/1881582 if (isset($conf[$name])) { $this->cache[$cache_key]->setSettingsOverride($conf[$name]); } @@ -231,6 +232,7 @@ public function loadMultiple(array $names) { if (isset($module_overrides[$name])) { $this->cache[$cache_key]->setModuleOverride($module_overrides[$name]); } + // @todo global $config, https://drupal.org/node/1881582 if (isset($conf[$name])) { $this->cache[$cache_key]->setSettingsOverride($conf[$name]); } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index e2a03a7..a4ad00b 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -238,6 +238,7 @@ public function discoverServiceProviders() { } // Add site specific or test service providers. + // @todo Move to $settings? https://drupal.org/node/1881582 if (!empty($GLOBALS['conf']['container_service_providers'])) { foreach ($GLOBALS['conf']['container_service_providers'] as $name => $class) { $serviceProviders[$name] = new $class(); @@ -245,6 +246,7 @@ public function discoverServiceProviders() { } } // Add site specific or test YAMLs. + // @todo Move to $settings? https://drupal.org/node/1881582 if (!empty($GLOBALS['conf']['container_yamls'])) { $this->serviceYamls = array_merge($this->serviceYamls, $GLOBALS['conf']['container_yamls']); } diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php index 02bf2cb..988410c 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigGlobalOverrideSubscriber.php @@ -23,6 +23,7 @@ class ConfigGlobalOverrideSubscriber implements EventSubscriberInterface { * The Event to process. */ public function configInit(ConfigEvent $event) { + // @todo global $config, https://drupal.org/node/1881582 global $conf; $config = $event->getConfig(); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php index f6f3f46..49e4674 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php @@ -38,6 +38,7 @@ public function setUp() { * Tests configuration override. */ function testConfOverride() { + // @todo global $config, https://drupal.org/node/1881582 global $conf; $expected_original_data = array( 'foo' => 'bar', diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index 0e40243..b25efb3 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -94,6 +94,7 @@ protected function setUp() { // Build a minimal, partially mocked environment for unit tests. $this->containerBuild(\Drupal::getContainer()); // Make sure it survives kernel rebuilds. + // @todo Move into $settings? https://drupal.org/node/1881582 $GLOBALS['conf']['container_service_providers']['TestServiceProvider'] = 'Drupal\simpletest\TestServiceProvider'; \Drupal::state()->set('system.module.files', $this->moduleFiles); @@ -152,7 +153,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/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index bca0239..738b573 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -921,7 +921,7 @@ protected function beforePrepareEnvironment() { * @see TestBase::beforePrepareEnvironment() */ private function prepareEnvironment() { - global $user, $conf; + global $user; // Allow (base) test classes to backup global state information. $this->beforePrepareEnvironment(); @@ -940,7 +940,6 @@ private function prepareEnvironment() { // Backup current in-memory configuration. $this->originalSettings = settings()->getAll(); - $this->originalConf = $conf; // Backup statics and globals. $this->originalContainer = clone \Drupal::getContainer(); @@ -1036,9 +1035,6 @@ private function prepareEnvironment() { // Change the database prefix. $this->changeDatabasePrefix(); - // Reset all variables to perform tests in a clean environment. - $conf = array(); - drupal_set_time_limit($this->timeLimit); } @@ -1116,7 +1112,7 @@ protected function tearDown() { * @see TestBase::prepareEnvironment() */ private function restoreEnvironment() { - global $user, $conf; + global $user; // Reset all static variables. // Unsetting static variables will potentially invoke destruct methods, @@ -1177,7 +1173,6 @@ private function restoreEnvironment() { drupal_static_reset(); // Restore original in-memory configuration. - $conf = $this->originalConf; new Settings($this->originalSettings); // Restore original statics and globals. diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index ec40407..654b06a 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -739,6 +739,9 @@ protected function setUp() { 'translation.path' => $this->translation_files_directory, ), ); + if (!isset($GLOBALS['conf'])) { + $GLOBALS['conf'] = array(); + } foreach ($variable_groups as $config_base => $variables) { foreach ($variables as $name => $value) { NestedArray::setValue($GLOBALS['conf'], array_merge(array($config_base), explode('.', $name)), $value); @@ -957,31 +960,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..a4a698b 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,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - global $conf; - $conf['php_storage']['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')); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerLanguageTest.php b/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerLanguageTest.php index c3308f7..2be120f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerLanguageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Installer/InstallerLanguageTest.php @@ -27,6 +27,7 @@ function setUp() { parent::setUp(); // The database is not available during this part of install. Use global // $conf to override the installation translations directory path. + // @todo global $config, https://drupal.org/node/1881582 global $conf; $conf['locale.settings']['translation.path'] = drupal_get_path('module', 'simpletest') . '/files/translations'; } 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..c24c833 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,6 @@ protected function setUp() { $this->container ->register('keyvalue.database', 'Drupal\Core\KeyValueStore\KeyValueDatabaseFactory') ->addArgument(new Reference('database')); - global $conf; - $conf['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..f4d22df 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -320,6 +320,7 @@ function system_requirements($phase) { // During an install we need to make assumptions about the file system // unless overrides are provided in settings.php. if ($phase == 'install') { + // @todo global $config, https://drupal.org/node/1881582 global $conf; $directories = array(); if ($file_public_path = settings()->get('file_public_path')) { @@ -331,6 +332,7 @@ function system_requirements($phase) { // conf_path() cache must also be reset in this case. $directories[] = conf_path(FALSE, TRUE) . '/files'; } + // @todo Move into $settings for consistency. if (!empty($conf['system.file']['path.private'])) { $directories[] = $conf['system.file']['path.private']; } @@ -575,29 +577,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( diff --git a/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Controller/SystemTestController.php index 058aabe..5d7f49c 100644 --- a/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Controller/SystemTestController.php +++ b/core/modules/system/tests/modules/system_test/lib/Drupal/system_test/Controller/SystemTestController.php @@ -57,13 +57,6 @@ public function authorizeInit($page_title) { } /** - * @todo Remove as part of https://drupal.org/node/1775842. - */ - public function variableGet() { - return variable_get('simpletest_bootstrap_variable_test'); - } - - /** * @todo Remove system_test_set_header(). */ public function setHeader() { diff --git a/core/modules/system/tests/modules/system_test/system_test.routing.yml b/core/modules/system/tests/modules/system_test/system_test.routing.yml index 660cfce..ecd03ed 100644 --- a/core/modules/system/tests/modules/system_test/system_test.routing.yml +++ b/core/modules/system/tests/modules/system_test/system_test.routing.yml @@ -59,14 +59,6 @@ system_test.authorize_init: requirements: _permission: 'administer software updates' -system_test.variable_get: - path: '/system-test/variable-get' - defaults: - _title: 'Variable Get' - _content: '\Drupal\system_test\Controller\SystemTestController::variableGet' - requirements: - _permission: 'access content' - system_test.set_header: path: '/system-test/set-header' defaults: diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index f35d4ae..706d072 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -113,6 +113,7 @@ function toolbar_element_info() { * once Drupal's page caching itself is properly integrated. */ function _toolbar_initialize_page_cache() { + // @todo global $config, https://drupal.org/node/1881582 $GLOBALS['conf']['system.performance']['cache']['page']['enabled'] = TRUE; drupal_page_is_cacheable(TRUE); 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..5173912 100644 --- a/core/update.php +++ b/core/update.php @@ -86,6 +86,7 @@ function update_helpful_links() { * while updates are running. */ function update_flush_all_caches() { + // @todo global $config, https://drupal.org/node/1881582 $GLOBALS['conf']['update_service_provider_overrides'] = FALSE; \Drupal::service('kernel')->updateModules(\Drupal::moduleHandler()->getModuleList()); @@ -347,11 +348,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();