');
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php
index 3dfd5c7..eb59f94 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php
@@ -67,12 +67,12 @@ function testMenuTreeSetPath() {
);
// Test the tree generation for the Tools menu.
- state()->delete('menu_test.menu_tree_set_path');
+ \Drupal::state()->delete('menu_test.menu_tree_set_path');
$this->assertBreadcrumb('menu-test/menu-trail', $breadcrumb, t('Menu trail - Case 1'), $tree);
// Override the active trail for the Administration tree; it should not
// affect the Tools tree.
- state()->set('menu_test.menu_tree_set_path', $test_menu_path);
+ \Drupal::state()->set('menu_test.menu_tree_set_path', $test_menu_path);
$this->assertBreadcrumb('menu-test/menu-trail', $breadcrumb, t('Menu trail - Case 1'), $tree);
$breadcrumb = $config + array(
@@ -93,12 +93,12 @@ function testMenuTreeSetPath() {
);
// Test the tree generation for the Administration menu.
- state()->delete('menu_test.menu_tree_set_path');
+ \Drupal::state()->delete('menu_test.menu_tree_set_path');
$this->assertBreadcrumb('admin/config/development/menu-trail', $breadcrumb, t('Menu trail - Case 2'), $tree);
// Override the active trail for the Administration tree; it should affect
// the breadcrumbs and Administration tree.
- state()->set('menu_test.menu_tree_set_path', $test_menu_path);
+ \Drupal::state()->set('menu_test.menu_tree_set_path', $test_menu_path);
$this->assertBreadcrumb('admin/config/development/menu-trail', $override_breadcrumb, t('Menu trail - Case 2'), $override_tree);
}
@@ -150,13 +150,13 @@ function testCustom403And404Pages() {
foreach (array(403, 404) as $status_code) {
// Before visiting the page, trigger the code in the menu_test module
// that will record the active trail (so we can check it in this test).
- state()->set('menu_test.record_active_trail', TRUE);
+ \Drupal::state()->set('menu_test.record_active_trail', TRUE);
$this->drupalGet($paths[$status_code]);
$this->assertResponse($status_code);
// Check that the initial trail (during the Drupal bootstrap) matches
// what we expect.
- $initial_trail = state()->get('menu_test.active_trail_initial') ?: array();
+ $initial_trail = \Drupal::state()->get('menu_test.active_trail_initial') ?: array();
$this->assertEqual(count($initial_trail), count($expected_trail[$status_code]['initial']), format_string('The initial active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array(
'@status_code' => $status_code,
'@expected' => count($expected_trail[$status_code]['initial']),
@@ -173,7 +173,7 @@ function testCustom403And404Pages() {
// Check that the final trail (after the user has been redirected to the
// custom 403/404 page) matches what we expect.
- $final_trail = state()->get('menu_test.active_trail_final') ?: array();
+ $final_trail = \Drupal::state()->get('menu_test.active_trail_final') ?: array();
$this->assertEqual(count($final_trail), count($expected_trail[$status_code]['final']), format_string('The final active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array(
'@status_code' => $status_code,
'@expected' => count($expected_trail[$status_code]['final']),
diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
index e561ab7..023f485 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php
@@ -132,7 +132,7 @@ function testModuleEnableOrder() {
module_enable(array('module_test'), FALSE);
$this->resetAll();
$this->assertModules(array('module_test'), TRUE);
- state()->set('module_test.dependency', 'dependency');
+ \Drupal::state()->set('module_test.dependency', 'dependency');
// module_test creates a dependency chain:
// - forum depends on taxonomy, comment, history, and ban (via module_test)
// - taxonomy depends on options
@@ -159,7 +159,7 @@ function testModuleEnableOrder() {
$this->assertModules(array('forum', 'ban', 'php', 'comment', 'history', 'taxonomy', 'options', 'number'), TRUE);
// Check the actual order which is saved by module_test_modules_enabled().
- $module_order = state()->get('system_test.module_enable_order') ?: array();
+ $module_order = \Drupal::state()->get('system_test.module_enable_order') ?: array();
$this->assertIdentical($module_order, $expected_order);
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php
index f8aa2b3..8458bc7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php
@@ -64,7 +64,7 @@ function testEnableDisable() {
// Set a variable so that the hook implementations in system_test.module
// will display messages via drupal_set_message().
- state()->set('system_test.verbose_module_hooks', TRUE);
+ \Drupal::state()->set('system_test.verbose_module_hooks', TRUE);
// Go through each module in the list and try to enable it (unless it was
// already enabled automatically due to a dependency).
diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
index 3de02ce..19b51e4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
@@ -164,7 +164,7 @@ function testDependencyResolution() {
// First, create a fake missing dependency. Forum depends on ban, which
// depends on a made-up module, foo. Nothing should be installed.
- state()->set('module_test.dependency', 'missing dependency');
+ \Drupal::state()->set('module_test.dependency', 'missing dependency');
drupal_static_reset('system_rebuild_module_data');
$result = module_enable(array('forum'));
$this->assertFalse($result, 'module_enable() returns FALSE if dependencies are missing.');
@@ -172,7 +172,7 @@ function testDependencyResolution() {
// Now, fix the missing dependency. Forum module depends on ban, but ban
// depends on the PHP module. module_enable() should work.
- state()->set('module_test.dependency', 'dependency');
+ \Drupal::state()->set('module_test.dependency', 'dependency');
drupal_static_reset('system_rebuild_module_data');
$result = module_enable(array('forum'));
$this->assertTrue($result, 'module_enable() returns the correct value.');
@@ -181,7 +181,7 @@ function testDependencyResolution() {
// Verify that the original module was installed.
$this->assertTrue(module_exists('forum'), 'Module installation with unlisted dependencies succeeded.');
// Finally, verify that the modules were enabled in the correct order.
- $module_order = state()->get('system_test.module_enable_order') ?: array();
+ $module_order = \Drupal::state()->get('system_test.module_enable_order') ?: array();
$this->assertEqual($module_order, array('php', 'ban', 'forum'), 'Modules were enabled in the correct order by module_enable().');
// Now, disable the PHP module. Both forum and ban should be disabled as
@@ -189,7 +189,7 @@ function testDependencyResolution() {
module_disable(array('php'));
$this->assertTrue(!module_exists('forum') && !module_exists('ban'), 'Depedency chain was disabled by module_disable().');
$this->assertFalse(module_exists('php'), 'Disabling a module with unlisted dependents succeeded.');
- $disabled_modules = state()->get('module_test.disable_order') ?: array();
+ $disabled_modules = \Drupal::state()->get('module_test.disable_order') ?: array();
$this->assertEqual($disabled_modules, array('forum', 'ban', 'php'), 'Modules were disabled in the correct order by module_disable().');
// Disable a module that is listed as a dependency by the installation
@@ -201,7 +201,7 @@ function testDependencyResolution() {
$this->assertTrue(module_exists('comment'), 'Comment module is enabled.');
module_disable(array('comment'));
$this->assertFalse(module_exists('comment'), 'Comment module was disabled.');
- $disabled_modules = state()->get('module_test.disable_order') ?: array();
+ $disabled_modules = \Drupal::state()->get('module_test.disable_order') ?: array();
$this->assertTrue(in_array('comment', $disabled_modules), 'Comment module is in the list of disabled modules.');
$this->assertFalse(in_array($profile, $disabled_modules), 'The installation profile is not in the list of disabled modules.');
@@ -222,7 +222,7 @@ function testDependencyResolution() {
foreach (array('forum', 'ban', 'php') as $module) {
$this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, format_string('The @module module was uninstalled.', array('@module' => $module)));
}
- $uninstalled_modules = state()->get('module_test.uninstall_order') ?: array();
+ $uninstalled_modules = \Drupal::state()->get('module_test.uninstall_order') ?: array();
$this->assertEqual($uninstalled_modules, array('forum', 'ban', 'php'), 'Modules were uninstalled in the correct order by module_uninstall().');
// Uninstall the profile module from above, and make sure that the profile
@@ -230,7 +230,7 @@ function testDependencyResolution() {
$result = module_uninstall(array('comment'));
$this->assertTrue($result, 'module_uninstall() returns the correct value.');
$this->assertEqual(drupal_get_installed_schema_version('comment'), SCHEMA_UNINSTALLED, 'Comment module was uninstalled.');
- $uninstalled_modules = state()->get('module_test.uninstall_order') ?: array();
+ $uninstalled_modules = \Drupal::state()->get('module_test.uninstall_order') ?: array();
$this->assertTrue(in_array('comment', $uninstalled_modules), 'Comment module is in the list of uninstalled modules.');
$this->assertFalse(in_array($profile, $uninstalled_modules), 'The installation profile is not in the list of uninstalled modules.');
@@ -238,7 +238,7 @@ function testDependencyResolution() {
// php module. But, this time do it with ban module declaring a dependency
// on a specific version of php module in its info file. Make sure that
// module_enable() still works.
- state()->set('module_test.dependency', 'version dependency');
+ \Drupal::state()->set('module_test.dependency', 'version dependency');
drupal_static_reset('system_rebuild_module_data');
$result = module_enable(array('forum'));
$this->assertTrue($result, 'module_enable() returns the correct value.');
@@ -247,7 +247,7 @@ function testDependencyResolution() {
// Verify that the original module was installed.
$this->assertTrue(module_exists('forum'), 'Module installation with version dependencies succeeded.');
// Finally, verify that the modules were enabled in the correct order.
- $enable_order = state()->get('system_test.module_enable_order') ?: array();
+ $enable_order = \Drupal::state()->get('system_test.module_enable_order') ?: array();
$php_position = array_search('php', $enable_order);
$ban_position = array_search('ban', $enable_order);
$forum_position = array_search('forum', $enable_order);
diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php
index 467a395..7998af1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Module/VersionTest.php
@@ -62,7 +62,7 @@ function testModuleVersions() {
// Testing extra version. Incompatible.
'common_test (>2.4-rc0)',
);
- state()->set('system_test.dependencies', $dependencies);
+ \Drupal::state()->set('system_test.dependencies', $dependencies);
$n = count($dependencies);
for ($i = 0; $i < $n; $i++) {
$this->drupalGet('admin/modules');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/PathUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Path/PathUnitTestBase.php
index ca7ef51..faaa158 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/PathUnitTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/PathUnitTestBase.php
@@ -20,7 +20,7 @@ public function setUp() {
$this->fixtures = new UrlAliasFixtures();
// The alias whitelist expects that the menu path roots are set by a
// menu router rebuild.
- state()->set('menu_path_roots', array('user', 'admin'));
+ \Drupal::state()->set('menu_path_roots', array('user', 'admin'));
}
public function tearDown() {
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
index 5def452..67a5993 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/CronRunTest.php
@@ -42,7 +42,7 @@ function testCronRun() {
$this->assertResponse(403);
// Run cron anonymously with the valid cron key.
- $key = state()->get('system.cron_key');
+ $key = \Drupal::state()->get('system.cron_key');
$this->drupalGet('cron/' . $key);
$this->assertResponse(204);
}
@@ -58,19 +58,19 @@ function testAutomaticCron() {
// not passed.
$cron_last = time();
$cron_safe_threshold = 100;
- state()->set('system.cron_last', $cron_last);
+ \Drupal::state()->set('system.cron_last', $cron_last);
config('system.cron')
->set('threshold.autorun', $cron_safe_threshold)
->save();
$this->drupalGet('');
- $this->assertTrue($cron_last == state()->get('system.cron_last'), 'Cron does not run when the cron threshold is not passed.');
+ $this->assertTrue($cron_last == \Drupal::state()->get('system.cron_last'), 'Cron does not run when the cron threshold is not passed.');
// Test if cron runs when the cron threshold was passed.
$cron_last = time() - 200;
- state()->set('system.cron_last', $cron_last);
+ \Drupal::state()->set('system.cron_last', $cron_last);
$this->drupalGet('');
sleep(1);
- $this->assertTrue($cron_last < state()->get('system.cron_last'), 'Cron runs when the cron threshold is passed.');
+ $this->assertTrue($cron_last < \Drupal::state()->get('system.cron_last'), 'Cron runs when the cron threshold is passed.');
// Disable the cron threshold through the interface.
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
@@ -81,21 +81,21 @@ function testAutomaticCron() {
// Test if cron does not run when the cron threshold is disabled.
$cron_last = time() - 200;
- state()->set('system.cron_last', $cron_last);
+ \Drupal::state()->set('system.cron_last', $cron_last);
$this->drupalGet('');
- $this->assertTrue($cron_last == state()->get('system.cron_last'), 'Cron does not run when the cron threshold is disabled.');
+ $this->assertTrue($cron_last == \Drupal::state()->get('system.cron_last'), 'Cron does not run when the cron threshold is disabled.');
}
/**
* Make sure exceptions thrown on hook_cron() don't affect other modules.
*/
function testCronExceptions() {
- state()->delete('common_test.cron');
+ \Drupal::state()->delete('common_test.cron');
// The common_test module throws an exception. If it isn't caught, the tests
// won't finish successfully.
// The common_test_cron_helper module sets the 'common_test_cron' variable.
$this->cronRun();
- $result = state()->get('common_test.cron');
+ $result = \Drupal::state()->get('common_test.cron');
$this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
index 8b98ecf..bbc3fb1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
@@ -40,7 +40,7 @@ function setUp() {
// Configure 'node' as front page.
config('system.site')->set('page.front', 'node')->save();
// Enable front page logging in system_test.module.
- state()->set('system_test.front_page_output', 1);
+ \Drupal::state()->set('system_test.front_page_output', 1);
}
/**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php
index b02d5ff..3be42d0 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ModulesDisabledUpgradePathTest.php
@@ -53,6 +53,6 @@ public function testDisabledUpgrade() {
require_once DRUPAL_ROOT . '/core/includes/install.inc';
$updates = update_get_update_list();
$this->assertEqual($updates, array(), 'No pending updates after enabling all modules.');
- $this->assertTrue(state()->get('update_test_1_update_dependencies_run'), 'Module update dependencies resolved for disabled modules');
+ $this->assertTrue(\Drupal::state()->get('update_test_1_update_dependencies_run'), 'Module update dependencies resolved for disabled modules');
}
}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
index ffa786f..b9a97a5 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/StateSystemUpgradePathTest.php
@@ -81,7 +81,7 @@ public function testSystemVariableUpgrade() {
);
foreach ($expected_state as $name => $data) {
- $this->assertIdentical(state()->get($name), $data['value']);
+ $this->assertIdentical(\Drupal::state()->get($name), $data['value']);
$deleted = !db_query('SELECT value FROM {variable} WHERE name = :name', array(':name' => $data['variable_name']))->fetchField();
$this->assertTrue($deleted, format_string('Variable !name has been deleted.', array('!name' => $data['variable_name'])));
}
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index dbdf6a5..7ef1b53 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -1540,13 +1540,13 @@ function system_cron_settings($form, &$form_state) {
'#submit' => array('system_run_cron_submit'),
);
- $status = '' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - state()->get('system.cron_last')))) . '
';
+ $status = '' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - Drupal::state()->get('system.cron_last')))) . '
';
$form['status'] = array(
'#markup' => $status,
);
$form['cron_url'] = array(
- '#markup' => '' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . state()->get('system.cron_key'), array('absolute' => TRUE)))) . '
',
+ '#markup' => '' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . Drupal::state()->get('system.cron_key'), array('absolute' => TRUE)))) . '
',
);
$form['cron'] = array(
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 5a1aae6..25573b9 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -113,11 +113,11 @@ function hook_admin_paths_alter(&$paths) {
function hook_cron() {
// Short-running operation example, not using a queue:
// Delete all expired records since the last cron run.
- $expires = state()->get('mymodule.cron_last_run') ?: REQUEST_TIME;
+ $expires = \Drupal::state()->get('mymodule.cron_last_run') ?: REQUEST_TIME;
db_delete('mymodule_table')
->condition('expires', $expires, '>=')
->execute();
- state()->set('mymodule.cron_last_run', REQUEST_TIME);
+ \Drupal::state()->set('mymodule.cron_last_run', REQUEST_TIME);
// Long-running operation example, leveraging a queue:
// Fetch feeds from other sites.
@@ -2353,7 +2353,7 @@ function hook_requirements($phase) {
// Report cron status
if ($phase == 'runtime') {
- $cron_last = state()->get('system.cron_last');
+ $cron_last = \Drupal::state()->get('system.cron_last');
if (is_numeric($cron_last)) {
$requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(REQUEST_TIME - $cron_last)));
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index a93a124..4545359 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1,4 +1,4 @@
-configuring cron jobs.', array('@cron-handbook' => 'http://drupal.org/cron'));
// Determine when cron last ran.
- $cron_last = state()->get('system.cron_last');
+ $cron_last = Drupal::state()->get('system.cron_last');
if (!is_numeric($cron_last)) {
$cron_last = variable_get('install_time', 0);
}
@@ -294,7 +294,7 @@ function system_requirements($phase) {
}
$description .= ' ' . $t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron')));
- $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . state()->get('system.cron_key'), array('absolute' => TRUE))));
+ $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . Drupal::state()->get('system.cron_key'), array('absolute' => TRUE))));
$requirements['cron'] = array(
'title' => $t('Cron maintenance tasks'),
@@ -530,7 +530,7 @@ function system_install() {
// Populate the cron key state variable.
$cron_key = drupal_hash_base64(drupal_random_bytes(55));
- state()->set('system.cron_key', $cron_key);
+ Drupal::state()->set('system.cron_key', $cron_key);
}
/**
@@ -734,7 +734,7 @@ function system_schema() {
);
$schema['key_value'] = array(
- 'description' => 'Generic key-value storage table. See state() for an example.',
+ 'description' => 'Generic key-value storage table. See the state system for an example.',
'fields' => array(
'collection' => array(
'description' => 'A named collection of key and value pairs.',
@@ -1784,7 +1784,7 @@ function system_update_8028() {
*/
function system_update_8029() {
if ($value = update_variable_get('path_alias_whitelist', FALSE)) {
- state()->set('system.path_alias_whitelist', $value);
+ Drupal::state()->set('system.path_alias_whitelist', $value);
}
update_variable_del('path_alias_whitelist');
}
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index c4304f4..74839a8 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2965,7 +2965,7 @@ function system_rebuild_module_data() {
// Store filenames to allow system_list() and drupal_get_filename() to
// retrieve them without having to rebuild or scan the filesystem.
- state()->set('system.module.files', $files);
+ Drupal::state()->set('system.module.files', $files);
}
return $modules_cache;
}
@@ -2984,7 +2984,7 @@ function _system_update_bootstrap_status() {
$bootstrap_modules[$module] = drupal_get_filename('module', $module);
}
}
- state()->set('system.module.bootstrap', $bootstrap_modules);
+ Drupal::state()->set('system.module.bootstrap', $bootstrap_modules);
}
/**
@@ -3131,11 +3131,11 @@ function system_rebuild_theme_data() {
}
// Replace last known theme data state.
// @todo Obsolete with proper installation status for themes.
- state()->set('system.theme.data', $themes);
+ Drupal::state()->set('system.theme.data', $themes);
// Store filenames to allow system_list() and drupal_get_filename() to
// retrieve them without having to rebuild or scan the filesystem.
- state()->set('system.theme.files', $files);
+ Drupal::state()->set('system.theme.files', $files);
return $themes;
}
@@ -3744,7 +3744,7 @@ function system_run_automated_cron() {
// Otherwise it could be triggered prematurely by Ajax requests during
// installation.
if (($threshold = config('system.cron')->get('threshold.autorun')) > 0 && variable_get('install_task') == 'done') {
- $cron_last = state()->get('system.cron_last') ?: NULL;
+ $cron_last = Drupal::state()->get('system.cron_last') ?: NULL;
if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) {
drupal_cron_run();
}
diff --git a/core/modules/system/tests/modules/batch_test/batch_test.module b/core/modules/system/tests/modules/batch_test/batch_test.module
index a5f2995..85ee47c 100644
--- a/core/modules/system/tests/modules/batch_test/batch_test.module
+++ b/core/modules/system/tests/modules/batch_test/batch_test.module
@@ -527,12 +527,12 @@ function _batch_test_theme_callback() {
*/
function batch_test_stack($data = NULL, $reset = FALSE) {
if ($reset) {
- state()->delete('batch_test.stack');
+ Drupal::state()->delete('batch_test.stack');
}
if (!isset($data)) {
- return state()->get('batch_test.stack');
+ return Drupal::state()->get('batch_test.stack');
}
- $stack = state()->get('batch_test.stack');
+ $stack = Drupal::state()->get('batch_test.stack');
$stack[] = $data;
- state()->set('batch_test.stack', $stack);
+ Drupal::state()->set('batch_test.stack', $stack);
}
diff --git a/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module
index e2154ed..ef3ac88 100644
--- a/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module
+++ b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module
@@ -14,5 +14,5 @@
* @see common_test_cron()
*/
function common_test_cron_helper_cron() {
- state()->set('common_test.cron', 'success');
+ Drupal::state()->set('common_test.cron', 'success');
}
diff --git a/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module
index 6f23ebb..962114c 100644
--- a/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module
+++ b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module
@@ -21,6 +21,6 @@ function entity_cache_test_watchdog($log_entry) {
$info = entity_get_info('entity_cache_test');
// Store the information in a system variable to analyze it later in the
// test case.
- state()->set('entity_cache_test', $info);
+ Drupal::state()->set('entity_cache_test', $info);
}
}
diff --git a/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
index 392a03b..f2e9873 100644
--- a/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
+++ b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module
@@ -9,5 +9,5 @@
* Implements hook_entity_info_alter().
*/
function entity_cache_test_dependency_entity_info_alter(&$info) {
- $info['entity_cache_test']['label'] = state()->get('entity_cache_test.label') ?: 'Entity Cache Test';
+ $info['entity_cache_test']['label'] = Drupal::state()->get('entity_cache_test.label') ?: 'Entity Cache Test';
}
diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module
index 80f1b39..f5959a3 100644
--- a/core/modules/system/tests/modules/entity_test/entity_test.module
+++ b/core/modules/system/tests/modules/entity_test/entity_test.module
@@ -56,7 +56,7 @@ function entity_test_entity_types($filter = NULL) {
*/
function entity_test_entity_info_alter(&$info) {
// Optionally specify a translation handler for testing translations.
- if (state()->get('entity_test.translation')) {
+ if (Drupal::state()->get('entity_test.translation')) {
foreach(entity_test_entity_types() as $entity_type) {
$info[$entity_type]['translation'][$entity_type] = TRUE;
}
@@ -147,7 +147,7 @@ function entity_test_menu() {
*/
function entity_test_form_node_form_alter(&$form, &$form_state, $form_id) {
$langcode = $form_state['controller']->getFormLangcode($form_state);
- state()->set('entity_test.form_langcode', $langcode);
+ Drupal::state()->set('entity_test.form_langcode', $langcode);
}
/**
diff --git a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/system/imagetoolkit/TestToolkit.php b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/system/imagetoolkit/TestToolkit.php
index b2634ac..0ca00e1 100644
--- a/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/system/imagetoolkit/TestToolkit.php
+++ b/core/modules/system/tests/modules/image_test/lib/Drupal/image_test/Plugin/system/imagetoolkit/TestToolkit.php
@@ -106,9 +106,9 @@ public function desaturate($image) {
* @see \Drupal\system\Tests\Image\ToolkitTestBase::imageTestGetAllCalls()
*/
protected function logCall($op, $args) {
- $results = state()->get('image_test.results') ?: array();
+ $results = \Drupal::state()->get('image_test.results') ?: array();
$results[$op][] = $args;
- state()->set('image_test.results', $results);
+ \Drupal::state()->set('image_test.results', $results);
}
/**
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module
index 8a1aac4..6405a03 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.module
+++ b/core/modules/system/tests/modules/menu_test/menu_test.module
@@ -492,7 +492,7 @@ function menu_test_callback() {
* Callback that test menu_test_menu_tree_set_path().
*/
function menu_test_menu_trail_callback() {
- $menu_path = state()->get('menu_test.menu_tree_set_path') ?: array();
+ $menu_path = Drupal::state()->get('menu_test.menu_tree_set_path') ?: array();
if (!empty($menu_path)) {
menu_tree_set_path($menu_path['menu_name'], $menu_path['path']);
}
@@ -506,8 +506,8 @@ function menu_test_init() {
// When requested by one of the MenuTrailTestCase tests, record the initial
// active trail during Drupal's bootstrap (before the user is redirected to a
// custom 403 or 404 page). See menu_test_custom_403_404_callback().
- if (state()->get('menu_test.record_active_trail') ?: FALSE) {
- state()->set('menu_test.active_trail_initial', menu_get_active_trail());
+ if (Drupal::state()->get('menu_test.record_active_trail') ?: FALSE) {
+ Drupal::state()->set('menu_test.active_trail_initial', menu_get_active_trail());
}
}
@@ -518,8 +518,8 @@ function menu_test_custom_403_404_callback() {
// When requested by one of the MenuTrailTestCase tests, record the final
// active trail now that the user has been redirected to the custom 403 or
// 404 page. See menu_test_init().
- if (state()->get('menu_test.record_active_trail') ?: FALSE) {
- state()->set('menu_test.active_trail_final', menu_get_active_trail());
+ if (Drupal::state()->get('menu_test.record_active_trail') ?: FALSE) {
+ Drupal::state()->set('menu_test.active_trail_final', menu_get_active_trail());
}
return 'This is menu_test_custom_403_404_callback().';
@@ -585,7 +585,7 @@ function menu_test_custom_theme() {
// If an appropriate variable has been set in the database, request the theme
// that is stored there. Otherwise, do not attempt to dynamically set the
// theme.
- if ($theme = state()->get('menu_test.hook_custom_theme_name') ?: FALSE) {
+ if ($theme = Drupal::state()->get('menu_test.hook_custom_theme_name') ?: FALSE) {
return $theme;
}
}
diff --git a/core/modules/system/tests/modules/module_test/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module
index 1d35ea9..39caf92 100644
--- a/core/modules/system/tests/modules/module_test/module_test.module
+++ b/core/modules/system/tests/modules/module_test/module_test.module
@@ -15,7 +15,7 @@ function module_test_permission() {
* Manipulate module dependencies to test dependency chains.
*/
function module_test_system_info_alter(&$info, $file, $type) {
- if (state()->get('module_test.dependency') == 'missing dependency') {
+ if (Drupal::state()->get('module_test.dependency') == 'missing dependency') {
if ($file->name == 'forum') {
// Make forum module depend on ban.
$info['dependencies'][] = 'ban';
@@ -25,7 +25,7 @@ function module_test_system_info_alter(&$info, $file, $type) {
$info['dependencies'][] = 'foo';
}
}
- elseif (state()->get('module_test.dependency') == 'dependency') {
+ elseif (Drupal::state()->get('module_test.dependency') == 'dependency') {
if ($file->name == 'forum') {
// Make the forum module depend on ban.
$info['dependencies'][] = 'ban';
@@ -35,7 +35,7 @@ function module_test_system_info_alter(&$info, $file, $type) {
$info['dependencies'][] = 'php';
}
}
- elseif (state()->get('module_test.dependency') == 'version dependency') {
+ elseif (Drupal::state()->get('module_test.dependency') == 'version dependency') {
if ($file->name == 'forum') {
// Make the forum module depend on ban.
$info['dependencies'][] = 'ban';
@@ -155,7 +155,7 @@ function module_test_class_loading() {
function module_test_modules_enabled($modules) {
// Record the ordered list of modules that were passed in to this hook so we
// can check that the modules were enabled in the correct sequence.
- state()->set('system_test.module_enable_order', $modules);
+ Drupal::state()->set('system_test.module_enable_order', $modules);
}
/**
@@ -164,7 +164,7 @@ function module_test_modules_enabled($modules) {
function module_test_modules_disabled($modules) {
// Record the ordered list of modules that were passed in to this hook so we
// can check that the modules were disabled in the correct sequence.
- state()->set('module_test.disable_order', $modules);
+ Drupal::state()->set('module_test.disable_order', $modules);
}
/**
@@ -173,5 +173,5 @@ function module_test_modules_disabled($modules) {
function module_test_modules_uninstalled($modules) {
// Record the ordered list of modules that were passed in to this hook so we
// can check that the modules were uninstalled in the correct sequence.
- state()->set('module_test.uninstall_order', $modules);
+ Drupal::state()->set('module_test.uninstall_order', $modules);
}
diff --git a/core/modules/system/tests/modules/path_test/path_test.module b/core/modules/system/tests/modules/path_test/path_test.module
index dd70498..6f4d580 100644
--- a/core/modules/system/tests/modules/path_test/path_test.module
+++ b/core/modules/system/tests/modules/path_test/path_test.module
@@ -9,14 +9,14 @@
* Resets the path test results.
*/
function path_test_reset() {
- state()->set('path_test.results', array());
+ Drupal::state()->set('path_test.results', array());
}
/**
* Implements hook_path_update().
*/
function path_test_path_update($path) {
- $results = state()->get('path_test.results') ?: array();
+ $results = Drupal::state()->get('path_test.results') ?: array();
$results['hook_path_update'] = $path;
- state()->set('path_test.results', $results);
+ Drupal::state()->set('path_test.results', $results);
}
diff --git a/core/modules/system/tests/modules/system_test/system_test.module b/core/modules/system/tests/modules/system_test/system_test.module
index 4494299..55c0b9e 100644
--- a/core/modules/system/tests/modules/system_test/system_test.module
+++ b/core/modules/system/tests/modules/system_test/system_test.module
@@ -177,7 +177,7 @@ function system_test_redirect_invalid_scheme() {
* Implements hook_modules_installed().
*/
function system_test_modules_installed($modules) {
- if (state()->get('system_test.verbose_module_hooks')) {
+ if (Drupal::state()->get('system_test.verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_installed fired for @module', array('@module' => $module)));
}
@@ -188,7 +188,7 @@ function system_test_modules_installed($modules) {
* Implements hook_modules_enabled().
*/
function system_test_modules_enabled($modules) {
- if (state()->get('system_test.verbose_module_hooks')) {
+ if (Drupal::state()->get('system_test.verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_enabled fired for @module', array('@module' => $module)));
}
@@ -199,7 +199,7 @@ function system_test_modules_enabled($modules) {
* Implements hook_modules_disabled().
*/
function system_test_modules_disabled($modules) {
- if (state()->get('system_test.verbose_module_hooks')) {
+ if (Drupal::state()->get('system_test.verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_disabled fired for @module', array('@module' => $module)));
}
@@ -210,7 +210,7 @@ function system_test_modules_disabled($modules) {
* Implements hook_modules_uninstalled().
*/
function system_test_modules_uninstalled($modules) {
- if (state()->get('system_test.verbose_module_hooks')) {
+ if (Drupal::state()->get('system_test.verbose_module_hooks')) {
foreach ($modules as $module) {
drupal_set_message(t('hook_modules_uninstalled fired for @module', array('@module' => $module)));
}
@@ -222,7 +222,7 @@ function system_test_modules_uninstalled($modules) {
*/
function system_test_init() {
// Used by FrontPageTestCase to get the results of drupal_is_front_page().
- $frontpage = state()->get('system_test.front_page_output') ?: 0;
+ $frontpage = Drupal::state()->get('system_test.front_page_output') ?: 0;
if ($frontpage && drupal_is_front_page()) {
drupal_set_message(t('On front page.'));
}
@@ -241,11 +241,11 @@ function system_test_exit() {
function system_test_system_info_alter(&$info, $file, $type) {
// We need a static otherwise the last test will fail to alter common_test.
static $test;
- if (($dependencies = state()->get('system_test.dependencies')) || $test) {
+ if (($dependencies = Drupal::state()->get('system_test.dependencies')) || $test) {
if ($file->name == 'module_test') {
$info['hidden'] = FALSE;
$info['dependencies'][] = array_shift($dependencies);
- state()->set('system_test.dependencies', $dependencies);
+ Drupal::state()->set('system_test.dependencies', $dependencies);
$test = TRUE;
}
if ($file->name == 'common_test') {
diff --git a/core/modules/system/tests/modules/update_test_1/update_test_1.install b/core/modules/system/tests/modules/update_test_1/update_test_1.install
index bf0beb3..3ac73db 100644
--- a/core/modules/system/tests/modules/update_test_1/update_test_1.install
+++ b/core/modules/system/tests/modules/update_test_1/update_test_1.install
@@ -11,7 +11,7 @@
* @see update_test_2_update_dependencies()
*/
function update_test_1_update_dependencies() {
- state()->set('update_test_1_update_dependencies_run', TRUE);
+ Drupal::state()->set('update_test_1_update_dependencies_run', TRUE);
// These dependencies are used in combination with those declared in
// update_test_2_update_dependencies() for the sole purpose of testing that
// the results of hook_update_dependencies() are collected correctly and have
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
index 1aa144e..68ed3ba 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerNodeAccessTest.php
@@ -35,7 +35,7 @@ public static function getInfo() {
public function setUp() {
parent::setUp();
node_access_rebuild();
- state()->set('node_access_test.private', TRUE);
+ \Drupal::state()->set('node_access_test.private', TRUE);
}
/**
diff --git a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
index 0e7c429..7934c8c 100644
--- a/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
+++ b/core/modules/tracker/lib/Drupal/tracker/Tests/TrackerTest.php
@@ -221,7 +221,7 @@ function testTrackerCronIndexing() {
$this->drupalPost('comment/reply/' . $nodes[3]->nid, $comment, t('Save'));
// Start indexing backwards from node 3.
- state()->set('tracker.index_nid', 3);
+ \Drupal::state()->set('tracker.index_nid', 3);
// Clear the current tracker tables and rebuild them.
db_delete('tracker_node')
diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install
index 429b88e..841d74a 100644
--- a/core/modules/tracker/tracker.install
+++ b/core/modules/tracker/tracker.install
@@ -9,7 +9,7 @@
* Implements hook_uninstall().
*/
function tracker_uninstall() {
- state()->delete('tracker.index_nid');
+ Drupal::state()->delete('tracker.index_nid');
}
/**
@@ -18,7 +18,7 @@ function tracker_uninstall() {
function tracker_enable() {
$max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField();
if ($max_nid != 0) {
- state()->set('tracker.index_nid', $max_nid);
+ Drupal::state()->set('tracker.index_nid', $max_nid);
// To avoid timing out while attempting to do a complete indexing, we
// simply call our cron job to remove stale records and begin the process.
tracker_cron();
diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module
index 125b5da..b0cb9f8 100644
--- a/core/modules/tracker/tracker.module
+++ b/core/modules/tracker/tracker.module
@@ -79,7 +79,7 @@ function tracker_menu() {
* process, 'tracker.index_nid' will be 0.
*/
function tracker_cron() {
- $state = state();
+ $state = Drupal::state();
$max_nid = $state->get('tracker.index_nid') ?: 0;
if ($max_nid > 0) {
$batch_size = config('tracker.settings')->get('cron_index_limit');
diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc
index 0ce01b1..39f3a9d 100644
--- a/core/modules/update/update.fetch.inc
+++ b/core/modules/update/update.fetch.inc
@@ -184,7 +184,7 @@ function _update_process_fetch_task($project) {
Drupal::keyValueExpirable('update')->setWithExpire('fetch_failures', $fail, $request_time_difference + (60 * 5));
// Whether this worked or not, we did just (try to) check for updates.
- state()->set('update.last_check', REQUEST_TIME + $request_time_difference);
+ Drupal::state()->set('update.last_check', REQUEST_TIME + $request_time_difference);
// Now that we processed the fetch task for this project, clear out the
// record for this task so we're willing to fetch again.
@@ -359,7 +359,7 @@ function _update_cron_notify() {
// Track when the last mail was successfully sent to avoid sending
// too many e-mails.
if ($message['result']) {
- state()->set('update.last_email_notification', REQUEST_TIME);
+ Drupal::state()->set('update.last_email_notification', REQUEST_TIME);
}
}
}
diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc
index 0047a52..96590e0 100644
--- a/core/modules/update/update.manager.inc
+++ b/core/modules/update/update.manager.inc
@@ -278,7 +278,7 @@ function update_manager_update_form($form, $form_state = array(), $context) {
*/
function theme_update_manager_update_form($variables) {
$form = $variables['form'];
- $last = state()->get('update.last_check') ?: 0;
+ $last = Drupal::state()->get('update.last_check') ?: 0;
$output = theme('update_last_check', array('last' => $last));
$output .= drupal_render_children($form);
return $output;
diff --git a/core/modules/update/update.module b/core/modules/update/update.module
index 7dee311..ec14858 100644
--- a/core/modules/update/update.module
+++ b/core/modules/update/update.module
@@ -283,7 +283,7 @@ function update_cron() {
$update_config = config('update.settings');
$frequency = $update_config->get('check.interval_days');
$interval = 60 * 60 * 24 * $frequency;
- $last_check = state()->get('update.last_check') ?: 0;
+ $last_check = Drupal::state()->get('update.last_check') ?: 0;
if ((REQUEST_TIME - $last_check) > $interval) {
// If the configured update interval has elapsed, we want to invalidate
// the data for all projects, attempt to re-fetch, and trigger any
@@ -296,7 +296,7 @@ function update_cron() {
// missing data, and if so, try to fetch the data.
update_get_available(TRUE);
}
- $last_email_notice = state()->get('update.last_email_notification') ?: 0;
+ $last_email_notice = Drupal::state()->get('update.last_email_notification') ?: 0;
if ((REQUEST_TIME - $last_email_notice) > $interval) {
// If configured time between notifications elapsed, send email about
// updates possibly available.
diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc
index 607b523..7a79394 100644
--- a/core/modules/update/update.report.inc
+++ b/core/modules/update/update.report.inc
@@ -33,7 +33,7 @@ function update_status() {
function theme_update_report($variables) {
$data = $variables['data'];
- $last = state()->get('update.last_check') ?: 0;
+ $last = Drupal::state()->get('update.last_check') ?: 0;
$output = theme('update_last_check', array('last' => $last));
if (!is_array($data)) {
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
index b4c5118..1c37da9 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/AccessTest.php
@@ -101,8 +101,8 @@ function testDynamicAccessPlugin() {
$view->setDisplay();
$argument1 = $this->randomName();
$argument2 = $this->randomName();
- state()->set('test_dynamic_access_argument1', $argument1);
- state()->set('test_dynamic_access_argument2', $argument2);
+ \Drupal::state()->set('test_dynamic_access_argument1', $argument1);
+ \Drupal::state()->set('test_dynamic_access_argument2', $argument2);
$access_plugin = $view->display_handler->getPlugin('access');
diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayAttachmentTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayAttachmentTest.php
index 3f21b88..eb1894e 100644
--- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayAttachmentTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayAttachmentTest.php
@@ -41,7 +41,7 @@ protected function setUp() {
*/
protected function testAttachment() {
// @todo Remove that once http://drupal.org/node/1828444 got in.
- state()->set('menu_rebuild_needed', TRUE);
+ \Drupal::state()->set('menu_rebuild_needed', TRUE);
$this->drupalGet('test-display-attachment');
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewRenderTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewRenderTest.php
index d70468b..04ea163 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewRenderTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewRenderTest.php
@@ -37,13 +37,13 @@ protected function setUp() {
* Tests render functionality.
*/
public function testRender() {
- state()->set('views_render.test', 0);
+ \Drupal::state()->set('views_render.test', 0);
// Make sure that the rendering just calls the preprocess function once.
$view = views_get_view('test_view_render');
$view->preview();
- $this->assertEqual(state()->get('views_render.test'), 1);
+ $this->assertEqual(\Drupal::state()->get('views_render.test'), 1);
}
}
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
index 93685aa..23b1332 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewTestBase.php
@@ -42,8 +42,8 @@ protected function setUp() {
*/
protected function enableViewsTestModule() {
// Define the schema and views data variable before enabling the test module.
- state()->set('views_test_data_schema', $this->schemaDefinition());
- state()->set('views_test_data_views_data', $this->viewsData());
+ \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition());
+ \Drupal::state()->set('views_test_data_views_data', $this->viewsData());
module_enable(array('views_test_data'));
$this->resetAll();
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php
index 80b659c..6994b8b 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewUnitTestBase.php
@@ -45,8 +45,8 @@ protected function setUp() {
*/
protected function setUpFixtures() {
// Define the schema and views data variable before enabling the test module.
- state()->set('views_test_data_schema', $this->schemaDefinition());
- state()->set('views_test_data_views_data', $this->viewsData());
+ \Drupal::state()->set('views_test_data_schema', $this->schemaDefinition());
+ \Drupal::state()->set('views_test_data_views_data', $this->viewsData());
$this->installConfig(array('views', 'views_test_config', 'views_test_data'));
foreach ($this->schemaDefinition() as $table => $schema) {
diff --git a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/access/DynamicTest.php b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/access/DynamicTest.php
index b153c93..9fed163 100644
--- a/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/access/DynamicTest.php
+++ b/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/access/DynamicTest.php
@@ -30,7 +30,7 @@ protected function defineOptions() {
}
public function access($account) {
- return !empty($this->options['access']) && isset($this->view->args[0]) && $this->view->args[0] == state()->get('test_dynamic_access_argument1') && isset($this->view->args[1]) && $this->view->args[1] == state()->get('test_dynamic_access_argument2');
+ return !empty($this->options['access']) && isset($this->view->args[0]) && $this->view->args[0] == \Drupal::state()->get('test_dynamic_access_argument1') && isset($this->view->args[1]) && $this->view->args[1] == \Drupal::state()->get('test_dynamic_access_argument2');
}
function get_access_callback() {
diff --git a/core/modules/views/tests/views_test_data/views_test_data.install b/core/modules/views/tests/views_test_data/views_test_data.install
index 520796d..6b1a868 100644
--- a/core/modules/views/tests/views_test_data/views_test_data.install
+++ b/core/modules/views/tests/views_test_data/views_test_data.install
@@ -9,7 +9,7 @@
* Implements hook_schema().
*/
function views_test_data_schema() {
- return state()->get('views_test_data_schema');
+ return Drupal::state()->get('views_test_data_schema');
}
/**
diff --git a/core/modules/views/tests/views_test_data/views_test_data.module b/core/modules/views/tests/views_test_data/views_test_data.module
index 40467c6..0412396 100644
--- a/core/modules/views/tests/views_test_data/views_test_data.module
+++ b/core/modules/views/tests/views_test_data/views_test_data.module
@@ -24,7 +24,7 @@ function views_test_data_test_static_access_callback($access) {
}
function views_test_data_test_dynamic_access_callback($access, $argument1, $argument2) {
- return $access && $argument1 == state()->get('test_dynamic_access_argument1') && $argument2 == state()->get('test_dynamic_access_argument2');
+ return $access && $argument1 == Drupal::state()->get('test_dynamic_access_argument1') && $argument2 == Drupal::state()->get('test_dynamic_access_argument2');
}
/**
@@ -85,9 +85,9 @@ function views_test_data_views_pre_render(ViewExecutable $view) {
*/
function views_test_data_preprocess_views_view_table(&$variables) {
if ($variables['view']->storage->id() == 'test_view_render') {
- $views_render_test = state()->get('views_render.test');
+ $views_render_test = Drupal::state()->get('views_render.test');
$views_render_test++;
- state()->set('views_render.test', $views_render_test);
+ Drupal::state()->set('views_render.test', $views_render_test);
}
}
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index f1cb911..e765bbb 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -685,7 +685,7 @@ function views_invalidate_cache() {
Cache::deleteTags(array('content' => TRUE));
// Set the menu as needed to be rebuilt.
- state()->set('menu_rebuild_needed', TRUE);
+ Drupal::state()->set('menu_rebuild_needed', TRUE);
// Invalidate the block cache to update views block derivatives.
if (module_exists('block')) {
diff --git a/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcMessagesTest.php b/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcMessagesTest.php
index d4ba19a..637d7a2 100644
--- a/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcMessagesTest.php
+++ b/core/modules/xmlrpc/lib/Drupal/xmlrpc/Tests/XmlRpcMessagesTest.php
@@ -48,12 +48,12 @@ function testSizedMessages() {
*/
protected function testAlterListMethods() {
// Ensure xmlrpc_test.alter() is disabled and retrieve regular list of methods.
- state()->set('xmlrpc_test.alter', FALSE);
+ \Drupal::state()->set('xmlrpc_test.alter', FALSE);
$url = url('xmlrpc.php', array('absolute' => TRUE));
$methods1 = xmlrpc($url, array('system.listMethods' => array()));
// Enable the alter hook and retrieve the list of methods again.
- state()->set('xmlrpc_test.alter', TRUE);
+ \Drupal::state()->set('xmlrpc_test.alter', TRUE);
$methods2 = xmlrpc($url, array('system.listMethods' => array()));
$diff = array_diff($methods1, $methods2);
diff --git a/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module b/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module
index 11c86c3..4a772ab 100644
--- a/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module
+++ b/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module
@@ -68,7 +68,7 @@ function xmlrpc_test_xmlrpc() {
* Hide (or not) the system.methodSignature() service depending on a variable.
*/
function xmlrpc_test_xmlrpc_alter(&$services) {
- $xmlprc_alter = state()->get('xmlrpc_test.alter') ?: FALSE;
+ $xmlprc_alter = Drupal::state()->get('xmlrpc_test.alter') ?: FALSE;
if ($xmlprc_alter) {
$remove = NULL;
foreach ($services as $key => $value) {