Marked-up:
You can only find truth with logic if you have already found truth without it.
@@ -72,48 +72,48 @@ class TwigFilterTest extends WebTestBase {
',
'message' => '"Marked-up quote" was successfully rendered.',
- ),
- array(
+ ],
+ [
'expected' => '
All attributes:
',
'message' => 'All attributes printed.',
- ),
- array(
+ ],
+ [
'expected' => '
Class attributes in front, remainder at the back:
',
'message' => 'Class attributes printed in the front, the rest in the back.',
- ),
- array(
+ ],
+ [
'expected' => '
Class attributes in back, remainder at the front:
',
'message' => 'Class attributes printed in the back, the rest in the front.',
- ),
- array(
+ ],
+ [
'expected' => '
Class attributes only:
',
'message' => 'Class attributes only printed.',
- ),
- array(
+ ],
+ [
'expected' => '
Without boolean attribute.
',
'message' => 'Boolean attribute printed in the front.',
- ),
- array(
+ ],
+ [
'expected' => '
Without string attribute.
',
'message' => 'Without string attribute in the front.',
- ),
- array(
+ ],
+ [
'expected' => '
Without id and class attributes.
',
'message' => 'Attributes printed without id and class attributes.',
- ),
- array(
+ ],
+ [
'expected' => '
All attributes again.
',
'message' => 'All attributes printed again.',
- ),
- array(
+ ],
+ [
'expected' => '
ID and class. Having the same ID twice is not valid markup but we want to make sure the filter doesn\'t use \Drupal\Component\Utility\Html::getUniqueId().
',
'message' => 'Class and ID filtered.',
- ),
- array(
+ ],
+ [
'expected' => '
Rendered author string length: 24.
',
'message' => 'Render filter string\'s length.',
- ),
- );
+ ],
+ ];
foreach ($elements as $element) {
$this->assertRaw($element['expected'], $element['message']);
diff --git a/web/core/modules/system/src/Tests/Theme/TwigNamespaceTest.php b/web/core/modules/system/src/Tests/Theme/TwigNamespaceTest.php
index 27a54d179..ab62889b9 100644
--- a/web/core/modules/system/src/Tests/Theme/TwigNamespaceTest.php
+++ b/web/core/modules/system/src/Tests/Theme/TwigNamespaceTest.php
@@ -16,7 +16,7 @@ class TwigNamespaceTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('twig_theme_test', 'twig_namespace_a', 'twig_namespace_b', 'node');
+ public static $modules = ['twig_theme_test', 'twig_namespace_a', 'twig_namespace_b', 'node'];
/**
* @var \Drupal\Core\Template\TwigEnvironment
@@ -25,7 +25,7 @@ class TwigNamespaceTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- \Drupal::service('theme_handler')->install(array('test_theme', 'bartik'));
+ \Drupal::service('theme_handler')->install(['test_theme', 'bartik']);
$this->twig = \Drupal::service('twig');
}
@@ -52,7 +52,7 @@ class TwigNamespaceTest extends WebTestBase {
*/
public function testTwigNamespaces() {
// Test twig @extends and @include in template files.
- $test = array('#theme' => 'twig_namespace_test');
+ $test = ['#theme' => 'twig_namespace_test'];
$this->setRawContent(\Drupal::service('renderer')->renderRoot($test));
$this->assertText('This line is from twig_namespace_a/templates/test.html.twig');
diff --git a/web/core/modules/system/src/Tests/Theme/TwigRawTest.php b/web/core/modules/system/src/Tests/Theme/TwigRawTest.php
index 80afb8eaf..8be63dbb5 100644
--- a/web/core/modules/system/src/Tests/Theme/TwigRawTest.php
+++ b/web/core/modules/system/src/Tests/Theme/TwigRawTest.php
@@ -16,16 +16,16 @@ class TwigRawTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('twig_theme_test');
+ public static $modules = ['twig_theme_test'];
/**
* Tests the raw filter inside an autoescape tag.
*/
public function testAutoescapeRaw() {
- $test = array(
+ $test = [
'#theme' => 'twig_raw_test',
'#script' => '',
- );
+ ];
$rendered = \Drupal::service('renderer')->renderRoot($test);
$this->setRawContent($rendered);
$this->assertRaw('');
diff --git a/web/core/modules/system/src/Tests/Theme/TwigTransTest.php b/web/core/modules/system/src/Tests/Theme/TwigTransTest.php
index 9daf6a01b..b73cdaf0c 100644
--- a/web/core/modules/system/src/Tests/Theme/TwigTransTest.php
+++ b/web/core/modules/system/src/Tests/Theme/TwigTransTest.php
@@ -17,12 +17,12 @@ class TwigTransTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array(
+ public static $modules = [
'theme_test',
'twig_theme_test',
'locale',
'language'
- );
+ ];
/**
* An administrative user for testing.
@@ -36,10 +36,10 @@ class TwigTransTest extends WebTestBase {
*
* @var array
*/
- protected $languages = array(
+ protected $languages = [
'xx' => 'Lolspeak',
'zz' => 'Lolspeak2',
- );
+ ];
/**
* {@inheritdoc}
@@ -48,16 +48,16 @@ class TwigTransTest extends WebTestBase {
parent::setUp();
// Setup test_theme.
- \Drupal::service('theme_handler')->install(array('test_theme'));
- \Drupal::service('theme_handler')->setDefault('test_theme');
+ \Drupal::service('theme_handler')->install(['test_theme']);
+ $this->config('system.theme')->set('default', 'test_theme')->save();
// Create and log in as admin.
- $this->adminUser = $this->drupalCreateUser(array(
+ $this->adminUser = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'administer site configuration',
'translate interface'
- ));
+ ]);
$this->drupalLogin($this->adminUser);
// Install languages.
@@ -77,7 +77,7 @@ class TwigTransTest extends WebTestBase {
public function testTwigTransTags() {
// Run this once without and once with Twig debug because trans can work
// differently depending on that setting.
- $this->drupalGet('twig-theme-test/trans', array('language' => \Drupal::languageManager()->getLanguage('xx')));
+ $this->drupalGet('twig-theme-test/trans', ['language' => \Drupal::languageManager()->getLanguage('xx')]);
$this->assertTwigTransTags();
// Enable debug, rebuild the service container, and clear all caches.
@@ -87,7 +87,7 @@ class TwigTransTest extends WebTestBase {
$this->rebuildContainer();
$this->resetAll();
- $this->drupalGet('twig-theme-test/trans', array('language' => \Drupal::languageManager()->getLanguage('xx')));
+ $this->drupalGet('twig-theme-test/trans', ['language' => \Drupal::languageManager()->getLanguage('xx')]);
$this->assertTwigTransTags();
}
@@ -197,12 +197,12 @@ class TwigTransTest extends WebTestBase {
$contents = $this->poFileContents($langcode);
if ($contents) {
// Add test language for translation testing.
- $edit = array(
+ $edit = [
'predefined_langcode' => 'custom',
'langcode' => $langcode,
'label' => $name,
'direction' => LanguageInterface::DIRECTION_LTR,
- );
+ ];
// Install the language in Drupal.
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language'));
@@ -211,11 +211,11 @@ class TwigTransTest extends WebTestBase {
// Import the custom .po contents for the language.
$filename = \Drupal::service('file_system')->tempnam('temporary://', "po_") . '.po';
file_put_contents($filename, $contents);
- $options = array(
+ $options = [
'files[file]' => $filename,
'langcode' => $langcode,
'customized' => TRUE,
- );
+ ];
$this->drupalPostForm('admin/config/regional/translate/import', $options, t('Import'));
drupal_unlink($filename);
}
diff --git a/web/core/modules/system/src/Tests/Update/DependencyHookInvocationTest.php b/web/core/modules/system/src/Tests/Update/DependencyHookInvocationTest.php
index a9723c235..ef22f0e1b 100644
--- a/web/core/modules/system/src/Tests/Update/DependencyHookInvocationTest.php
+++ b/web/core/modules/system/src/Tests/Update/DependencyHookInvocationTest.php
@@ -17,7 +17,7 @@ class DependencyHookInvocationTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('update_test_0', 'update_test_1', 'update_test_2');
+ public static $modules = ['update_test_0', 'update_test_1', 'update_test_2'];
protected function setUp() {
parent::setUp();
@@ -27,7 +27,7 @@ class DependencyHookInvocationTest extends WebTestBase {
/**
* Test the structure of the array returned by hook_update_dependencies().
*/
- function testHookUpdateDependencies() {
+ public function testHookUpdateDependencies() {
$update_dependencies = update_retrieve_dependencies();
$this->assertTrue($update_dependencies['update_test_0'][8001]['update_test_1'] == 8001, 'An update function that has a dependency on two separate modules has the first dependency recorded correctly.');
$this->assertTrue($update_dependencies['update_test_0'][8001]['update_test_2'] == 8002, 'An update function that has a dependency on two separate modules has the second dependency recorded correctly.');
diff --git a/web/core/modules/system/src/Tests/Update/DependencyMissingTest.php b/web/core/modules/system/src/Tests/Update/DependencyMissingTest.php
index 9764b4c81..407ef3360 100644
--- a/web/core/modules/system/src/Tests/Update/DependencyMissingTest.php
+++ b/web/core/modules/system/src/Tests/Update/DependencyMissingTest.php
@@ -16,7 +16,7 @@ class DependencyMissingTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('update_test_0', 'update_test_2');
+ public static $modules = ['update_test_0', 'update_test_2'];
protected function setUp() {
// Only install update_test_2.module, even though its updates have a
@@ -25,10 +25,10 @@ class DependencyMissingTest extends WebTestBase {
require_once \Drupal::root() . '/core/includes/update.inc';
}
- function testMissingUpdate() {
- $starting_updates = array(
+ public function testMissingUpdate() {
+ $starting_updates = [
'update_test_2' => 8001,
- );
+ ];
$update_graph = update_resolve_dependencies($starting_updates);
$this->assertTrue($update_graph['update_test_2_update_8001']['allowed'], "The module's first update function is allowed to run, since it does not have any missing dependencies.");
$this->assertFalse($update_graph['update_test_2_update_8002']['allowed'], "The module's second update function is not allowed to run, since it has a direct dependency on a missing update.");
diff --git a/web/core/modules/system/src/Tests/Update/DependencyOrderingTest.php b/web/core/modules/system/src/Tests/Update/DependencyOrderingTest.php
index bb3ae3717..8616fb6ba 100644
--- a/web/core/modules/system/src/Tests/Update/DependencyOrderingTest.php
+++ b/web/core/modules/system/src/Tests/Update/DependencyOrderingTest.php
@@ -16,7 +16,7 @@ class DependencyOrderingTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('update_test_0', 'update_test_1', 'update_test_2', 'update_test_3');
+ public static $modules = ['update_test_0', 'update_test_1', 'update_test_2', 'update_test_3'];
protected function setUp() {
parent::setUp();
@@ -26,15 +26,15 @@ class DependencyOrderingTest extends WebTestBase {
/**
* Test that updates within a single module run in the correct order.
*/
- function testUpdateOrderingSingleModule() {
- $starting_updates = array(
+ public function testUpdateOrderingSingleModule() {
+ $starting_updates = [
'update_test_1' => 8001,
- );
- $expected_updates = array(
+ ];
+ $expected_updates = [
'update_test_1_update_8001',
'update_test_1_update_8002',
'update_test_1_update_8003',
- );
+ ];
$actual_updates = array_keys(update_resolve_dependencies($starting_updates));
$this->assertEqual($expected_updates, $actual_updates, 'Updates within a single module run in the correct order.');
}
@@ -42,11 +42,11 @@ class DependencyOrderingTest extends WebTestBase {
/**
* Test that dependencies between modules are resolved correctly.
*/
- function testUpdateOrderingModuleInterdependency() {
- $starting_updates = array(
+ public function testUpdateOrderingModuleInterdependency() {
+ $starting_updates = [
'update_test_2' => 8001,
'update_test_3' => 8001,
- );
+ ];
$update_order = array_keys(update_resolve_dependencies($starting_updates));
// Make sure that each dependency is satisfied.
$first_dependency_satisfied = array_search('update_test_2_update_8001', $update_order) < array_search('update_test_3_update_8001', $update_order);
diff --git a/web/core/modules/system/src/Tests/Update/InstallProfileSystemInstall8300Test.php b/web/core/modules/system/src/Tests/Update/InstallProfileSystemInstall8300Test.php
new file mode 100644
index 000000000..f0eabd62e
--- /dev/null
+++ b/web/core/modules/system/src/Tests/Update/InstallProfileSystemInstall8300Test.php
@@ -0,0 +1,40 @@
+databaseDumpFiles = [
+ __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
+ ];
+ }
+
+ /**
+ * Ensures that the system_update_8300() runs as expected.
+ */
+ public function testUpdate() {
+ // Ensure the BC layers work and settings.php and configuration is in the
+ // expected state before updating.
+ $this->assertEqual('standard', \Drupal::installProfile());
+ $this->assertEqual('standard', Settings::get('install_profile'), 'The install profile has not been written to settings.php.');
+ $this->assertFalse($this->config('core.extension')->get('profile'), 'The install profile is not present in core.extension configuration.');
+
+ $this->runUpdates();
+ // Confirm that Drupal recognizes this distribution as the current profile.
+ $this->assertEqual('standard', \Drupal::installProfile());
+ $this->assertEqual('standard', Settings::get('install_profile'), 'The install profile has not been written to settings.php.');
+ $this->assertEqual('standard', $this->config('core.extension')->get('profile'), 'The install profile has been written to core.extension configuration.');
+ }
+
+}
diff --git a/web/core/modules/system/src/Tests/Update/InvalidUpdateHookTest.php b/web/core/modules/system/src/Tests/Update/InvalidUpdateHookTest.php
index ce5a0066f..59c64f624 100644
--- a/web/core/modules/system/src/Tests/Update/InvalidUpdateHookTest.php
+++ b/web/core/modules/system/src/Tests/Update/InvalidUpdateHookTest.php
@@ -17,7 +17,7 @@ class InvalidUpdateHookTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('update_test_invalid_hook', 'update_script_test', 'dblog');
+ public static $modules = ['update_test_invalid_hook', 'update_script_test', 'dblog'];
/**
* URL for the upgrade script.
@@ -38,10 +38,10 @@ class InvalidUpdateHookTest extends WebTestBase {
require_once \Drupal::root() . '/core/includes/update.inc';
$this->updateUrl = $GLOBALS['base_url'] . '/update.php';
- $this->updateUser = $this->drupalCreateUser(array('administer software updates'));
+ $this->updateUser = $this->drupalCreateUser(['administer software updates']);
}
- function testInvalidUpdateHook() {
+ public function testInvalidUpdateHook() {
// Confirm that a module with hook_update_8000() cannot be updated.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl);
diff --git a/web/core/modules/system/src/Tests/Update/UpdateEntityDisplayTest.php b/web/core/modules/system/src/Tests/Update/UpdateEntityDisplayTest.php
new file mode 100644
index 000000000..0a2cbf45b
--- /dev/null
+++ b/web/core/modules/system/src/Tests/Update/UpdateEntityDisplayTest.php
@@ -0,0 +1,49 @@
+databaseDumpFiles = [
+ __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
+ ];
+ }
+
+ /**
+ * Tests that entity displays are updated with regions for their fields.
+ */
+ public function testUpdate() {
+ // No region key appears pre-update.
+ $entity_form_display = EntityFormDisplay::load('node.article.default');
+ $options = $entity_form_display->getComponent('body');
+ $this->assertFalse(array_key_exists('region', $options));
+
+ $entity_view_display = EntityViewDisplay::load('node.article.default');
+ $options = $entity_view_display->getComponent('body');
+ $this->assertFalse(array_key_exists('region', $options));
+
+ $this->runUpdates();
+
+ // The region key has been populated with 'content'.
+ $entity_form_display = EntityFormDisplay::load('node.article.default');
+ $options = $entity_form_display->getComponent('body');
+ $this->assertIdentical('content', $options['region']);
+
+ $entity_view_display = EntityViewDisplay::load('node.article.default');
+ $options = $entity_view_display->getComponent('body');
+ $this->assertIdentical('content', $options['region']);
+ }
+
+}
diff --git a/web/core/modules/system/src/Tests/Update/UpdatePathRC1TestBaseFilledTest.php b/web/core/modules/system/src/Tests/Update/UpdatePathRC1TestBaseFilledTest.php
index eb95fce6e..09cc586bc 100644
--- a/web/core/modules/system/src/Tests/Update/UpdatePathRC1TestBaseFilledTest.php
+++ b/web/core/modules/system/src/Tests/Update/UpdatePathRC1TestBaseFilledTest.php
@@ -29,13 +29,13 @@ class UpdatePathRC1TestBaseFilledTest extends UpdatePathRC1TestBaseTest {
$spanish = \Drupal::languageManager()->getLanguage('es');
- $expected_node_data = array(
+ $expected_node_data = [
[1, 'article', 'en', 'Test Article - New title'],
[2, 'book', 'en', 'Book page'],
[3, 'forum', 'en', 'Forum topic'],
[4, 'page', 'en', 'Test page'],
[8, 'test_content_type', 'en', 'Test title'],
- );
+ ];
foreach ($expected_node_data as $node_data) {
$id = $node_data[0];
$type = $node_data[1];
diff --git a/web/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/web/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
index 04a0d6b76..f7f88c648 100644
--- a/web/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
+++ b/web/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
@@ -3,7 +3,7 @@
namespace Drupal\system\Tests\Update;
use Drupal\Component\Utility\Crypt;
-use Drupal\config\Tests\SchemaCheckTestTrait;
+use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Core\Database\Database;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Language\Language;
@@ -132,7 +132,7 @@ abstract class UpdatePathTestBase extends WebTestBase {
* (optional) The ID of the test. Tests with the same id are reported
* together.
*/
- function __construct($test_id = NULL) {
+ public function __construct($test_id = NULL) {
parent::__construct($test_id);
$this->zlibInstalled = function_exists('gzopen');
}
@@ -292,7 +292,7 @@ abstract class UpdatePathTestBase extends WebTestBase {
$this->assertFalse($needs_updates, 'After all updates ran, entity schema is up to date.');
if ($needs_updates) {
foreach (\Drupal::entityDefinitionUpdateManager()
- ->getChangeSummary() as $entity_type_id => $summary) {
+ ->getChangeSummary() as $entity_type_id => $summary) {
foreach ($summary as $message) {
$this->fail($message);
}
diff --git a/web/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php b/web/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
index 6edbfe3ae..fe62340af 100644
--- a/web/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
+++ b/web/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
@@ -29,13 +29,13 @@ class UpdatePathTestBaseFilledTest extends UpdatePathTestBaseTest {
$spanish = \Drupal::languageManager()->getLanguage('es');
- $expected_node_data = array(
+ $expected_node_data = [
[1, 'article', 'en', 'Test Article - New title'],
[2, 'book', 'en', 'Book page'],
[3, 'forum', 'en', 'Forum topic'],
[4, 'page', 'en', 'Test page'],
[8, 'test_content_type', 'en', 'Test title'],
- );
+ ];
foreach ($expected_node_data as $node_data) {
$id = $node_data[0];
$type = $node_data[1];
diff --git a/web/core/modules/system/src/Tests/Update/UpdateScriptTest.php b/web/core/modules/system/src/Tests/Update/UpdateScriptTest.php
index b80ef82e3..ed076b815 100644
--- a/web/core/modules/system/src/Tests/Update/UpdateScriptTest.php
+++ b/web/core/modules/system/src/Tests/Update/UpdateScriptTest.php
@@ -18,7 +18,7 @@ class UpdateScriptTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('update_script_test', 'dblog', 'language');
+ public static $modules = ['update_script_test', 'dblog', 'language'];
/**
* {@inheritdoc}
@@ -42,18 +42,18 @@ class UpdateScriptTest extends WebTestBase {
protected function setUp() {
parent::setUp();
$this->updateUrl = Url::fromRoute('system.db_update');
- $this->updateUser = $this->drupalCreateUser(array('administer software updates', 'access site in maintenance mode'));
+ $this->updateUser = $this->drupalCreateUser(['administer software updates', 'access site in maintenance mode']);
\Drupal::service('entity.definition_update_manager')->applyUpdates();
}
/**
* Tests access to the update script.
*/
- function testUpdateAccess() {
+ public function testUpdateAccess() {
// Try accessing update.php without the proper permission.
$regular_user = $this->drupalCreateUser();
$this->drupalLogin($regular_user);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertResponse(403);
// Check that a link to the update page is not accessible to regular users.
@@ -62,7 +62,7 @@ class UpdateScriptTest extends WebTestBase {
// Try accessing update.php as an anonymous user.
$this->drupalLogout();
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertResponse(403);
// Check that a link to the update page is not accessible to anonymous
@@ -72,7 +72,7 @@ class UpdateScriptTest extends WebTestBase {
// Access the update page with the proper permission.
$this->drupalLogin($this->updateUser);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertResponse(200);
// Check that a link to the update page is accessible to users with proper
@@ -82,7 +82,7 @@ class UpdateScriptTest extends WebTestBase {
// Access the update page as user 1.
$this->drupalLogin($this->rootUser);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertResponse(200);
// Check that a link to the update page is accessible to user 1.
@@ -93,13 +93,13 @@ class UpdateScriptTest extends WebTestBase {
/**
* Tests that requirements warnings and errors are correctly displayed.
*/
- function testRequirements() {
+ public function testRequirements() {
$update_script_test_config = $this->config('update_script_test.settings');
$this->drupalLogin($this->updateUser);
// If there are no requirements warnings or errors, we expect to be able to
// go through the update process uninterrupted.
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->assertText(t('No pending updates.'), 'End of update process was reached.');
// Confirm that all caches were cleared.
@@ -113,7 +113,7 @@ class UpdateScriptTest extends WebTestBase {
// successfully.
$update_script_test_config->set('requirement_type', REQUIREMENT_WARNING)->save();
drupal_set_installed_schema_version('update_script_test', drupal_get_installed_schema_version('update_script_test') - 1);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertText('This is a requirements warning provided by the update_script_test module.');
$this->clickLink('try again');
$this->assertNoText('This is a requirements warning provided by the update_script_test module.');
@@ -124,7 +124,7 @@ class UpdateScriptTest extends WebTestBase {
$this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.');
// Now try again without pending updates to make sure that works too.
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertText('This is a requirements warning provided by the update_script_test module.');
$this->clickLink('try again');
$this->assertNoText('This is a requirements warning provided by the update_script_test module.');
@@ -137,7 +137,7 @@ class UpdateScriptTest extends WebTestBase {
// clicking the link to proceed (since the problem that triggered the error
// has not been fixed).
$update_script_test_config->set('requirement_type', REQUIREMENT_ERROR)->save();
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertText('This is a requirements error provided by the update_script_test module.');
$this->clickLink('try again');
$this->assertText('This is a requirements error provided by the update_script_test module.');
@@ -146,7 +146,7 @@ class UpdateScriptTest extends WebTestBase {
/**
* Tests the effect of using the update script on the theme system.
*/
- function testThemeSystem() {
+ public function testThemeSystem() {
// Since visiting update.php triggers a rebuild of the theme system from an
// unusual maintenance mode environment, we check that this rebuild did not
// put any incorrect information about the themes into the database.
@@ -160,10 +160,10 @@ class UpdateScriptTest extends WebTestBase {
/**
* Tests update.php when there are no updates to apply.
*/
- function testNoUpdateFunctionality() {
+ public function testNoUpdateFunctionality() {
// Click through update.php with 'administer software updates' permission.
$this->drupalLogin($this->updateUser);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->assertText(t('No pending updates.'));
$this->assertNoLink('Administration pages');
@@ -172,9 +172,9 @@ class UpdateScriptTest extends WebTestBase {
$this->assertResponse(200);
// Click through update.php with 'access administration pages' permission.
- $admin_user = $this->drupalCreateUser(array('administer software updates', 'access administration pages'));
+ $admin_user = $this->drupalCreateUser(['administer software updates', 'access administration pages']);
$this->drupalLogin($admin_user);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->assertText(t('No pending updates.'));
$this->assertLink('Administration pages');
@@ -186,7 +186,7 @@ class UpdateScriptTest extends WebTestBase {
/**
* Tests update.php after performing a successful update.
*/
- function testSuccessfulUpdateFunctionality() {
+ public function testSuccessfulUpdateFunctionality() {
$initial_maintenance_mode = $this->container->get('state')->get('system.maintenance_mode');
$this->assertFalse($initial_maintenance_mode, 'Site is not in maintenance mode.');
$this->updateScriptTest($initial_maintenance_mode);
@@ -204,9 +204,9 @@ class UpdateScriptTest extends WebTestBase {
// Click through update.php with 'access administration pages' and
// 'access site reports' permissions.
- $admin_user = $this->drupalCreateUser(array('administer software updates', 'access administration pages', 'access site reports', 'access site in maintenance mode'));
+ $admin_user = $this->drupalCreateUser(['administer software updates', 'access administration pages', 'access site reports', 'access site in maintenance mode']);
$this->drupalLogin($admin_user);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->clickLink(t('Apply pending updates'));
$this->assertText('Updates were attempted.');
@@ -220,7 +220,7 @@ class UpdateScriptTest extends WebTestBase {
/**
* Tests update.php while in maintenance mode.
*/
- function testMaintenanceModeUpdateFunctionality() {
+ public function testMaintenanceModeUpdateFunctionality() {
$this->container->get('state')
->set('system.maintenance_mode', TRUE);
$initial_maintenance_mode = $this->container->get('state')
@@ -235,13 +235,13 @@ class UpdateScriptTest extends WebTestBase {
/**
* Tests perfoming updates with update.php in a multilingual environment.
*/
- function testSuccessfulMultilingualUpdateFunctionality() {
+ public function testSuccessfulMultilingualUpdateFunctionality() {
// Add some custom languages.
- foreach (array('aa', 'bb') as $language_code) {
- ConfigurableLanguage::create(array(
+ foreach (['aa', 'bb'] as $language_code) {
+ ConfigurableLanguage::create([
'id' => $language_code,
'label' => $this->randomMachineName(),
- ))->save();
+ ])->save();
}
$config = \Drupal::service('config.factory')->getEditable('language.negotiation');
@@ -261,18 +261,18 @@ class UpdateScriptTest extends WebTestBase {
$this->assertEqual($schema_version, 8000, 'update_script_test schema version overridden to 8000.');
// Create admin user.
- $admin_user = $this->drupalCreateUser(array('administer software updates', 'access administration pages', 'access site reports', 'access site in maintenance mode', 'administer site configuration'));
+ $admin_user = $this->drupalCreateUser(['administer software updates', 'access administration pages', 'access site reports', 'access site in maintenance mode', 'administer site configuration']);
$this->drupalLogin($admin_user);
// Visit status report page and ensure, that link to update.php has no path prefix set.
- $this->drupalGet('en/admin/reports/status', array('external' => TRUE));
+ $this->drupalGet('en/admin/reports/status', ['external' => TRUE]);
$this->assertResponse(200);
$this->assertLinkByHref('/update.php');
$this->assertNoLinkByHref('en/update.php');
// Click through update.php with 'access administration pages' and
// 'access site reports' permissions.
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->clickLink(t('Apply pending updates'));
$this->assertText('Updates were attempted.');
@@ -303,7 +303,7 @@ class UpdateScriptTest extends WebTestBase {
else {
$this->assertNoText('Operating in maintenance mode.');
}
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->clickLink(t('Apply pending updates'));
@@ -330,74 +330,74 @@ class UpdateScriptTest extends WebTestBase {
* Returns the Drupal 7 system table schema.
*/
public function getSystemSchema() {
- return array(
+ return [
'description' => "A list of all modules, themes, and theme engines that are or have been installed in Drupal's file system.",
- 'fields' => array(
- 'filename' => array(
+ 'fields' => [
+ 'filename' => [
'description' => 'The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => 'The name of the item; e.g. node.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
- ),
- 'type' => array(
+ ],
+ 'type' => [
'description' => 'The type of the item, either module, theme, or theme_engine.',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
- ),
- 'owner' => array(
+ ],
+ 'owner' => [
'description' => "A theme's 'parent' . Can be either a theme or an engine.",
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
- ),
- 'status' => array(
+ ],
+ 'status' => [
'description' => 'Boolean indicating whether or not this item is enabled.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- ),
- 'bootstrap' => array(
+ ],
+ 'bootstrap' => [
'description' => "Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted).",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- ),
- 'schema_version' => array(
+ ],
+ 'schema_version' => [
'description' => "The module's database schema version number. -1 if the module is not installed (its tables do not exist); \Drupal::CORE_MINIMUM_SCHEMA_VERSION or the largest N of the module's hook_update_N() function that has either been run or existed when the module was first installed.",
'type' => 'int',
'not null' => TRUE,
'default' => -1,
'size' => 'small',
- ),
- 'weight' => array(
+ ],
+ 'weight' => [
'description' => "The order in which this module's hooks should be invoked relative to other modules. Equal-weighted modules are ordered by name.",
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- ),
- 'info' => array(
+ ],
+ 'info' => [
'description' => "A serialized array containing information from the module's .info file; keys can include name, description, package, version, core, dependencies, and php.",
'type' => 'blob',
'not null' => FALSE,
- ),
- ),
- 'primary key' => array('filename'),
- 'indexes' => array(
- 'system_list' => array('status', 'bootstrap', 'type', 'weight', 'name'),
- 'type_name' => array('type', 'name'),
- ),
- );
+ ],
+ ],
+ 'primary key' => ['filename'],
+ 'indexes' => [
+ 'system_list' => ['status', 'bootstrap', 'type', 'weight', 'name'],
+ 'type_name' => ['type', 'name'],
+ ],
+ ];
}
}
diff --git a/web/core/modules/system/src/Tests/Update/UpdatesWith7xTest.php b/web/core/modules/system/src/Tests/Update/UpdatesWith7xTest.php
index 9782d91c6..c2035d133 100644
--- a/web/core/modules/system/src/Tests/Update/UpdatesWith7xTest.php
+++ b/web/core/modules/system/src/Tests/Update/UpdatesWith7xTest.php
@@ -17,7 +17,7 @@ class UpdatesWith7xTest extends WebTestBase {
*
* @var array
*/
- public static $modules = array('update_test_with_7x');
+ public static $modules = ['update_test_with_7x'];
/**
* The URL for the update page.
@@ -33,10 +33,10 @@ class UpdatesWith7xTest extends WebTestBase {
parent::setUp();
require_once \Drupal::root() . '/core/includes/update.inc';
$this->updateUrl = $GLOBALS['base_url'] . '/update.php';
- $this->updateUser = $this->drupalCreateUser(array('administer software updates'));
+ $this->updateUser = $this->drupalCreateUser(['administer software updates']);
}
- function testWith7x() {
+ public function testWith7x() {
// Ensure that the minimum schema version is 8000, despite 7200 update
// hooks and a 7XXX hook_update_last_removed().
$this->assertEqual(drupal_get_installed_schema_version('update_test_with_7x'), 8000);
@@ -47,7 +47,7 @@ class UpdatesWith7xTest extends WebTestBase {
// Click through update.php with 'administer software updates' permission.
$this->drupalLogin($this->updateUser);
- $this->drupalGet($this->updateUrl, array('external' => TRUE));
+ $this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->clickLink(t('Continue'));
$this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
}
diff --git a/web/core/modules/system/system.admin.inc b/web/core/modules/system/system.admin.inc
index f9c49c765..799869bbc 100644
--- a/web/core/modules/system/system.admin.inc
+++ b/web/core/modules/system/system.admin.inc
@@ -49,10 +49,10 @@ function template_preprocess_admin_block_content(&$variables) {
* 'right'.
*/
function template_preprocess_admin_page(&$variables) {
- $variables['system_compact_link'] = array(
+ $variables['system_compact_link'] = [
'#type' => 'system_compact_link',
- );
- $variables['containers'] = array();
+ ];
+ $variables['containers'] = [];
$stripe = 0;
foreach ($variables['blocks'] as $block) {
if (!empty($block['content']['#content'])) {
@@ -60,10 +60,10 @@ function template_preprocess_admin_page(&$variables) {
// Perform automatic striping.
$block['position'] = ++$stripe % 2 ? 'left' : 'right';
}
- $variables['containers'][$block['position']]['blocks'][] = array(
+ $variables['containers'][$block['position']]['blocks'][] = [
'#theme' => 'admin_block',
'#block' => $block,
- );
+ ];
}
}
}
@@ -78,10 +78,10 @@ function template_preprocess_admin_page(&$variables) {
* - menu_items: An array of modules to be displayed.
*/
function template_preprocess_system_admin_index(&$variables) {
- $variables['system_compact_link'] = array(
+ $variables['system_compact_link'] = [
'#type' => 'system_compact_link',
- );
- $variables['containers'] = array();
+ ];
+ $variables['containers'] = [];
$stripe = 0;
// Iterate over all modules.
foreach ($variables['menu_items'] as $module => $block) {
@@ -89,82 +89,22 @@ function template_preprocess_system_admin_index(&$variables) {
$position = ++$stripe % 2 ? 'left' : 'right';
// Output links.
if (count($items)) {
- $variables['containers'][$position][] = array(
+ $variables['containers'][$position][] = [
'#theme' => 'admin_block',
- '#block' => array(
+ '#block' => [
'position' => $position,
'title' => $module,
- 'content' => array(
+ 'content' => [
'#theme' => 'admin_block_content',
'#content' => $items,
- ),
+ ],
'description' => t($description),
- ),
- );
+ ],
+ ];
}
}
}
-/**
- * Prepares variables for status report template.
- *
- * Default template: status-report.html.twig.
- *
- * This theme function is dependent on install.inc being loaded, because
- * that's where the constants are defined.
- *
- * @param $variables
- * An associative array containing:
- * - requirements: An array of requirements/status items. Each requirement
- * is an associative array containing the following elements:
- * - title: The name of the requirement.
- * - value: (optional) The current value (version, time, level, etc).
- * - description: (optional) The description of the requirement.
- * - severity: (optional) The requirement's result/severity level, one of:
- * - REQUIREMENT_INFO: Status information.
- * - REQUIREMENT_OK: The requirement is satisfied.
- * - REQUIREMENT_WARNING: The requirement failed with a warning.
- * - REQUIREMENT_ERROR: The requirement failed with an error.
- */
-function template_preprocess_status_report(&$variables) {
- $severities = array(
- REQUIREMENT_INFO => array(
- 'title' => t('Info'),
- 'status' => 'info',
- ),
- REQUIREMENT_OK => array(
- 'title' => t('OK'),
- 'status' => 'ok',
- ),
- REQUIREMENT_WARNING => array(
- 'title' => t('Warning'),
- 'status' => 'warning',
- ),
- REQUIREMENT_ERROR => array(
- 'title' => t('Error'),
- 'status' => 'error',
- ),
- );
-
- foreach ($variables['requirements'] as $i => $requirement) {
- // Always use the explicit requirement severity, if defined. Otherwise,
- // default to REQUIREMENT_OK in the installer to visually confirm that
- // installation requirements are met. And default to REQUIREMENT_INFO to
- // denote neutral information without special visualization.
- if (isset($requirement['severity'])) {
- $severity = $severities[(int) $requirement['severity']];
- }
- elseif (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install') {
- $severity = $severities[REQUIREMENT_OK];
- }
- else {
- $severity = $severities[REQUIREMENT_INFO];
- }
- $variables['requirements'][$i]['severity_title'] = $severity['title'];
- $variables['requirements'][$i]['severity_status'] = $severity['status'];
- }
-}
-
/**
* Prepares variables for the module details templates.
*
@@ -301,7 +241,7 @@ function template_preprocess_system_modules_uninstall(&$variables) {
* - theme_group_titles: An associative array containing titles of themes.
*/
function template_preprocess_system_themes_page(&$variables) {
- $groups = array();
+ $groups = [];
$theme_groups = $variables['theme_groups'];
$variables['attributes']['id'] = 'system-themes-page';
@@ -311,33 +251,33 @@ function template_preprocess_system_themes_page(&$variables) {
continue;
}
// Start new theme group.
- $theme_group = array();
+ $theme_group = [];
$theme_group['state'] = $state;
$theme_group['title'] = $title;
- $theme_group['themes'] = array();
+ $theme_group['themes'] = [];
$theme_group['attributes'] = new Attribute();
foreach ($theme_groups[$state] as $theme) {
- $current_theme = array();
+ $current_theme = [];
// Screenshot depicting the theme.
if ($theme->screenshot) {
- $current_theme['screenshot'] = array(
+ $current_theme['screenshot'] = [
'#theme' => 'image',
'#uri' => $theme->screenshot['uri'],
'#alt' => $theme->screenshot['alt'],
'#title' => $theme->screenshot['title'],
'#attributes' => $theme->screenshot['attributes'],
- );
+ ];
}
else {
- $current_theme['screenshot'] = array(
+ $current_theme['screenshot'] = [
'#theme' => 'image',
'#uri' => drupal_get_path('module', 'system') . '/images/no_screenshot.png',
'#alt' => t('No screenshot'),
'#title' => t('No screenshot'),
- '#attributes' => new Attribute(array('class' => array('no-screenshot'))),
- );
+ '#attributes' => new Attribute(['class' => ['no-screenshot']]),
+ ];
}
// Localize the theme description.
@@ -362,23 +302,23 @@ function template_preprocess_system_themes_page(&$variables) {
if (substr_count($theme->info['php'], '.') < 2) {
$theme->info['php'] .= '.*';
}
- $current_theme['incompatible'] = t('This theme requires PHP version @php_required and is incompatible with PHP version @php_version.', array('@php_required' => $theme->info['php'], '@php_version' => phpversion()));
+ $current_theme['incompatible'] = t('This theme requires PHP version @php_required and is incompatible with PHP version @php_version.', ['@php_required' => $theme->info['php'], '@php_version' => phpversion()]);
}
elseif (!empty($theme->incompatible_base)) {
- $current_theme['incompatible'] = t('This theme requires the base theme @base_theme to operate correctly.', array('@base_theme' => $theme->info['base theme']));
+ $current_theme['incompatible'] = t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => $theme->info['base theme']]);
}
elseif (!empty($theme->incompatible_engine)) {
- $current_theme['incompatible'] = t('This theme requires the theme engine @theme_engine to operate correctly.', array('@theme_engine' => $theme->info['engine']));
+ $current_theme['incompatible'] = t('This theme requires the theme engine @theme_engine to operate correctly.', ['@theme_engine' => $theme->info['engine']]);
}
// Build operation links.
- $current_theme['operations'] = array(
+ $current_theme['operations'] = [
'#theme' => 'links',
'#links' => $theme->operations,
- '#attributes' => array(
- 'class' => array('operations', 'clearfix'),
- ),
- );
+ '#attributes' => [
+ 'class' => ['operations', 'clearfix'],
+ ],
+ ];
$theme_group['themes'][] = $current_theme;
}
$groups[] = $theme_group;
diff --git a/web/core/modules/system/system.api.php b/web/core/modules/system/system.api.php
index 8534ebf70..7951ecd21 100644
--- a/web/core/modules/system/system.api.php
+++ b/web/core/modules/system/system.api.php
@@ -24,11 +24,11 @@ function hook_system_themes_page_alter(&$theme_groups) {
foreach ($theme_groups as $state => &$group) {
foreach ($theme_groups[$state] as &$theme) {
// Add a foo link to each list of theme operations.
- $theme->operations[] = array(
+ $theme->operations[] = [
'title' => t('Foo'),
'url' => Url::fromRoute('system.themes_page'),
- 'query' => array('theme' => $theme->getName())
- );
+ 'query' => ['theme' => $theme->getName()]
+ ];
}
}
}
diff --git a/web/core/modules/system/system.install b/web/core/modules/system/system.install
index 7db1eaeb0..61b2650ad 100644
--- a/web/core/modules/system/system.install
+++ b/web/core/modules/system/system.install
@@ -24,36 +24,36 @@ use Symfony\Component\HttpFoundation\Request;
*/
function system_requirements($phase) {
global $install_state;
- $requirements = array();
+ $requirements = [];
// Report Drupal version
if ($phase == 'runtime') {
- $requirements['drupal'] = array(
+ $requirements['drupal'] = [
'title' => t('Drupal'),
'value' => \Drupal::VERSION,
'severity' => REQUIREMENT_INFO,
'weight' => -10,
- );
+ ];
// Display the currently active installation profile, if the site
// is not running the default installation profile.
$profile = drupal_get_profile();
if ($profile != 'standard') {
$info = system_get_info('module', $profile);
- $requirements['install_profile'] = array(
+ $requirements['install_profile'] = [
'title' => t('Installation profile'),
- 'value' => t('%profile_name (%profile-%version)', array(
+ 'value' => t('%profile_name (%profile-%version)', [
'%profile_name' => $info['name'],
'%profile' => $profile,
'%version' => $info['version']
- )),
+ ]),
'severity' => REQUIREMENT_INFO,
'weight' => -9
- );
+ ];
}
// Warn if any experimental modules are installed.
- $experimental = array();
+ $experimental = [];
$enabled_modules = \Drupal::moduleHandler()->getModuleList();
foreach ($enabled_modules as $module => $data) {
$info = system_get_info('module', $module);
@@ -62,20 +62,20 @@ function system_requirements($phase) {
}
}
if (!empty($experimental)) {
- $requirements['experimental'] = array(
+ $requirements['experimental'] = [
'title' => t('Experimental modules enabled'),
- 'value' => t('Experimental modules found: %module_list.
Experimental modules are provided for testing purposes only. Use at your own risk.', array('%module_list' => implode(', ', $experimental), ':url' => 'https://www.drupal.org/core/experimental')),
+ 'value' => t('Experimental modules found: %module_list.
Experimental modules are provided for testing purposes only. Use at your own risk.', ['%module_list' => implode(', ', $experimental), ':url' => 'https://www.drupal.org/core/experimental']),
'severity' => REQUIREMENT_WARNING,
- );
+ ];
}
}
// Web server information.
$software = \Drupal::request()->server->get('SERVER_SOFTWARE');
- $requirements['webserver'] = array(
+ $requirements['webserver'] = [
'title' => t('Web server'),
'value' => $software,
- );
+ ];
// Tests clean URL support.
if ($phase == 'install' && $install_state['interactive'] && !isset($_GET['rewrite']) && strpos($software, 'Apache') !== FALSE) {
@@ -124,30 +124,30 @@ function system_requirements($phase) {
}
if ($rewrite_warning) {
- $requirements['apache_version'] = array (
+ $requirements['apache_version'] = [
'title' => t('Apache version'),
'value' => $apache_version_string,
'severity' => REQUIREMENT_WARNING,
- 'description' => t('Due to the settings for ServerTokens in httpd.conf, it is impossible to accurately determine the version of Apache running on this server. The reported value is @reported, to run Drupal without mod_rewrite, a minimum version of 2.2.16 is needed.', array('@reported' => $apache_version_string)),
- );
+ 'description' => t('Due to the settings for ServerTokens in httpd.conf, it is impossible to accurately determine the version of Apache running on this server. The reported value is @reported, to run Drupal without mod_rewrite, a minimum version of 2.2.16 is needed.', ['@reported' => $apache_version_string]),
+ ];
}
if ($rewrite_error) {
- $requirements['Apache version'] = array (
+ $requirements['Apache version'] = [
'title' => t('Apache version'),
'value' => $apache_version_string,
'severity' => REQUIREMENT_ERROR,
- 'description' => t('The minimum version of Apache needed to run Drupal without mod_rewrite enabled is 2.2.16. See the
enabling clean URLs page for more information on mod_rewrite.', array(':link' => 'http://drupal.org/node/15365')),
- );
+ 'description' => t('The minimum version of Apache needed to run Drupal without mod_rewrite enabled is 2.2.16. See the
enabling clean URLs page for more information on mod_rewrite.', [':link' => 'http://drupal.org/node/15365']),
+ ];
}
if (!$rewrite_error && !$rewrite_warning) {
- $requirements['rewrite_module'] = array (
+ $requirements['rewrite_module'] = [
'title' => t('Clean URLs'),
'value' => t('Disabled'),
'severity' => REQUIREMENT_WARNING,
- 'description' => t('Your server is capable of using clean URLs, but it is not enabled. Using clean URLs gives an improved user experience and is recommended.
Enable clean URLs', array(':link' => 'http://drupal.org/node/15365')),
- );
+ 'description' => t('Your server is capable of using clean URLs, but it is not enabled. Using clean URLs gives an improved user experience and is recommended.
Enable clean URLs', [':link' => 'http://drupal.org/node/15365']),
+ ];
}
}
@@ -157,22 +157,22 @@ function system_requirements($phase) {
if ($phase === 'runtime') {
$phpversion_label = t('@phpversion (
more information)', ['@phpversion' => $phpversion, ':url' => (new Url('system.php'))->toString()]);
}
- $requirements['php'] = array(
+ $requirements['php'] = [
'title' => t('PHP'),
'value' => $phpversion_label,
- );
+ ];
}
else {
- $requirements['php'] = array(
+ $requirements['php'] = [
'title' => t('PHP'),
'value' => $phpversion_label,
- 'description' => t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information,
Enabling and disabling phpinfo() handbook page.', array(':phpinfo' => 'https://www.drupal.org/node/243993')),
+ 'description' => t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information,
Enabling and disabling phpinfo() handbook page.', [':phpinfo' => 'https://www.drupal.org/node/243993']),
'severity' => REQUIREMENT_INFO,
- );
+ ];
}
if (version_compare($phpversion, DRUPAL_MINIMUM_PHP) < 0) {
- $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
+ $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_PHP]);
$requirements['php']['severity'] = REQUIREMENT_ERROR;
// If PHP is old, it's not safe to continue with the requirements check.
return $requirements;
@@ -181,21 +181,21 @@ function system_requirements($phase) {
// Suggest to update to at least 5.5.21 or 5.6.5 for disabling multiple
// statements.
if (($phase === 'install' || \Drupal::database()->driver() === 'mysql') && !SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($phpversion)) {
- $requirements['php'] = array(
+ $requirements['php'] = [
'title' => t('PHP (multiple statement disabling)'),
'value' => $phpversion_label,
'description' => t('PHP versions higher than 5.6.5 or 5.5.21 provide built-in SQL injection protection for mysql databases. It is recommended to update.'),
'severity' => REQUIREMENT_INFO,
- );
+ ];
}
// Test for PHP extensions.
- $requirements['php_extensions'] = array(
+ $requirements['php_extensions'] = [
'title' => t('PHP extensions'),
- );
+ ];
- $missing_extensions = array();
- $required_extensions = array(
+ $missing_extensions = [];
+ $required_extensions = [
'date',
'dom',
'filter',
@@ -209,7 +209,7 @@ function system_requirements($phase) {
'SPL',
'tokenizer',
'xml',
- );
+ ];
foreach ($required_extensions as $extension) {
if (!extension_loaded($extension)) {
$missing_extensions[] = $extension;
@@ -217,22 +217,22 @@ function system_requirements($phase) {
}
if (!empty($missing_extensions)) {
- $description = t('Drupal requires you to enable the PHP extensions in the following list (see the
system requirements page for more information):', array(
+ $description = t('Drupal requires you to enable the PHP extensions in the following list (see the
system requirements page for more information):', [
':system_requirements' => 'https://www.drupal.org/requirements',
- ));
+ ]);
// We use twig inline_template to avoid twig's autoescape.
- $description = array(
+ $description = [
'#type' => 'inline_template',
'#template' => '{{ description }}{{ missing_extensions }}',
- '#context' => array(
+ '#context' => [
'description' => $description,
- 'missing_extensions' => array(
+ 'missing_extensions' => [
'#theme' => 'item_list',
'#items' => $missing_extensions,
- ),
- ),
- );
+ ],
+ ],
+ ];
$requirements['php_extensions']['value'] = t('Disabled');
$requirements['php_extensions']['severity'] = REQUIREMENT_ERROR;
@@ -245,11 +245,11 @@ function system_requirements($phase) {
if ($phase == 'install' || $phase == 'runtime') {
// Check to see if OPcache is installed.
if (!OpCodeCache::isEnabled()) {
- $requirements['php_opcache'] = array(
+ $requirements['php_opcache'] = [
'value' => t('Not enabled'),
'severity' => REQUIREMENT_WARNING,
'description' => t('PHP OPcode caching can improve your site\'s performance considerably. It is
highly recommended to have
OPcache installed on your server.'),
- );
+ ];
}
else {
$requirements['php_opcache']['value'] = t('Enabled');
@@ -257,35 +257,73 @@ function system_requirements($phase) {
$requirements['php_opcache']['title'] = t('PHP OPcode caching');
}
+ if ($phase != 'update') {
+ // Test whether we have a good source of random bytes.
+ $requirements['php_random_bytes'] = [
+ 'title' => t('Random number generation'),
+ ];
+ try {
+ $bytes = random_bytes(10);
+ if (strlen($bytes) != 10) {
+ throw new \Exception(t('Tried to generate 10 random bytes, generated @count', ['@count' => strlen($bytes)]));
+ }
+ $requirements['php_random_bytes']['value'] = t('Successful');
+ }
+ catch (\Exception $e) {
+ // If /dev/urandom is not available on a UNIX-like system, check whether
+ // open_basedir restrictions are the cause.
+ $open_basedir_blocks_urandom = FALSE;
+ if (DIRECTORY_SEPARATOR === '/' && !@is_readable('/dev/urandom')) {
+ $open_basedir = ini_get('open_basedir');
+ if ($open_basedir) {
+ $open_basedir_paths = explode(PATH_SEPARATOR, $open_basedir);
+ $open_basedir_blocks_urandom = !array_intersect(['/dev', '/dev/', '/dev/urandom'], $open_basedir_paths);
+ }
+ }
+ $args = [
+ ':drupal-php' => 'https://www.drupal.org/docs/7/system-requirements/php#csprng',
+ '%exception_message' => $e->getMessage(),
+ ];
+ if ($open_basedir_blocks_urandom) {
+ $requirements['php_random_bytes']['description'] = t('Drupal is unable to generate highly randomized numbers, which means certain security features like password reset URLs are not as secure as they should be. Instead, only a slow, less-secure fallback generator is available. The most likely cause is that open_basedir restrictions are in effect and /dev/urandom is not on the whitelist. See the
system requirements page for more information. %exception_message', $args);
+ }
+ else {
+ $requirements['php_random_bytes']['description'] = t('Drupal is unable to generate highly randomized numbers, which means certain security features like password reset URLs are not as secure as they should be. Instead, only a slow, less-secure fallback generator is available. See the
system requirements page for more information. %exception_message', $args);
+ }
+ $requirements['php_random_bytes']['value'] = t('Less secure');
+ $requirements['php_random_bytes']['severity'] = REQUIREMENT_ERROR;
+ }
+ }
+
if ($phase == 'install' || $phase == 'update') {
// Test for PDO (database).
- $requirements['database_extensions'] = array(
+ $requirements['database_extensions'] = [
'title' => t('Database support'),
- );
+ ];
// Make sure PDO is available.
$database_ok = extension_loaded('pdo');
if (!$database_ok) {
- $pdo_message = t('Your web server does not appear to support PDO (PHP Data Objects). Ask your hosting provider if they support the native PDO extension. See the
system requirements page for more information.', array(
+ $pdo_message = t('Your web server does not appear to support PDO (PHP Data Objects). Ask your hosting provider if they support the native PDO extension. See the
system requirements page for more information.', [
':link' => 'https://www.drupal.org/requirements/pdo',
- ));
+ ]);
}
else {
// Make sure at least one supported database driver exists.
$drivers = drupal_detect_database_types();
if (empty($drivers)) {
$database_ok = FALSE;
- $pdo_message = t('Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that
Drupal supports.', array(
+ $pdo_message = t('Your web server does not appear to support any common PDO database extensions. Check with your hosting provider to see if they support PDO (PHP Data Objects) and offer any databases that
Drupal supports.', [
':drupal-databases' => 'https://www.drupal.org/requirements/database',
- ));
+ ]);
}
// Make sure the native PDO extension is available, not the older PEAR
// version. (See install_verify_pdo() for details.)
if (!defined('PDO::ATTR_DEFAULT_FETCH_MODE')) {
$database_ok = FALSE;
- $pdo_message = t('Your web server seems to have the wrong version of PDO installed. Drupal requires the PDO extension from PHP core. This system has the older PECL version. See the
system requirements page for more information.', array(
+ $pdo_message = t('Your web server seems to have the wrong version of PDO installed. Drupal requires the PDO extension from PHP core. This system has the older PECL version. See the
system requirements page for more information.', [
':link' => 'https://www.drupal.org/requirements/pdo#pecl',
- ));
+ ]);
}
}
@@ -302,54 +340,54 @@ function system_requirements($phase) {
// Database information.
$class = Database::getConnection()->getDriverClass('Install\\Tasks');
$tasks = new $class();
- $requirements['database_system'] = array(
+ $requirements['database_system'] = [
'title' => t('Database system'),
'value' => $tasks->name(),
- );
- $requirements['database_system_version'] = array(
+ ];
+ $requirements['database_system_version'] = [
'title' => t('Database system version'),
'value' => Database::getConnection()->version(),
- );
+ ];
}
// Test PHP memory_limit
$memory_limit = ini_get('memory_limit');
- $requirements['php_memory_limit'] = array(
+ $requirements['php_memory_limit'] = [
'title' => t('PHP memory limit'),
'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
- );
+ ];
if (!Environment::checkMemoryLimit(DRUPAL_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
- $description = array();
+ $description = [];
if ($phase == 'install') {
- $description['phase'] = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
+ $description['phase'] = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', ['%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT]);
}
elseif ($phase == 'update') {
- $description['phase'] = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', array('%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
+ $description['phase'] = t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', ['%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT]);
}
elseif ($phase == 'runtime') {
- $description['phase'] = t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.', array('%memory_limit' => $memory_limit, '%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT));
+ $description['phase'] = t('Depending on your configuration, Drupal can run with a %memory_limit PHP memory limit. However, a %memory_minimum_limit PHP memory limit or above is recommended, especially if your site uses additional custom or contributed modules.', ['%memory_limit' => $memory_limit, '%memory_minimum_limit' => DRUPAL_MINIMUM_PHP_MEMORY_LIMIT]);
}
if (!empty($description['phase'])) {
if ($php_ini_path = get_cfg_var('cfg_file_path')) {
- $description['memory'] = t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server (or contact your system administrator or hosting provider for assistance).', array('%configuration-file' => $php_ini_path));
+ $description['memory'] = t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server (or contact your system administrator or hosting provider for assistance).', ['%configuration-file' => $php_ini_path]);
}
else {
$description['memory'] = t('Contact your system administrator or hosting provider for assistance with increasing your PHP memory limit.');
}
- $handbook_link = t('For more information, see the online handbook entry for
increasing the PHP memory limit.', array(':memory-limit' => 'https://www.drupal.org/node/207036'));
+ $handbook_link = t('For more information, see the online handbook entry for
increasing the PHP memory limit.', [':memory-limit' => 'https://www.drupal.org/node/207036']);
- $description = array(
+ $description = [
'#type' => 'inline_template',
'#template' => '{{ description_phase }} {{ description_memory }} {{ handbook }}',
- '#context' => array(
+ '#context' => [
'description_phase' => $description['phase'],
'description_memory' => $description['memory'],
'handbook' => $handbook_link,
- ),
- );
+ ],
+ ];
$requirements['php_memory_limit']['description'] = $description;
$requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING;
@@ -358,7 +396,7 @@ function system_requirements($phase) {
// Test configuration files and directory for writability.
if ($phase == 'runtime') {
- $conf_errors = array();
+ $conf_errors = [];
// Find the site path. Kernel service is not always available at this point,
// but is preferred, when available.
if (\Drupal::hasService('kernel')) {
@@ -380,13 +418,13 @@ function system_requirements($phase) {
// In normal operation, writable files or directories are an error.
$file_protection_severity = REQUIREMENT_ERROR;
if (!drupal_verify_install_file($site_path, FILE_NOT_WRITABLE, 'dir')) {
- $conf_errors[] = t("The directory %file is not protected from modifications and poses a security risk. You must change the directory's permissions to be non-writable.", array('%file' => $site_path));
+ $conf_errors[] = t("The directory %file is not protected from modifications and poses a security risk. You must change the directory's permissions to be non-writable.", ['%file' => $site_path]);
}
}
- foreach (array('settings.php', 'settings.local.php', 'services.yml') as $conf_file) {
+ foreach (['settings.php', 'settings.local.php', 'services.yml'] as $conf_file) {
$full_path = $site_path . '/' . $conf_file;
if (file_exists($full_path) && (Settings::get('skip_permissions_hardening') || !drupal_verify_install_file($full_path, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE))) {
- $conf_errors[] = t("The file %file is not protected from modifications and poses a security risk. You must change the file's permissions to be non-writable.", array('%file' => $full_path));
+ $conf_errors[] = t("The file %file is not protected from modifications and poses a security risk. You must change the file's permissions to be non-writable.", ['%file' => $full_path]);
}
}
if (!empty($conf_errors)) {
@@ -395,27 +433,27 @@ function system_requirements($phase) {
}
else {
// We use twig inline_template to avoid double escaping.
- $description = array(
+ $description = [
'#type' => 'inline_template',
'#template' => '{{ configuration_error_list }}',
- '#context' => array(
- 'configuration_error_list' => array(
+ '#context' => [
+ 'configuration_error_list' => [
'#theme' => 'item_list',
'#items' => $conf_errors,
- ),
- ),
- );
+ ],
+ ],
+ ];
}
- $requirements['configuration_files'] = array(
+ $requirements['configuration_files'] = [
'value' => t('Not protected'),
'severity' => $file_protection_severity,
'description' => $description,
- );
+ ];
}
else {
- $requirements['configuration_files'] = array(
+ $requirements['configuration_files'] = [
'value' => t('Protected'),
- );
+ ];
}
$requirements['configuration_files']['title'] = t('Configuration files');
}
@@ -425,31 +463,31 @@ function system_requirements($phase) {
// Try to write the .htaccess files first, to prevent false alarms in case
// (for example) the /tmp directory was wiped.
file_ensure_htaccess();
- $htaccess_files['public://.htaccess'] = array(
+ $htaccess_files['public://.htaccess'] = [
'title' => t('Public files directory'),
'directory' => drupal_realpath('public://'),
- );
+ ];
if (PrivateStream::basePath()) {
- $htaccess_files['private://.htaccess'] = array(
+ $htaccess_files['private://.htaccess'] = [
'title' => t('Private files directory'),
'directory' => drupal_realpath('private://'),
- );
+ ];
}
- $htaccess_files['temporary://.htaccess'] = array(
+ $htaccess_files['temporary://.htaccess'] = [
'title' => t('Temporary files directory'),
'directory' => drupal_realpath('temporary://'),
- );
+ ];
foreach ($htaccess_files as $htaccess_file => $info) {
// Check for the string which was added to the recommended .htaccess file
// in the latest security update.
if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
$url = 'https://www.drupal.org/SA-CORE-2013-003';
- $requirements[$htaccess_file] = array(
+ $requirements[$htaccess_file] = [
'title' => $info['title'],
'value' => t('Not fully protected'),
'severity' => REQUIREMENT_ERROR,
- 'description' => t('See
@url for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array(':url' => $url, '@url' => $url, '%directory' => $info['directory'])),
- );
+ 'description' => t('See
@url for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', [':url' => $url, '@url' => $url, '%directory' => $info['directory']]),
+ ];
}
}
}
@@ -478,13 +516,13 @@ function system_requirements($phase) {
}
// Set summary and description based on values determined above.
- $summary = t('Last run @time ago', array('@time' => \Drupal::service('date.formatter')->formatTimeDiffSince($cron_last)));
+ $summary = t('Last run @time ago', ['@time' => \Drupal::service('date.formatter')->formatTimeDiffSince($cron_last)]);
- $requirements['cron'] = array(
+ $requirements['cron'] = [
'title' => t('Cron maintenance tasks'),
'severity' => $severity,
'value' => $summary,
- );
+ ];
if ($severity != REQUIREMENT_INFO) {
$requirements['cron']['description'][] = [
[
@@ -497,32 +535,38 @@ function system_requirements($phase) {
],
];
}
- $cron_url = \Drupal::url('system.cron', ['key' => \Drupal::state()->get('system.cron_key'), ['absolute' => TRUE]]);
$requirements['cron']['description'][] = [
[
- '#markup' => t('You can
run cron manually.', [':cron' => \Drupal::url('system.run_cron')]),
+ '#type' => 'link',
+ '#prefix' => '(',
+ '#title' => t('more information'),
+ '#suffix' => ')',
+ '#url' => Url::fromRoute('system.cron_settings'),
],
[
- '#prefix' => '
',
- '#markup' => t('To run cron from outside the site, go to
@cron', [':url' => $cron_url, '@cron' => $cron_url]),
+ '#prefix' => '
',
+ '#suffix' => '',
+ '#type' => 'link',
+ '#title' => t('Run cron'),
+ '#url' => Url::fromRoute('system.run_cron'),
],
];
}
if ($phase != 'install') {
$filesystem_config = \Drupal::config('system.file');
- $directories = array(
+ $directories = [
PublicStream::basePath(),
// By default no private files directory is configured. For private files
// to be secure the admin needs to provide a path outside the webroot.
PrivateStream::basePath(),
file_directory_temp(),
- );
+ ];
}
// During an install we need to make assumptions about the file system
// unless overrides are provided in settings.php.
if ($phase == 'install') {
- $directories = array();
+ $directories = [];
if ($file_public_path = Settings::get('file_public_path')) {
$directories[] = $file_public_path;
}
@@ -558,31 +602,31 @@ function system_requirements($phase) {
}
if (!is_dir($directory)) {
if ($phase == 'install') {
- $description = t('An automated attempt to create the directory %directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the
online handbook.', array('%directory' => $directory, ':handbook_url' => 'https://www.drupal.org/server-permissions'));
+ $description = t('An automated attempt to create the directory %directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the
online handbook.', ['%directory' => $directory, ':handbook_url' => 'https://www.drupal.org/server-permissions']);
}
else {
- $description = t('The directory %directory does not exist.', array('%directory' => $directory));
+ $description = t('The directory %directory does not exist.', ['%directory' => $directory]);
}
- $requirements['config directory ' . $type] = array(
+ $requirements['config directory ' . $type] = [
'title' => t('Configuration directory: %type', ['%type' => $type]),
'description' => $description,
'severity' => REQUIREMENT_ERROR,
- );
+ ];
}
}
}
if ($phase != 'install' && (empty($GLOBALS['config_directories']) || empty($GLOBALS['config_directories'][CONFIG_SYNC_DIRECTORY]) )) {
- $requirements['config directories'] = array(
+ $requirements['config directories'] = [
'title' => t('Configuration directories'),
'value' => t('Not present'),
- 'description' => t('Your %file file must define the $config_directories variable as an array containing the names of directories in which configuration files can be found. It must contain a %sync_key key.', array('%file' => $site_path . '/settings.php', '%sync_key' => CONFIG_SYNC_DIRECTORY)),
+ 'description' => t('Your %file file must define the $config_directories variable as an array containing the names of directories in which configuration files can be found. It must contain a %sync_key key.', ['%file' => $site_path . '/settings.php', '%sync_key' => CONFIG_SYNC_DIRECTORY]),
'severity' => REQUIREMENT_ERROR,
- );
+ ];
}
- $requirements['file system'] = array(
+ $requirements['file system'] = [
'title' => t('File system'),
- );
+ ];
$error = '';
// For installer, create the directories if possible.
@@ -599,30 +643,30 @@ function system_requirements($phase) {
$description = '';
$requirements['file system']['value'] = t('Not writable');
if (!$is_directory) {
- $error = t('The directory %directory does not exist.', array('%directory' => $directory));
+ $error = t('The directory %directory does not exist.', ['%directory' => $directory]);
}
else {
- $error = t('The directory %directory is not writable.', array('%directory' => $directory));
+ $error = t('The directory %directory is not writable.', ['%directory' => $directory]);
}
// The files directory requirement check is done only during install and runtime.
if ($phase == 'runtime') {
- $description = t('You may need to set the correct directory at the
file system settings page or change the current directory\'s permissions so that it is writable.', array(':admin-file-system' => \Drupal::url('system.file_system_settings')));
+ $description = t('You may need to set the correct directory at the
file system settings page or change the current directory\'s permissions so that it is writable.', [':admin-file-system' => \Drupal::url('system.file_system_settings')]);
}
elseif ($phase == 'install') {
// For the installer UI, we need different wording. 'value' will
// be treated as version, so provide none there.
- $description = t('An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the
online handbook.', array(':handbook_url' => 'https://www.drupal.org/server-permissions'));
+ $description = t('An automated attempt to create this directory failed, possibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions manually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the
online handbook.', [':handbook_url' => 'https://www.drupal.org/server-permissions']);
$requirements['file system']['value'] = '';
}
if (!empty($description)) {
- $description = array(
+ $description = [
'#type' => 'inline_template',
'#template' => '{{ error }} {{ description }}',
- '#context' => array(
+ '#context' => [
'error' => $error,
'description' => $description,
- ),
- );
+ ],
+ ];
$requirements['file system']['description'] = $description;
$requirements['file system']['severity'] = REQUIREMENT_ERROR;
}
@@ -641,10 +685,10 @@ function system_requirements($phase) {
// See if updates are available in update.php.
if ($phase == 'runtime') {
- $requirements['update'] = array(
+ $requirements['update'] = [
'title' => t('Database updates'),
'value' => t('Up to date'),
- );
+ ];
// Check installed modules.
$has_pending_updates = FALSE;
@@ -670,7 +714,7 @@ function system_requirements($phase) {
if ($has_pending_updates) {
$requirements['update']['severity'] = REQUIREMENT_ERROR;
$requirements['update']['value'] = t('Out of date');
- $requirements['update']['description'] = t('Some modules have database schema updates to install. You should run the
database update script immediately.', array(':update' => \Drupal::url('system.db_update')));
+ $requirements['update']['description'] = t('Some modules have database schema updates to install. You should run the
database update script immediately.', [':update' => \Drupal::url('system.db_update')]);
}
$requirements['entity_update'] = [
@@ -699,16 +743,16 @@ function system_requirements($phase) {
// Verify the update.php access setting
if ($phase == 'runtime') {
if (Settings::get('update_free_access')) {
- $requirements['update access'] = array(
+ $requirements['update access'] = [
'value' => t('Not protected'),
'severity' => REQUIREMENT_ERROR,
- 'description' => t('The update.php script is accessible to everyone without authentication check, which is a security risk. You must change the @settings_name value in your settings.php back to FALSE.', array('@settings_name' => '$settings[\'update_free_access\']')),
- );
+ 'description' => t('The update.php script is accessible to everyone without authentication check, which is a security risk. You must change the @settings_name value in your settings.php back to FALSE.', ['@settings_name' => '$settings[\'update_free_access\']']),
+ ];
}
else {
- $requirements['update access'] = array(
+ $requirements['update access'] = [
'value' => t('Protected'),
- );
+ ];
}
$requirements['update access']['title'] = t('Access to update.php');
}
@@ -726,7 +770,7 @@ function system_requirements($phase) {
$name = $file->info['name'];
$php = $file->info['php'];
if (version_compare($php, PHP_VERSION, '>')) {
- $requirements['php']['description'] .= t('@name requires at least PHP @version.', array('@name' => $name, '@version' => $php));
+ $requirements['php']['description'] .= t('@name requires at least PHP @version.', ['@name' => $name, '@version' => $php]);
$requirements['php']['severity'] = REQUIREMENT_ERROR;
}
// Check the module's required modules.
@@ -734,12 +778,12 @@ function system_requirements($phase) {
$required_module = $requirement['name'];
// Check if the module exists.
if (!isset($files[$required_module])) {
- $requirements["$module-$required_module"] = array(
+ $requirements["$module-$required_module"] = [
'title' => t('Unresolved dependency'),
- 'description' => t('@name requires this module.', array('@name' => $name)),
- 'value' => t('@required_name (Missing)', array('@required_name' => $required_module)),
+ 'description' => t('@name requires this module.', ['@name' => $name]),
+ 'value' => t('@required_name (Missing)', ['@required_name' => $required_module]),
'severity' => REQUIREMENT_ERROR,
- );
+ ];
continue;
}
// Check for an incompatible version.
@@ -749,12 +793,12 @@ function system_requirements($phase) {
$compatibility = drupal_check_incompatibility($requirement, $version);
if ($compatibility) {
$compatibility = rtrim(substr($compatibility, 2), ')');
- $requirements["$module-$required_module"] = array(
+ $requirements["$module-$required_module"] = [
'title' => t('Unresolved dependency'),
- 'description' => t('@name requires this module and version. Currently using @required_name version @version', array('@name' => $name, '@required_name' => $required_name, '@version' => $version)),
- 'value' => t('@required_name (Version @compatibility required)', array('@required_name' => $required_name, '@compatibility' => $compatibility)),
+ 'description' => t('@name requires this module and version. Currently using @required_name version @version', ['@name' => $name, '@required_name' => $required_name, '@version' => $version]),
+ 'value' => t('@required_name (Version @compatibility required)', ['@required_name' => $required_name, '@compatibility' => $compatibility]),
'severity' => REQUIREMENT_ERROR,
- );
+ ];
continue;
}
}
@@ -768,29 +812,29 @@ function system_requirements($phase) {
if ($phase == 'runtime') {
// Check for update status module.
if (!\Drupal::moduleHandler()->moduleExists('update')) {
- $requirements['update status'] = array(
+ $requirements['update status'] = [
'value' => t('Not enabled'),
'severity' => REQUIREMENT_WARNING,
- 'description' => t('Update notifications are not enabled. It is
highly recommended that you enable the Update Manager module from the
module administration page in order to stay up-to-date on new releases. For more information,
Update status handbook page.', array(
+ 'description' => t('Update notifications are not enabled. It is
highly recommended that you enable the Update Manager module from the
module administration page in order to stay up-to-date on new releases. For more information,
Update status handbook page.', [
':update' => 'https://www.drupal.org/documentation/modules/update',
':module' => \Drupal::url('system.modules_list'),
- )),
- );
+ ]),
+ ];
}
else {
- $requirements['update status'] = array(
+ $requirements['update status'] = [
'value' => t('Enabled'),
- );
+ ];
}
$requirements['update status']['title'] = t('Update notifications');
if (Settings::get('rebuild_access')) {
- $requirements['rebuild access'] = array(
+ $requirements['rebuild access'] = [
'title' => t('Rebuild access'),
'value' => t('Enabled'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The rebuild_access setting is enabled in settings.php. It is recommended to have this setting disabled unless you are performing a rebuild.'),
- );
+ ];
}
}
@@ -799,19 +843,19 @@ function system_requirements($phase) {
if ($phase == 'runtime') {
$trusted_host_patterns = Settings::get('trusted_host_patterns');
if (empty($trusted_host_patterns)) {
- $requirements['trusted_host_patterns'] = array(
+ $requirements['trusted_host_patterns'] = [
'title' => t('Trusted Host Settings'),
'value' => t('Not enabled'),
- 'description' => t('The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is
highly recommended that you configure this. See
Protecting against HTTP HOST Header attacks for more information.', array(':url' => 'https://www.drupal.org/node/1992030')),
+ 'description' => t('The trusted_host_patterns setting is not configured in settings.php. This can lead to security vulnerabilities. It is
highly recommended that you configure this. See
Protecting against HTTP HOST Header attacks for more information.', [':url' => 'https://www.drupal.org/node/1992030']),
'severity' => REQUIREMENT_ERROR,
- );
+ ];
}
else {
- $requirements['trusted_host_patterns'] = array(
+ $requirements['trusted_host_patterns'] = [
'title' => t('Trusted Host Settings'),
'value' => t('Enabled'),
- 'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', array('%trusted_host_patterns' => join(', ', $trusted_host_patterns))),
- );
+ 'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', ['%trusted_host_patterns' => join(', ', $trusted_host_patterns)]),
+ ];
}
}
@@ -866,6 +910,23 @@ function system_requirements($phase) {
}
}
+ // Installations on Windows can run into limitations with MAX_PATH if the
+ // Drupal root directory is too deep in the filesystem. Generally this shows
+ // up in cached Twig templates and other public files with long directory or
+ // file names. There is no definite root directory depth below which Drupal is
+ // guaranteed to function correctly on Windows. Since problems are likely
+ // with more than 100 characters in the Drupal root path, show an error.
+ if (substr(PHP_OS, 0, 3) == 'WIN') {
+ $depth = strlen(realpath(DRUPAL_ROOT . '/' . PublicStream::basePath()));
+ if ($depth > 120) {
+ $requirements['max_path_on_windows'] = [
+ 'title' => t('Windows installation depth'),
+ 'description' => t('The public files directory path is %depth characters. Paths longer than 120 characters will cause problems on Windows.', ['%depth' => $depth]),
+ 'severity' => REQUIREMENT_ERROR,
+ ];
+ }
+ }
+
return $requirements;
}
@@ -890,133 +951,133 @@ function system_install() {
* Implements hook_schema().
*/
function system_schema() {
- $schema['key_value'] = array(
+ $schema['key_value'] = [
'description' => 'Generic key-value storage table. See the state system for an example.',
- 'fields' => array(
- 'collection' => array(
+ 'fields' => [
+ 'collection' => [
'description' => 'A named collection of key and value pairs.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
- ),
- 'name' => array(
+ ],
+ 'name' => [
'description' => 'The key of the key-value pair. As KEY is a SQL reserved keyword, name was chosen instead.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
- ),
- 'value' => array(
+ ],
+ 'value' => [
'description' => 'The value.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
- ),
- ),
- 'primary key' => array('collection', 'name'),
- );
+ ],
+ ],
+ 'primary key' => ['collection', 'name'],
+ ];
- $schema['key_value_expire'] = array(
+ $schema['key_value_expire'] = [
'description' => 'Generic key/value storage table with an expiration.',
- 'fields' => array(
- 'collection' => array(
+ 'fields' => [
+ 'collection' => [
'description' => 'A named collection of key and value pairs.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
- ),
- 'name' => array(
+ ],
+ 'name' => [
// KEY is an SQL reserved word, so use 'name' as the key's field name.
'description' => 'The key of the key/value pair.',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
- ),
- 'value' => array(
+ ],
+ 'value' => [
'description' => 'The value of the key/value pair.',
'type' => 'blob',
'not null' => TRUE,
'size' => 'big',
- ),
- 'expire' => array(
+ ],
+ 'expire' => [
'description' => 'The time since Unix epoch in seconds when this item expires. Defaults to the maximum possible time.',
'type' => 'int',
'not null' => TRUE,
'default' => 2147483647,
- ),
- ),
- 'primary key' => array('collection', 'name'),
- 'indexes' => array(
- 'all' => array('name', 'collection', 'expire'),
- 'expire' => array('expire'),
- ),
- );
+ ],
+ ],
+ 'primary key' => ['collection', 'name'],
+ 'indexes' => [
+ 'all' => ['name', 'collection', 'expire'],
+ 'expire' => ['expire'],
+ ],
+ ];
- $schema['sequences'] = array(
+ $schema['sequences'] = [
'description' => 'Stores IDs.',
- 'fields' => array(
- 'value' => array(
+ 'fields' => [
+ 'value' => [
'description' => 'The value of the sequence.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
- ),
- ),
- 'primary key' => array('value'),
- );
+ ],
+ ],
+ 'primary key' => ['value'],
+ ];
- $schema['sessions'] = array(
+ $schema['sessions'] = [
'description' => "Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.",
- 'fields' => array(
- 'uid' => array(
+ 'fields' => [
+ 'uid' => [
'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
- ),
- 'sid' => array(
+ ],
+ 'sid' => [
'description' => "A session ID (hashed). The value is generated by Drupal's session handlers.",
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
- ),
- 'hostname' => array(
+ ],
+ 'hostname' => [
'description' => 'The IP address that last used this session ID (sid).',
'type' => 'varchar_ascii',
'length' => 128,
'not null' => TRUE,
'default' => '',
- ),
- 'timestamp' => array(
+ ],
+ 'timestamp' => [
'description' => 'The Unix timestamp when this session last requested a page. Old records are purged by PHP automatically.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- ),
- 'session' => array(
+ ],
+ 'session' => [
'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Drupal loads $_SESSION from here at the start of each request and saves it at the end.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
- ),
- ),
- 'primary key' => array(
+ ],
+ ],
+ 'primary key' => [
'sid',
- ),
- 'indexes' => array(
- 'timestamp' => array('timestamp'),
- 'uid' => array('uid'),
- ),
- 'foreign keys' => array(
- 'session_user' => array(
+ ],
+ 'indexes' => [
+ 'timestamp' => ['timestamp'],
+ 'uid' => ['uid'],
+ ],
+ 'foreign keys' => [
+ 'session_user' => [
'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- ),
- );
+ 'columns' => ['uid' => 'uid'],
+ ],
+ ],
+ ];
// Create the url_alias table. The alias_storage service can auto-create its
// table, but this relies on exceptions being thrown. These exceptions will be
@@ -1026,11 +1087,6 @@ function system_schema() {
return $schema;
}
-/**
- * @addtogroup updates-8.0.0-beta
- * @{
- */
-
/**
* Change two fields on the default menu link storage to be serialized data.
*/
@@ -1043,38 +1099,38 @@ function system_update_8001(&$sandbox = NULL) {
// Converting directly to blob can cause problems with reading out and
// serializing the string data later on postgres, so rename the existing
// columns and create replacement ones to hold the serialized objects.
- $old_fields = array(
- 'title' => array(
+ $old_fields = [
+ 'title' => [
'description' => 'The text displayed for the link.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
- ),
- 'description' => array(
+ ],
+ 'description' => [
'description' => 'The description of this link - used for admin pages and title attribute.',
'type' => 'text',
'not null' => FALSE,
- ),
- );
+ ],
+ ];
foreach ($old_fields as $name => $spec) {
$schema->changeField('menu_tree', $name, 'system_update_8001_' . $name, $spec);
}
- $spec = array(
+ $spec = [
'description' => 'The title for the link. May be a serialized TranslatableMarkup.',
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
- );
+ ];
$schema->addField('menu_tree', 'title', $spec);
- $spec = array(
+ $spec = [
'description' => 'The description of this link - used for admin pages and title attribute.',
'type' => 'blob',
'size' => 'big',
'not null' => FALSE,
'serialize' => TRUE,
- );
+ ];
$schema->addField('menu_tree', 'description', $spec);
$sandbox['current'] = 0;
@@ -1660,15 +1716,6 @@ function system_update_8013() {
->save(TRUE);
}
-/**
- * @} End of "addtogroup updates-8.0.0-beta".
- */
-
-/**
- * @addtogroup updates-8.0.0-rc
- * @{
- */
-
/**
* Install the Stable base theme if needed.
*/
@@ -1688,15 +1735,6 @@ function system_update_8014() {
}
}
-/**
- * @} End of "addtogroup updates-8.0.0-rc".
- */
-
-/**
- * @addtogroup updates-8.2.0
- * @{
- */
-
/**
* Fix configuration overrides to not override non existing keys.
*/
@@ -1727,15 +1765,6 @@ function system_update_8201() {
// Empty update to cause a cache rebuild.
}
-/**
- * @} End of "addtogroup updates-8.2.0".
- */
-
-/**
- * @addtogroup updates-8.2.3
- * @{
- */
-
/**
* Clear caches due to behavior change in MachineName element.
*/
@@ -1744,5 +1773,19 @@ function system_update_8202() {
}
/**
- * @} End of "addtogroup updates-8.2.3".
+ * Add detailed cron logging configuration.
*/
+function system_update_8300() {
+ \Drupal::configFactory()->getEditable('system.cron')
+ ->set('logging', 1)
+ ->save(TRUE);
+}
+
+/**
+ * Add install profile to core.extension configuration.
+ */
+function system_update_8301() {
+ \Drupal::configFactory()->getEditable('core.extension')
+ ->set('profile', \Drupal::installProfile())
+ ->save();
+}
diff --git a/web/core/modules/system/system.libraries.yml b/web/core/modules/system/system.libraries.yml
index 206ae4fc8..98eb28391 100644
--- a/web/core/modules/system/system.libraries.yml
+++ b/web/core/modules/system/system.libraries.yml
@@ -19,6 +19,9 @@ base:
css/components/reset-appearance.module.css: { weight: -10 }
css/components/resize.module.css: { weight: -10 }
css/components/sticky-header.module.css: { weight: -10 }
+ css/components/system-status-counter.css: { weight: -10 }
+ css/components/system-status-report-counters.css: { weight: -10 }
+ css/components/system-status-report-general-info.css: { weight: -10 }
css/components/tabledrag.module.css: { weight: -10 }
css/components/tablesort.module.css: { weight: -10 }
css/components/tree-child.module.css: { weight: -10 }
diff --git a/web/core/modules/system/system.module b/web/core/modules/system/system.module
index 93f4e9b42..a1a6b715a 100644
--- a/web/core/modules/system/system.module
+++ b/web/core/modules/system/system.module
@@ -30,16 +30,25 @@ use GuzzleHttp\Exception\RequestException;
/**
* New users will be set to the default time zone at registration.
+ *
+ * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
+ * Use \Drupal\user\UserInterface::TIMEZONE_DEFAULT instead.
*/
const DRUPAL_USER_TIMEZONE_DEFAULT = 0;
/**
* New users will get an empty time zone at registration.
+ *
+ * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
+ * Use \Drupal\user\UserInterface::TIMEZONE_EMPTY instead.
*/
const DRUPAL_USER_TIMEZONE_EMPTY = 1;
/**
* New users will select their own timezone at registration.
+ *
+ * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
+ * Use \Drupal\user\UserInterface::TIMEZONE_SELECT instead.
*/
const DRUPAL_USER_TIMEZONE_SELECT = 2;
@@ -61,6 +70,9 @@ const DRUPAL_REQUIRED = 2;
/**
* Return only visible regions.
*
+ * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
+ * Use \Drupal\block\BlockRepositoryInterface::REGIONS_VISIBLE instead.
+ *
* @see system_region_list()
*/
const REGIONS_VISIBLE = 'visible';
@@ -68,6 +80,9 @@ const REGIONS_VISIBLE = 'visible';
/**
* Return all regions.
*
+ * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
+ * Use \Drupal\block\BlockRepositoryInterface::REGIONS_ALL instead.
+ *
* @see system_region_list()
*/
const REGIONS_ALL = 'all';
@@ -80,29 +95,29 @@ function system_help($route_name, RouteMatchInterface $route_match) {
case 'help.page.system':
$output = '';
$output .= '
' . t('About') . '
';
- $output .= '
' . t('The System module is integral to the site: it provides user interfaces for many core systems and settings, as well as the basic administrative menu structure. For more information, see the online documentation for the System module.', array(':system' => 'https://www.drupal.org/documentation/modules/system')) . '
';
+ $output .= '
' . t('The System module is integral to the site: it provides user interfaces for many core systems and settings, as well as the basic administrative menu structure. For more information, see the online documentation for the System module.', [':system' => 'https://www.drupal.org/documentation/modules/system']) . '
';
$output .= '
' . t('Uses') . '
';
$output .= '
';
$output .= '- ' . t('Managing modules') . '
';
- $output .= '- ' . t('Users with appropriate permission can install and uninstall modules from the Extend page. Depending on which distribution or installation profile you choose when you install your site, several modules are installed and others are provided but not installed. Each module provides a discrete set of features; modules may be installed or uninstalled depending on the needs of the site. Many additional modules contributed by members of the Drupal community are available for download from the Drupal.org module page. Note that uninstalling a module is a destructive action: when you uninstall a module, you will permanently lose all data connected to the module.', array(':modules' => \Drupal::url('system.modules_list'), ':drupal-modules' => 'https://www.drupal.org/project/modules')) . '
';
+ $output .= '- ' . t('Users with appropriate permission can install and uninstall modules from the Extend page. Depending on which distribution or installation profile you choose when you install your site, several modules are installed and others are provided but not installed. Each module provides a discrete set of features; modules may be installed or uninstalled depending on the needs of the site. Many additional modules contributed by members of the Drupal community are available for download from the Drupal.org module page. Note that uninstalling a module is a destructive action: when you uninstall a module, you will permanently lose all data connected to the module.', [':modules' => \Drupal::url('system.modules_list'), ':drupal-modules' => 'https://www.drupal.org/project/modules']) . '
';
$output .= '- ' . t('Managing themes') . '
';
- $output .= '- ' . t('Users with appropriate permission can install and uninstall themes on the Appearance page. Themes determine the design and presentation of your site. Depending on which distribution or installation profile you choose when you install your site, a default theme is installed, and possibly a different theme for administration pages. Other themes are provided but not installed, and additional contributed themes are available at the Drupal.org theme page.', array(':themes' => \Drupal::url('system.themes_page'), ':drupal-themes' => 'https://www.drupal.org/project/themes')) . '
';
+ $output .= '- ' . t('Users with appropriate permission can install and uninstall themes on the Appearance page. Themes determine the design and presentation of your site. Depending on which distribution or installation profile you choose when you install your site, a default theme is installed, and possibly a different theme for administration pages. Other themes are provided but not installed, and additional contributed themes are available at the Drupal.org theme page.', [':themes' => \Drupal::url('system.themes_page'), ':drupal-themes' => 'https://www.drupal.org/project/themes']) . '
';
$output .= '- ' . t('Disabling drag-and-drop functionality') . '
';
$output .= '- ' . t('The default drag-and-drop user interface for ordering tables in the administrative interface presents a challenge for some users, including users of screen readers and other assistive technology. The drag-and-drop interface can be disabled in a table by clicking a link labeled "Show row weights" above the table. The replacement interface allows users to order the table by choosing numerical weights instead of dragging table rows.') . '
';
$output .= '- ' . t('Configuring basic site settings') . '
';
- $output .= '- ' . t('The System module provides pages for managing basic site configuration, including Date and time formats and Basic site settings (site name, email address to send mail from, home page, and error pages). Additional configuration pages are listed on the main Configuration page.', array(':date-time-settings' => \Drupal::url('entity.date_format.collection'), ':site-info' => \Drupal::url('system.site_information_settings'), ':config' => \Drupal::url('system.admin_config'))) . '
';
+ $output .= '- ' . t('The System module provides pages for managing basic site configuration, including Date and time formats and Basic site settings (site name, email address to send mail from, home page, and error pages). Additional configuration pages are listed on the main Configuration page.', [':date-time-settings' => \Drupal::url('entity.date_format.collection'), ':site-info' => \Drupal::url('system.site_information_settings'), ':config' => \Drupal::url('system.admin_config')]) . '
';
$output .= '- ' . t('Checking site status') . '
';
- $output .= '- ' . t('The Status report provides an overview of the configuration, status, and health of your site. Review this report to make sure there are not any problems to address, and to find information about the software your site and web server are using.', array(':status' => \Drupal::url('system.status'))) . '
';
+ $output .= '- ' . t('The Status report provides an overview of the configuration, status, and health of your site. Review this report to make sure there are not any problems to address, and to find information about the software your site and web server are using.', [':status' => \Drupal::url('system.status')]) . '
';
$output .= '- ' . t('Using maintenance mode') . '
';
- $output .= '- ' . t('When you are performing site maintenance, you can prevent non-administrative users (including anonymous visitors) from viewing your site by putting it in Maintenance mode. This will prevent unauthorized users from making changes to the site while you are performing maintenance, or from seeing a broken site while updates are in progress.', array(':maintenance-mode' => \Drupal::url('system.site_maintenance_mode'))) . '
';
+ $output .= '- ' . t('When you are performing site maintenance, you can prevent non-administrative users (including anonymous visitors) from viewing your site by putting it in Maintenance mode. This will prevent unauthorized users from making changes to the site while you are performing maintenance, or from seeing a broken site while updates are in progress.', [':maintenance-mode' => \Drupal::url('system.site_maintenance_mode')]) . '
';
$output .= '- ' . t('Configuring for performance') . '
';
- $output .= '- ' . t('On the Performance page, the site can be configured to aggregate CSS and JavaScript files, making the total request size smaller. Note that, for small- to medium-sized websites, the Internal Page Cache module should be installed so that pages are efficiently cached and reused for anonymous users. Finally, for websites of all sizes, the Dynamic Page Cache module should also be installed so that the non-personalized parts of pages are efficiently cached (for all users).', array(':performance-page' => \Drupal::url('system.performance_settings'), ':page-cache' => (\Drupal::moduleHandler()->moduleExists('page_cache')) ? \Drupal::url('help.page', array('name' => 'page_cache')) : '#', ':dynamic-page-cache' => (\Drupal::moduleHandler()->moduleExists('dynamic_page_cache')) ? \Drupal::url('help.page', array('name' => 'dynamic_page_cache')) : '#')) . '
';
+ $output .= '- ' . t('On the Performance page, the site can be configured to aggregate CSS and JavaScript files, making the total request size smaller. Note that, for small- to medium-sized websites, the Internal Page Cache module should be installed so that pages are efficiently cached and reused for anonymous users. Finally, for websites of all sizes, the Dynamic Page Cache module should also be installed so that the non-personalized parts of pages are efficiently cached (for all users).', [':performance-page' => \Drupal::url('system.performance_settings'), ':page-cache' => (\Drupal::moduleHandler()->moduleExists('page_cache')) ? \Drupal::url('help.page', ['name' => 'page_cache']) : '#', ':dynamic-page-cache' => (\Drupal::moduleHandler()->moduleExists('dynamic_page_cache')) ? \Drupal::url('help.page', ['name' => 'dynamic_page_cache']) : '#']) . '
';
$output .= '- ' . t('Configuring cron') . '
';
- $output .= '- ' . t('In order for the site and its modules to continue to operate well, a set of routine administrative operations must run on a regular basis; these operations are known as cron tasks. On the Cron page, you can configure cron to run periodically as part of server responses by installing the Automated Cron module, or you can turn this off and trigger cron from an outside process on your web server. You can verify the status of cron tasks by visiting the Status report page. For more information, see the online documentation for configuring cron jobs.', array(':status' => \Drupal::url('system.status'), ':handbook' => 'https://www.drupal.org/cron', ':cron' => \Drupal::url('system.cron_settings'))) . '
';
+ $output .= '- ' . t('In order for the site and its modules to continue to operate well, a set of routine administrative operations must run on a regular basis; these operations are known as cron tasks. On the Cron page, you can configure cron to run periodically as part of server responses by installing the Automated Cron module, or you can turn this off and trigger cron from an outside process on your web server. You can verify the status of cron tasks by visiting the Status report page. For more information, see the online documentation for configuring cron jobs.', [':status' => \Drupal::url('system.status'), ':handbook' => 'https://www.drupal.org/cron', ':cron' => \Drupal::url('system.cron_settings')]) . '
';
$output .= '- ' . t('Configuring the file system') . '
';
- $output .= '- ' . t('Your site has several file directories, which are used to store and process uploaded and generated files. The public file directory, which is configured in your settings.php file, is the default place for storing uploaded files. Links to files in this directory contain the direct file URL, so when the files are requested, the web server will send them directly without invoking your site code. This means that the files can be downloaded by anyone with the file URL, so requests are not access-controlled but they are efficient. The private file directory, also configured in your settings.php file and ideally located outside the site web root, is access controlled. Links to files in this directory are not direct, so requests to these files are mediated by your site code. This means that your site can check file access permission for each file before deciding to fulfill the request, so the requests are more secure, but less efficient. You should only use the private storage for files that need access control, not for files like your site logo and background images used on every page. The temporary file directory is used internally by your site code for various operations, and is configured on the File system settings page. You can also see the configured public and private file directories on this page, and choose whether public or private should be the default for uploaded files.', array(':file-system' => \Drupal::url('system.file_system_settings'))) . '
';
+ $output .= '- ' . t('Your site has several file directories, which are used to store and process uploaded and generated files. The public file directory, which is configured in your settings.php file, is the default place for storing uploaded files. Links to files in this directory contain the direct file URL, so when the files are requested, the web server will send them directly without invoking your site code. This means that the files can be downloaded by anyone with the file URL, so requests are not access-controlled but they are efficient. The private file directory, also configured in your settings.php file and ideally located outside the site web root, is access controlled. Links to files in this directory are not direct, so requests to these files are mediated by your site code. This means that your site can check file access permission for each file before deciding to fulfill the request, so the requests are more secure, but less efficient. You should only use the private storage for files that need access control, not for files like your site logo and background images used on every page. The temporary file directory is used internally by your site code for various operations, and is configured on the File system settings page. You can also see the configured public and private file directories on this page, and choose whether public or private should be the default for uploaded files.', [':file-system' => \Drupal::url('system.file_system_settings')]) . '
';
$output .= '- ' . t('Configuring the image toolkit') . '
';
- $output .= '- ' . t('On the Image toolkit page, you can select and configure the PHP toolkit used to manipulate images. Depending on which distribution or installation profile you choose when you install your site, the GD2 toolkit and possibly others are included; other toolkits may be provided by contributed modules.', array(':toolkit' => \Drupal::url('system.image_toolkit_settings'))) . '
';
+ $output .= '- ' . t('On the Image toolkit page, you can select and configure the PHP toolkit used to manipulate images. Depending on which distribution or installation profile you choose when you install your site, the GD2 toolkit and possibly others are included; other toolkits may be provided by contributed modules.', [':toolkit' => \Drupal::url('system.image_toolkit_settings')]) . '
';
$output .= '
';
return $output;
@@ -110,24 +125,24 @@ function system_help($route_name, RouteMatchInterface $route_match) {
return '
' . t('This page shows you all available administration tasks for each module.') . '
';
case 'system.themes_page':
- $output = '
' . t('Set and configure the default theme for your website. Alternative themes are available.', array(':themes' => 'https://www.drupal.org/project/themes')) . '
';
+ $output = '
' . t('Set and configure the default theme for your website. Alternative themes are available.', [':themes' => 'https://www.drupal.org/project/themes']) . '
';
if (\Drupal::moduleHandler()->moduleExists('block')) {
- $output .= '
' . t('You can place blocks for each theme on the block layout page.', array(':blocks' => \Drupal::url('block.admin_display'))) . '
';
+ $output .= '
' . t('You can place blocks for each theme on the block layout page.', [':blocks' => \Drupal::url('block.admin_display')]) . '
';
}
return $output;
case 'system.theme_settings_theme':
$theme_list = \Drupal::service('theme_handler')->listInfo();
$theme = $theme_list[$route_match->getParameter('theme')];
- return '
' . t('These options control the display settings for the %name theme. When your site is displayed using this theme, these settings will be used.', array('%name' => $theme->info['name'])) . '
';
+ return '
' . t('These options control the display settings for the %name theme. When your site is displayed using this theme, these settings will be used.', ['%name' => $theme->info['name']]) . '
';
case 'system.theme_settings':
return '
' . t('Control default display settings for your site, across all themes. Use theme-specific settings to override these defaults.') . '
';
case 'system.modules_list':
- $output = '
' . t('Download additional contributed modules to extend your site\'s functionality.', array(':modules' => 'https://www.drupal.org/project/modules')) . '
';
+ $output = '
' . t('Download additional contributed modules to extend your site\'s functionality.', [':modules' => 'https://www.drupal.org/project/modules']) . '
';
if (!\Drupal::moduleHandler()->moduleExists('update')) {
- $output .= '
' . t('Regularly review available updates to maintain a secure and current site. Always run the update script each time a module is updated. Enable the Update Manager module to update and install modules and themes.', array(':update-php' => \Drupal::url('system.db_update'), ':update-manager' => \Drupal::url('system.modules_list', [], ['fragment' => 'module-update']))) . '
';
+ $output .= '
' . t('Regularly review available updates to maintain a secure and current site. Always run the update script each time a module is updated. Enable the Update Manager module to update and install modules and themes.', [':update-php' => \Drupal::url('system.db_update'), ':update-manager' => \Drupal::url('system.modules_list', [], ['fragment' => 'module-update'])]) . '
';
}
return $output;
@@ -153,7 +168,7 @@ function system_help($route_name, RouteMatchInterface $route_match) {
break;
case 'system.status':
- return '
' . t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on Drupal.org's support forums and project issue queues. Before filing a support request, ensure that your web server meets the system requirements.", array(':system-requirements' => 'https://www.drupal.org/requirements')) . '
';
+ return '
' . t("Here you can find a short overview of your site's parameters as well as any problems detected with your installation. It may be useful to copy and paste this information into support requests filed on Drupal.org's support forums and project issue queues. Before filing a support request, ensure that your web server meets the system requirements.", [':system-requirements' => 'https://www.drupal.org/requirements']) . '
';
}
}
@@ -161,88 +176,117 @@ function system_help($route_name, RouteMatchInterface $route_match) {
* Implements hook_theme().
*/
function system_theme() {
- return array_merge(drupal_common_theme(), array(
+ return array_merge(drupal_common_theme(), [
// Normally theme suggestion templates are only picked up when they are in
// themes. We explicitly define theme suggestions here so that the block
// templates in core/modules/system/templates are picked up.
- 'block__system_branding_block' => array(
+ 'block__system_branding_block' => [
'render element' => 'elements',
'base hook' => 'block',
- ),
- 'block__system_messages_block' => array(
+ ],
+ 'block__system_messages_block' => [
'base hook' => 'block',
- ),
- 'block__system_menu_block' => array(
+ ],
+ 'block__system_menu_block' => [
'render element' => 'elements',
'base hook' => 'block',
- ),
- 'system_themes_page' => array(
- 'variables' => array(
- 'theme_groups' => array(),
- 'theme_group_titles' => array(),
- ),
+ ],
+ 'system_themes_page' => [
+ 'variables' => [
+ 'theme_groups' => [],
+ 'theme_group_titles' => [],
+ ],
'file' => 'system.admin.inc',
- ),
- 'system_config_form' => array(
+ ],
+ 'system_config_form' => [
'render element' => 'form',
- ),
- 'confirm_form' => array(
+ ],
+ 'confirm_form' => [
'render element' => 'form',
- ),
- 'system_modules_details' => array(
+ ],
+ 'system_modules_details' => [
'render element' => 'form',
'file' => 'system.admin.inc',
- ),
- 'system_modules_uninstall' => array(
+ ],
+ 'system_modules_uninstall' => [
'render element' => 'form',
'file' => 'system.admin.inc',
- ),
- 'status_report' => array(
- 'variables' => array('requirements' => NULL),
+ ],
+ 'status_report_page' => [
+ 'variables' => [
+ 'counters' => [],
+ 'general_info' => [],
+ 'requirements' => NULL,
+ ],
+ ],
+ 'status_report' => [
+ 'variables' => [
+ 'grouped_requirements' => NULL,
+ 'requirements' => NULL,
+ ],
+ ],
+ 'status_report_grouped' => [
+ 'variables' => [
+ 'grouped_requirements' => NULL,
+ 'requirements' => NULL,
+ ],
+ ],
+ 'status_report_counter' => [
+ 'variables' => ['amount' => NULL, 'text' => NULL, 'severity' => NULL],
+ ],
+ 'status_report_general_info' => [
+ 'variables' => [
+ 'drupal' => [],
+ 'cron' => [],
+ 'database_system' => [],
+ 'database_system_version' => [],
+ 'php' => [],
+ 'php_memory_limit' => [],
+ 'webserver' => [],
+ ],
+ ],
+ 'admin_page' => [
+ 'variables' => ['blocks' => NULL],
'file' => 'system.admin.inc',
- ),
- 'admin_page' => array(
- 'variables' => array('blocks' => NULL),
+ ],
+ 'admin_block' => [
+ 'variables' => ['block' => NULL],
'file' => 'system.admin.inc',
- ),
- 'admin_block' => array(
- 'variables' => array('block' => NULL),
+ ],
+ 'admin_block_content' => [
+ 'variables' => ['content' => NULL],
'file' => 'system.admin.inc',
- ),
- 'admin_block_content' => array(
- 'variables' => array('content' => NULL),
+ ],
+ 'system_admin_index' => [
+ 'variables' => ['menu_items' => NULL],
'file' => 'system.admin.inc',
- ),
- 'system_admin_index' => array(
- 'variables' => array('menu_items' => NULL),
- 'file' => 'system.admin.inc',
- ),
- 'entity_add_list' => array(
- 'variables' => array(
- 'bundles' => array(),
+ ],
+ 'entity_add_list' => [
+ 'variables' => [
+ 'bundles' => [],
'add_bundle_message' => NULL,
- ),
+ ],
'template' => 'entity-add-list',
- ),
- ));
+ ],
+ ]);
}
/**
* Implements hook_hook_info().
*/
function system_hook_info() {
- $hooks['token_info'] = array(
+ $hooks['token_info'] = [
'group' => 'tokens',
- );
- $hooks['token_info_alter'] = array(
+ ];
+ $hooks['token_info_alter'] = [
'group' => 'tokens',
- );
- $hooks['tokens'] = array(
+ ];
+ $hooks['tokens'] = [
'group' => 'tokens',
- );
- $hooks['tokens_alter'] = array(
+ ];
+ $hooks['tokens_alter'] = [
'group' => 'tokens',
- );
+ ];
return $hooks;
}
@@ -251,12 +295,7 @@ function system_hook_info() {
* Implements hook_theme_suggestions_HOOK().
*/
function system_theme_suggestions_html(array $variables) {
- if (\Drupal::service('path.matcher')->isFrontPage()) {
- $path_args = [''];
- }
- else {
- $path_args = explode('/', ltrim(\Drupal::service('path.current')->getPath(), '/'));
- }
+ $path_args = explode('/', trim(\Drupal::service('path.current')->getPath(), '/'));
return theme_get_suggestions($path_args, 'html');
}
@@ -264,12 +303,7 @@ function system_theme_suggestions_html(array $variables) {
* Implements hook_theme_suggestions_HOOK().
*/
function system_theme_suggestions_page(array $variables) {
- if (\Drupal::service('path.matcher')->isFrontPage()) {
- $path_args = [''];
- }
- else {
- $path_args = explode('/', Url::fromRoute('
')->getInternalPath());
- }
+ $path_args = explode('/', trim(\Drupal::service('path.current')->getPath(), '/'));
return theme_get_suggestions($path_args, 'page');
}
@@ -277,7 +311,7 @@ function system_theme_suggestions_page(array $variables) {
* Implements hook_theme_suggestions_HOOK().
*/
function system_theme_suggestions_maintenance_page(array $variables) {
- $suggestions = array();
+ $suggestions = [];
// Dead databases will show error messages so supplying this template will
// allow themers to override the page and the content completely.
@@ -300,7 +334,7 @@ function system_theme_suggestions_maintenance_page(array $variables) {
* Implements hook_theme_suggestions_HOOK().
*/
function system_theme_suggestions_region(array $variables) {
- $suggestions = array();
+ $suggestions = [];
if (!empty($variables['elements']['#region'])) {
$suggestions[] = 'region__' . $variables['elements']['#region'];
}
@@ -311,7 +345,7 @@ function system_theme_suggestions_region(array $variables) {
* Implements hook_theme_suggestions_HOOK().
*/
function system_theme_suggestions_field(array $variables) {
- $suggestions = array();
+ $suggestions = [];
$element = $variables['element'];
$suggestions[] = 'field__' . $element['#field_type'];
@@ -418,18 +452,18 @@ function template_preprocess_entity_add_list(&$variables) {
* @return
* Nothing, this function just initializes variables in the user's session.
*/
-function system_authorized_init($callback, $file, $arguments = array(), $page_title = NULL) {
+function system_authorized_init($callback, $file, $arguments = [], $page_title = NULL) {
// First, figure out what file transfer backends the site supports, and put
// all of those in the SESSION so that authorize.php has access to all of
// them via the class autoloader, even without a full bootstrap.
$_SESSION['authorize_filetransfer_info'] = drupal_get_filetransfer_info();
// Now, define the callback to invoke.
- $_SESSION['authorize_operation'] = array(
+ $_SESSION['authorize_operation'] = [
'callback' => $callback,
'file' => $file,
'arguments' => $arguments,
- );
+ ];
if (isset($page_title)) {
$_SESSION['authorize_page_title'] = $page_title;
@@ -446,7 +480,7 @@ function system_authorized_init($callback, $file, $arguments = array(), $page_ti
*
* @see system_authorized_init()
*/
-function system_authorized_get_url(array $options = array()) {
+function system_authorized_get_url(array $options = []) {
// core/authorize.php is an unrouted URL, so using the base: scheme is
// the correct usage for this case.
$url = Url::fromUri('base:core/authorize.php');
@@ -463,8 +497,8 @@ function system_authorized_get_url(array $options = array()) {
*
* @return \Drupal\Core\Url
*/
-function system_authorized_batch_processing_url(array $options = array()) {
- $options['query'] = array('batch' => '1');
+function system_authorized_batch_processing_url(array $options = []) {
+ $options['query'] = ['batch' => '1'];
return system_authorized_get_url($options);
}
@@ -473,7 +507,7 @@ function system_authorized_batch_processing_url(array $options = array()) {
*
* @see system_authorized_init()
*/
-function system_authorized_run($callback, $file, $arguments = array(), $page_title = NULL) {
+function system_authorized_run($callback, $file, $arguments = [], $page_title = NULL) {
system_authorized_init($callback, $file, $arguments, $page_title);
return new RedirectResponse(system_authorized_get_url()->toString());
}
@@ -497,43 +531,43 @@ function system_authorized_batch_process() {
* Implements hook_updater_info().
*/
function system_updater_info() {
- return array(
- 'module' => array(
+ return [
+ 'module' => [
'class' => 'Drupal\Core\Updater\Module',
'name' => t('Update modules'),
'weight' => 0,
- ),
- 'theme' => array(
+ ],
+ 'theme' => [
'class' => 'Drupal\Core\Updater\Theme',
'name' => t('Update themes'),
'weight' => 0,
- ),
- );
+ ],
+ ];
}
/**
* Implements hook_filetransfer_info().
*/
function system_filetransfer_info() {
- $backends = array();
+ $backends = [];
// This is the default, will be available on most systems.
if (function_exists('ftp_connect')) {
- $backends['ftp'] = array(
+ $backends['ftp'] = [
'title' => t('FTP'),
'class' => 'Drupal\Core\FileTransfer\FTP',
'weight' => 0,
- );
+ ];
}
// SSH2 lib connection is only available if the proper PHP extension is
// installed.
if (function_exists('ssh2_connect')) {
- $backends['ssh'] = array(
+ $backends['ssh'] = [
'title' => t('SSH'),
'class' => 'Drupal\Core\FileTransfer\SSH',
'weight' => 20,
- );
+ ];
}
return $backends;
}
@@ -561,61 +595,61 @@ function system_page_attachments(array &$page) {
if (theme_get_setting('features.favicon')) {
$favicon = theme_get_setting('favicon.url');
$type = theme_get_setting('favicon.mimetype');
- $page['#attached']['html_head_link'][][] = array(
+ $page['#attached']['html_head_link'][][] = [
'rel' => 'shortcut icon',
'href' => UrlHelper::stripDangerousProtocols($favicon),
'type' => $type,
- );
+ ];
}
// Get the major Drupal version.
list($version, ) = explode('.', \Drupal::VERSION);
// Attach default meta tags.
- $meta_default = array(
+ $meta_default = [
// Make sure the Content-Type comes first because the IE browser may be
// vulnerable to XSS via encoding attacks from any content that comes
// before this META tag, such as a TITLE tag.
- 'system_meta_content_type' => array(
+ 'system_meta_content_type' => [
'#tag' => 'meta',
- '#attributes' => array(
+ '#attributes' => [
'charset' => 'utf-8',
- ),
+ ],
// Security: This always has to be output first.
'#weight' => -1000,
- ),
+ ],
// Show Drupal and the major version number in the META GENERATOR tag.
- 'system_meta_generator' => array(
+ 'system_meta_generator' => [
'#type' => 'html_tag',
'#tag' => 'meta',
- '#attributes' => array(
+ '#attributes' => [
'name' => 'Generator',
'content' => 'Drupal ' . $version . ' (https://www.drupal.org)',
- ),
- ),
+ ],
+ ],
// Attach default mobile meta tags for responsive design.
- 'MobileOptimized' => array(
+ 'MobileOptimized' => [
'#tag' => 'meta',
- '#attributes' => array(
+ '#attributes' => [
'name' => 'MobileOptimized',
'content' => 'width',
- ),
- ),
- 'HandheldFriendly' => array(
+ ],
+ ],
+ 'HandheldFriendly' => [
'#tag' => 'meta',
- '#attributes' => array(
+ '#attributes' => [
'name' => 'HandheldFriendly',
'content' => 'true',
- ),
- ),
- 'viewport' => array(
+ ],
+ ],
+ 'viewport' => [
'#tag' => 'meta',
- '#attributes' => array(
+ '#attributes' => [
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1.0',
- ),
- ),
- );
+ ],
+ ],
+ ];
foreach ($meta_default as $key => $value) {
$page['#attached']['html_head'][] = [$value, $key];
}
@@ -790,7 +824,7 @@ function system_user_login(UserInterface $account) {
$config = \Drupal::config('system.date');
// If the user has a NULL time zone, notify them to set a time zone.
if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) {
- drupal_set_message(t('Configure your account time zone setting.', array(':user-edit' => $account->url('edit-form', array('query' => \Drupal::destination()->getAsArray(), 'fragment' => 'edit-timezone')))));
+ drupal_set_message(t('Configure your account time zone setting.', [':user-edit' => $account->url('edit-form', ['query' => \Drupal::destination()->getAsArray(), 'fragment' => 'edit-timezone'])]));
}
}
@@ -801,23 +835,23 @@ function system_user_timezone(&$form, FormStateInterface $form_state) {
$user = \Drupal::currentUser();
$account = $form_state->getFormObject()->getEntity();
- $form['timezone'] = array(
+ $form['timezone'] = [
'#type' => 'details',
'#title' => t('Locale settings'),
'#open' => TRUE,
'#weight' => 6,
- );
- $form['timezone']['timezone'] = array(
+ ];
+ $form['timezone']['timezone'] = [
'#type' => 'select',
'#title' => t('Time zone'),
'#default_value' => $account->getTimezone() ? $account->getTimezone() : \Drupal::config('system.date')->get('timezone.default'),
'#options' => system_time_zones($account->id() != $user->id()),
'#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'),
- );
+ ];
$user_input = $form_state->getUserInput();
if (!$account->getTimezone() && $account->id() == $user->id() && empty($user_input['timezone'])) {
$form['timezone']['#attached']['library'][] = 'core/drupal.timezone';
- $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect'));
+ $form['timezone']['timezone']['#attributes'] = ['class' => ['timezone-detect']];
}
}
@@ -869,14 +903,14 @@ function system_check_directory($form_element, FormStateInterface $form_state) {
$logger = \Drupal::logger('file system');
if (!is_dir($directory) && !drupal_mkdir($directory, NULL, TRUE)) {
// If the directory does not exists and cannot be created.
- $form_state->setErrorByName($form_element['#parents'][0], t('The directory %directory does not exist and could not be created.', array('%directory' => $directory)));
- $logger->error('The directory %directory does not exist and could not be created.', array('%directory' => $directory));
+ $form_state->setErrorByName($form_element['#parents'][0], t('The directory %directory does not exist and could not be created.', ['%directory' => $directory]));
+ $logger->error('The directory %directory does not exist and could not be created.', ['%directory' => $directory]);
}
if (is_dir($directory) && !is_writable($directory) && !drupal_chmod($directory)) {
// If the directory is not writable and cannot be made so.
- $form_state->setErrorByName($form_element['#parents'][0], t('The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory)));
- $logger->error('The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory));
+ $form_state->setErrorByName($form_element['#parents'][0], t('The directory %directory exists but is not writable and could not be made writable.', ['%directory' => $directory]));
+ $logger->error('The directory %directory exists but is not writable and could not be made writable.', ['%directory' => $directory]);
}
elseif (is_dir($directory)) {
if ($form_element['#name'] == 'file_public_path') {
@@ -937,7 +971,7 @@ function system_get_info($type, $name = NULL) {
}
}
else {
- $info = array();
+ $info = [];
$list = system_list($type);
foreach ($list as $shortname => $item) {
if (!empty($item->status)) {
@@ -946,7 +980,7 @@ function system_get_info($type, $name = NULL) {
}
}
if (isset($name)) {
- return isset($info[$name]) ? $info[$name] : array();
+ return isset($info[$name]) ? $info[$name] : [];
}
return $info;
}
@@ -983,13 +1017,13 @@ function _system_rebuild_module_data() {
}
// Set defaults for module info.
- $defaults = array(
- 'dependencies' => array(),
+ $defaults = [
+ 'dependencies' => [],
'description' => '',
'package' => 'Other',
'version' => NULL,
'php' => DRUPAL_MINIMUM_PHP,
- );
+ ];
// Read info files for each module.
foreach ($modules as $key => $module) {
@@ -1051,7 +1085,7 @@ function _system_rebuild_module_data_ensure_required($module, &$modules) {
$dependency_name = ModuleHandler::parseDependency($dependency)['name'];
if (!isset($modules[$dependency_name]->info['required'])) {
$modules[$dependency_name]->info['required'] = TRUE;
- $modules[$dependency_name]->info['explanation'] = t('Dependency of required module @module', array('@module' => $module->info['name']));
+ $modules[$dependency_name]->info['explanation'] = t('Dependency of required module @module', ['@module' => $module->info['name']]);
// Ensure any dependencies it has are required.
_system_rebuild_module_data_ensure_required($modules[$dependency_name], $modules);
}
@@ -1072,10 +1106,10 @@ function system_rebuild_module_data() {
// reference from system_list_reset() during the rebuild.
if (!isset($modules_cache)) {
$modules = _system_rebuild_module_data();
- $files = array();
+ $files = [];
ksort($modules);
// Add status, weight, and schema version.
- $installed_modules = \Drupal::config('core.extension')->get('module') ?: array();
+ $installed_modules = \Drupal::config('core.extension')->get('module') ?: [];
foreach ($modules as $name => $module) {
$module->weight = isset($installed_modules[$name]) ? $installed_modules[$name] : 0;
$module->status = (int) isset($installed_modules[$name]);
@@ -1110,11 +1144,11 @@ function system_region_list($theme, $show = REGIONS_ALL) {
if (!$theme instanceof Extension) {
$themes = \Drupal::service('theme_handler')->listInfo();
if (!isset($themes[$theme])) {
- return array();
+ return [];
}
$theme = $themes[$theme];
}
- $list = array();
+ $list = [];
$info = $theme->info;
// If requested, suppress hidden regions. See block_admin_display_form().
foreach ($info['regions'] as $name => $label) {
@@ -1219,15 +1253,15 @@ function system_get_module_admin_tasks($module, array $info) {
$parameters = new MenuTreeParameters();
$parameters->setRoot('system.admin')->excludeRoot()->onlyEnabledLinks();
$tree = $menu_tree->load('system.admin', $parameters);
- $manipulators = array(
- array('callable' => 'menu.default_tree_manipulators:checkAccess'),
- array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'),
- array('callable' => 'menu.default_tree_manipulators:flatten'),
- );
+ $manipulators = [
+ ['callable' => 'menu.default_tree_manipulators:checkAccess'],
+ ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
+ ['callable' => 'menu.default_tree_manipulators:flatten'],
+ ];
$tree = $menu_tree->transform($tree, $manipulators);
}
- $admin_tasks = array();
+ $admin_tasks = [];
foreach ($tree as $element) {
if (!$element->access->isAllowed()) {
// @todo Bubble cacheability metadata of both accessible and inaccessible
@@ -1239,11 +1273,11 @@ function system_get_module_admin_tasks($module, array $info) {
if ($link->getProvider() != $module) {
continue;
}
- $admin_tasks[] = array(
+ $admin_tasks[] = [
'title' => $link->getTitle(),
'description' => $link->getDescription(),
'url' => $link->getUrlObject(),
- );
+ ];
}
// Append link for permissions.
@@ -1253,15 +1287,15 @@ function system_get_module_admin_tasks($module, array $info) {
if ($permission_handler->moduleProvidesPermissions($module)) {
/** @var \Drupal\Core\Access\AccessManagerInterface $access_manager */
$access_manager = \Drupal::service('access_manager');
- if ($access_manager->checkNamedRoute('user.admin_permissions', array(), \Drupal::currentUser())) {
+ if ($access_manager->checkNamedRoute('user.admin_permissions', [], \Drupal::currentUser())) {
/** @var \Drupal\Core\Url $url */
$url = new Url('user.admin_permissions');
$url->setOption('fragment', 'module-' . $module);
- $admin_tasks["user.admin_permissions.$module"] = array(
- 'title' => t('Configure @module permissions', array('@module' => $info['name'])),
+ $admin_tasks["user.admin_permissions.$module"] = [
+ 'title' => t('Configure @module permissions', ['@module' => $info['name']]),
'description' => '',
'url' => $url,
- );
+ ];
}
}
@@ -1314,7 +1348,7 @@ function system_mail($key, &$message, $params) {
$subject = PlainTextOutput::renderFromHtml($token_service->replace($context['subject'], $context));
$body = $token_service->replace($context['message'], $context);
- $message['subject'] .= str_replace(array("\r", "\n"), '', $subject);
+ $message['subject'] .= str_replace(["\r", "\n"], '', $subject);
$message['body'][] = $body;
}
@@ -1326,13 +1360,13 @@ function system_mail($key, &$message, $params) {
*/
function system_time_zones($blank = NULL) {
$zonelist = timezone_identifiers_list();
- $zones = $blank ? array('' => t('- None selected -')) : array();
+ $zones = $blank ? ['' => t('- None selected -')] : [];
foreach ($zonelist as $zone) {
// Because many time zones exist in PHP only for backward compatibility
// reasons and should not be used, the list is filtered by a regular
// expression.
if (preg_match('!^((Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Europe|Indian|Pacific)/|UTC$)!', $zone)) {
- $zones[$zone] = t('@zone', array('@zone' => t(str_replace('_', ' ', $zone))));
+ $zones[$zone] = t('@zone', ['@zone' => t(str_replace('_', ' ', $zone))]);
}
}
// Sort the translated time zones alphabetically.
@@ -1391,11 +1425,11 @@ function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $repl
$local = $managed ? file_save_data($data, $path, $replace) : file_unmanaged_save_data($data, $path, $replace);
}
catch (RequestException $exception) {
- drupal_set_message(t('Failed to fetch file due to error "%error"', array('%error' => $exception->getMessage())), 'error');
+ drupal_set_message(t('Failed to fetch file due to error "%error"', ['%error' => $exception->getMessage()]), 'error');
return FALSE;
}
if (!$local) {
- drupal_set_message(t('@remote could not be saved to @path.', array('@remote' => $url, '@path' => $path)), 'error');
+ drupal_set_message(t('@remote could not be saved to @path.', ['@remote' => $url, '@path' => $path]), 'error');
}
return $local;
diff --git a/web/core/modules/system/system.post_update.php b/web/core/modules/system/system.post_update.php
index b75625c32..b96d3e3b3 100644
--- a/web/core/modules/system/system.post_update.php
+++ b/web/core/modules/system/system.post_update.php
@@ -5,10 +5,9 @@
* Post update functions for System.
*/
-/**
- * @addtogroup updates-8.0.0-beta
- * @{
- */
+use Drupal\Core\Entity\Display\EntityDisplayInterface;
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
/**
* Re-save all configuration entities to recalculate dependencies.
@@ -39,5 +38,30 @@ function system_post_update_recalculate_configuration_entity_dependencies(&$sand
}
/**
- * @} End of "addtogroup updates-8.0.0-beta".
+ * Update entity displays to contain the region for each field.
*/
+function system_post_update_add_region_to_entity_displays() {
+ $entity_save = function (EntityDisplayInterface $entity) {
+ // preSave() will fill in the correct region based on the 'type'.
+ $entity->save();
+ };
+ array_map($entity_save, EntityViewDisplay::loadMultiple());
+ array_map($entity_save, EntityFormDisplay::loadMultiple());
+}
+
+
+/**
+ * Force caches using hashes to be cleared (Twig, render cache, etc.).
+ */
+function system_post_update_hashes_clear_cache() {
+ // Empty post-update hook.
+}
+
+/**
+ * Force plugin definitions to be cleared.
+ *
+ * @see https://www.drupal.org/node/2802663
+ */
+function system_post_update_timestamp_plugins() {
+ // Empty post-update hook.
+}
diff --git a/web/core/modules/system/system.routing.yml b/web/core/modules/system/system.routing.yml
index ae89fb038..ee9afc151 100644
--- a/web/core/modules/system/system.routing.yml
+++ b/web/core/modules/system/system.routing.yml
@@ -460,8 +460,6 @@ system.batch_page.html:
_format: 'html'
options:
_admin_route: TRUE
- # @todo Remove the '_no_big_pipe' route option when https://www.drupal.org/node/2589967 lands.
- _no_big_pipe: TRUE
system.batch_page.json:
path: '/batch'
diff --git a/web/core/modules/system/system.tokens.inc b/web/core/modules/system/system.tokens.inc
index 66b5c7faf..55c89ae9f 100644
--- a/web/core/modules/system/system.tokens.inc
+++ b/web/core/modules/system/system.tokens.inc
@@ -14,74 +14,74 @@ use Drupal\Core\Render\BubbleableMetadata;
* Implements hook_token_info().
*/
function system_token_info() {
- $types['site'] = array(
+ $types['site'] = [
'name' => t("Site information"),
'description' => t("Tokens for site-wide settings and other global information."),
- );
- $types['date'] = array(
+ ];
+ $types['date'] = [
'name' => t("Dates"),
'description' => t("Tokens related to times and dates."),
- );
+ ];
// Site-wide global tokens.
- $site['name'] = array(
+ $site['name'] = [
'name' => t("Name"),
'description' => t("The name of the site."),
- );
- $site['slogan'] = array(
+ ];
+ $site['slogan'] = [
'name' => t("Slogan"),
'description' => t("The slogan of the site."),
- );
- $site['mail'] = array(
+ ];
+ $site['mail'] = [
'name' => t("Email"),
'description' => t("The administrative email address for the site."),
- );
- $site['url'] = array(
+ ];
+ $site['url'] = [
'name' => t("URL"),
'description' => t("The URL of the site's front page."),
- );
- $site['url-brief'] = array(
+ ];
+ $site['url-brief'] = [
'name' => t("URL (brief)"),
'description' => t("The URL of the site's front page without the protocol."),
- );
- $site['login-url'] = array(
+ ];
+ $site['login-url'] = [
'name' => t("Login page"),
'description' => t("The URL of the site's login page."),
- );
+ ];
// Date related tokens.
- $date['short'] = array(
+ $date['short'] = [
'name' => t("Short format"),
- 'description' => t("A date in 'short' format. (%date)", array('%date' => format_date(REQUEST_TIME, 'short'))),
- );
- $date['medium'] = array(
+ 'description' => t("A date in 'short' format. (%date)", ['%date' => format_date(REQUEST_TIME, 'short')]),
+ ];
+ $date['medium'] = [
'name' => t("Medium format"),
- 'description' => t("A date in 'medium' format. (%date)", array('%date' => format_date(REQUEST_TIME, 'medium'))),
- );
- $date['long'] = array(
+ 'description' => t("A date in 'medium' format. (%date)", ['%date' => format_date(REQUEST_TIME, 'medium')]),
+ ];
+ $date['long'] = [
'name' => t("Long format"),
- 'description' => t("A date in 'long' format. (%date)", array('%date' => format_date(REQUEST_TIME, 'long'))),
- );
- $date['custom'] = array(
+ 'description' => t("A date in 'long' format. (%date)", ['%date' => format_date(REQUEST_TIME, 'long')]),
+ ];
+ $date['custom'] = [
'name' => t("Custom format"),
'description' => t('A date in a custom format. See the PHP documentation for details.'),
- );
- $date['since'] = array(
+ ];
+ $date['since'] = [
'name' => t("Time-since"),
- 'description' => t("A date in 'time-since' format. (%date)", array('%date' => \Drupal::service('date.formatter')->formatTimeDiffSince(REQUEST_TIME - 360))),
- );
- $date['raw'] = array(
+ 'description' => t("A date in 'time-since' format. (%date)", ['%date' => \Drupal::service('date.formatter')->formatTimeDiffSince(REQUEST_TIME - 360)]),
+ ];
+ $date['raw'] = [
'name' => t("Raw timestamp"),
- 'description' => t("A date in UNIX timestamp format (%date)", array('%date' => REQUEST_TIME)),
- );
+ 'description' => t("A date in UNIX timestamp format (%date)", ['%date' => REQUEST_TIME]),
+ ];
- return array(
+ return [
'types' => $types,
- 'tokens' => array(
+ 'tokens' => [
'site' => $site,
'date' => $date,
- ),
- );
+ ],
+ ];
}
/**
@@ -90,7 +90,7 @@ function system_token_info() {
function system_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
$token_service = \Drupal::token();
- $url_options = array('absolute' => TRUE);
+ $url_options = ['absolute' => TRUE];
if (isset($options['langcode'])) {
$url_options['language'] = \Drupal::languageManager()->getLanguage($options['langcode']);
$langcode = $options['langcode'];
@@ -98,7 +98,7 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
else {
$langcode = NULL;
}
- $replacements = array();
+ $replacements = [];
if ($type == 'site') {
foreach ($tokens as $name => $original) {
@@ -129,16 +129,16 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
case 'url':
/** @var \Drupal\Core\GeneratedUrl $result */
- $result = \Drupal::url('', array(), $url_options, TRUE);
+ $result = \Drupal::url('', [], $url_options, TRUE);
$bubbleable_metadata->addCacheableDependency($result);
$replacements[$original] = $result->getGeneratedUrl();
break;
case 'url-brief':
/** @var \Drupal\Core\GeneratedUrl $result */
- $result = \Drupal::url('', array(), $url_options, TRUE);
+ $result = \Drupal::url('', [], $url_options, TRUE);
$bubbleable_metadata->addCacheableDependency($result);
- $replacements[$original] = preg_replace(array('!^https?://!', '!/$!'), '', $result->getGeneratedUrl());
+ $replacements[$original] = preg_replace(['!^https?://!', '!/$!'], '', $result->getGeneratedUrl());
break;
case 'login-url':
@@ -173,7 +173,7 @@ function system_tokens($type, $tokens, array $data, array $options, BubbleableMe
break;
case 'since':
- $replacements[$original] = \Drupal::service('date.formatter')->formatTimeDiffSince($date, array('langcode' => $langcode));
+ $replacements[$original] = \Drupal::service('date.formatter')->formatTimeDiffSince($date, ['langcode' => $langcode]);
$bubbleable_metadata->setCacheMaxAge(0);
break;
diff --git a/web/core/modules/system/templates/datetime-wrapper.html.twig b/web/core/modules/system/templates/datetime-wrapper.html.twig
index 8430baaa1..a14da8937 100644
--- a/web/core/modules/system/templates/datetime-wrapper.html.twig
+++ b/web/core/modules/system/templates/datetime-wrapper.html.twig
@@ -30,4 +30,8 @@
{{ errors }}
{% endif %}
-{{ description }}
+{% if description %}
+