Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -53,10 +53,11 @@ function system_requirements($phase) {
|
|||
|
||||
// Warn if any experimental modules are installed.
|
||||
$experimental = array();
|
||||
$enabled_modules = system_rebuild_module_data();
|
||||
$enabled_modules = \Drupal::moduleHandler()->getModuleList();
|
||||
foreach ($enabled_modules as $module => $data) {
|
||||
if ($data->info['package'] === 'Core (Experimental)') {
|
||||
$experimental[$module] = $data->info['name'];
|
||||
$info = system_get_info('module', $module);
|
||||
if ($info['package'] === 'Core (Experimental)') {
|
||||
$experimental[$module] = $info['name'];
|
||||
}
|
||||
}
|
||||
if (!empty($experimental)) {
|
||||
|
@ -135,7 +136,7 @@ function system_requirements($phase) {
|
|||
'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 <a href="@link">enabling clean URLs</a> 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 <a href=":link">enabling clean URLs</a> page for more information on mod_rewrite.', array(':link' => 'http://drupal.org/node/15365')),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -144,7 +145,7 @@ function system_requirements($phase) {
|
|||
'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. <a href="@link">Enable clean URLs</a>', 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. <a href=":link">Enable clean URLs</a>', array(':link' => 'http://drupal.org/node/15365')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +154,7 @@ function system_requirements($phase) {
|
|||
$phpversion = $phpversion_label = phpversion();
|
||||
if (function_exists('phpinfo')) {
|
||||
if ($phase === 'runtime') {
|
||||
$phpversion_label = t('@phpversion (<a href="@url">more information</a>)', ['@phpversion' => $phpversion, '@url' => (new Url('system.php'))->toString()]);
|
||||
$phpversion_label = t('@phpversion (<a href=":url">more information</a>)', ['@phpversion' => $phpversion, ':url' => (new Url('system.php'))->toString()]);
|
||||
}
|
||||
$requirements['php'] = array(
|
||||
'title' => t('PHP'),
|
||||
|
@ -164,7 +165,7 @@ function system_requirements($phase) {
|
|||
$requirements['php'] = array(
|
||||
'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, <a href="@phpinfo">Enabling and disabling phpinfo()</a> 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, <a href=":phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array(':phpinfo' => 'https://www.drupal.org/node/243993')),
|
||||
'severity' => REQUIREMENT_INFO,
|
||||
);
|
||||
}
|
||||
|
@ -215,8 +216,8 @@ function system_requirements($phase) {
|
|||
}
|
||||
|
||||
if (!empty($missing_extensions)) {
|
||||
$description = t('Drupal requires you to enable the PHP extensions in the following list (see the <a href="@system_requirements">system requirements page</a> for more information):', array(
|
||||
'@system_requirements' => 'https://www.drupal.org/requirements',
|
||||
$description = t('Drupal requires you to enable the PHP extensions in the following list (see the <a href=":system_requirements">system requirements page</a> for more information):', array(
|
||||
':system_requirements' => 'https://www.drupal.org/requirements',
|
||||
));
|
||||
|
||||
// We use twig inline_template to avoid twig's autoescape.
|
||||
|
@ -240,6 +241,22 @@ function system_requirements($phase) {
|
|||
$requirements['php_extensions']['value'] = t('Enabled');
|
||||
}
|
||||
|
||||
if ($phase == 'install' || $phase == 'runtime') {
|
||||
// Check to see if OPcache is installed.
|
||||
$opcache_enabled = (function_exists('opcache_get_status') && opcache_get_status()['opcache_enabled']);
|
||||
if (!$opcache_enabled) {
|
||||
$requirements['php_opcache'] = array(
|
||||
'value' => t('Not enabled'),
|
||||
'severity' => REQUIREMENT_WARNING,
|
||||
'description' => t('PHP OPcode caching can improve your site\'s performance considerably. It is <strong>highly recommended</strong> to have <a href=":opcache_link" target="_blank">OPcache</a> installed on your server.', array(':opcache_link' => 'http://php.net/manual/en/opcache.installation.php')),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$requirements['php_opcache']['value'] = t('Enabled');
|
||||
}
|
||||
$requirements['php_opcache']['title'] = t('PHP OPcode caching');
|
||||
}
|
||||
|
||||
if ($phase == 'install' || $phase == 'update') {
|
||||
// Test for PDO (database).
|
||||
$requirements['database_extensions'] = array(
|
||||
|
@ -249,8 +266,8 @@ function system_requirements($phase) {
|
|||
// 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 <a href="@link">system requirements</a> page for more information.', array(
|
||||
'@link' => 'https://www.drupal.org/requirements/pdo',
|
||||
$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 <a href=":link">system requirements</a> page for more information.', array(
|
||||
':link' => 'https://www.drupal.org/requirements/pdo',
|
||||
));
|
||||
}
|
||||
else {
|
||||
|
@ -258,16 +275,16 @@ function system_requirements($phase) {
|
|||
$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 <a href="@drupal-databases">Drupal supports</a>.', array(
|
||||
'@drupal-databases' => 'https://www.drupal.org/node/270#database',
|
||||
$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 <a href=":drupal-databases">Drupal supports</a>.', array(
|
||||
':drupal-databases' => 'https://www.drupal.org/node/270#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 <a href="@link">system requirements</a> page for more information.', array(
|
||||
'@link' => 'https://www.drupal.org/requirements/pdo#pecl',
|
||||
$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 <a href=":link">system requirements</a> page for more information.', array(
|
||||
':link' => 'https://www.drupal.org/requirements/pdo#pecl',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +339,7 @@ function system_requirements($phase) {
|
|||
$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 <a href="@memory-limit">increasing the PHP memory limit</a>.', array('@memory-limit' => 'https://www.drupal.org/node/207036'));
|
||||
$handbook_link = t('For more information, see the online handbook entry for <a href=":memory-limit">increasing the PHP memory limit</a>.', array(':memory-limit' => 'https://www.drupal.org/node/207036'));
|
||||
|
||||
$description = array(
|
||||
'#type' => 'inline_template',
|
||||
|
@ -413,11 +430,12 @@ function system_requirements($phase) {
|
|||
// 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(
|
||||
'title' => $info['title'],
|
||||
'value' => t('Not fully protected'),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => t('See <a href="@url">@url</a> for information about the recommended .htaccess file which should be added to the %directory directory to help protect against arbitrary code execution.', array('@url' => 'https://www.drupal.org/SA-CORE-2013-003', '%directory' => $info['directory'])),
|
||||
'description' => t('See <a href=":url">@url</a> 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'])),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +465,7 @@ 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', array('@time' => \Drupal::service('date.formatter')->formatTimeDiffSince($cron_last)));
|
||||
|
||||
$requirements['cron'] = array(
|
||||
'title' => t('Cron maintenance tasks'),
|
||||
|
@ -461,18 +479,19 @@ function system_requirements($phase) {
|
|||
'#suffix' => ' ',
|
||||
],
|
||||
[
|
||||
'#markup' => t('For more information, see the online handbook entry for <a href="@cron-handbook">configuring cron jobs</a>.', ['@cron-handbook' => 'https://www.drupal.org/cron']),
|
||||
'#markup' => t('For more information, see the online handbook entry for <a href=":cron-handbook">configuring cron jobs</a>.', [':cron-handbook' => 'https://www.drupal.org/cron']),
|
||||
'#suffix' => ' ',
|
||||
],
|
||||
];
|
||||
}
|
||||
$cron_url = \Drupal::url('system.cron', ['key' => \Drupal::state()->get('system.cron_key'), ['absolute' => TRUE]]);
|
||||
$requirements['cron']['description'][] = [
|
||||
[
|
||||
'#markup' => t('You can <a href="@cron">run cron manually</a>.', ['@cron' => \Drupal::url('system.run_cron')]),
|
||||
'#markup' => t('You can <a href=":cron">run cron manually</a>.', [':cron' => \Drupal::url('system.run_cron')]),
|
||||
],
|
||||
[
|
||||
'#prefix' => '<br />',
|
||||
'#markup' => t('To run cron from outside the site, go to <a href="@cron">@cron</a>', ['@cron' => \Drupal::url('system.cron', ['key' => \Drupal::state()->get('system.cron_key'), ['absolute' => TRUE]])]),
|
||||
'#markup' => t('To run cron from outside the site, go to <a href=":url">@cron</a>', [':url' => $cron_url, '@cron' => $cron_url]),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -557,12 +576,12 @@ function system_requirements($phase) {
|
|||
}
|
||||
// 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 <a href="@admin-file-system">file system settings page</a> 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 <a href=":admin-file-system">file system settings page</a> or change the current directory\'s permissions so that it is writable.', array(':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 <a href="@handbook_url">online handbook</a>.', 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 <a href=":handbook_url">online handbook</a>.', array(':handbook_url' => 'https://www.drupal.org/server-permissions'));
|
||||
$requirements['file system']['value'] = '';
|
||||
}
|
||||
if (!empty($description)) {
|
||||
|
@ -598,18 +617,31 @@ function system_requirements($phase) {
|
|||
);
|
||||
|
||||
// Check installed modules.
|
||||
$has_pending_updates = FALSE;
|
||||
foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) {
|
||||
$updates = drupal_get_schema_versions($module);
|
||||
if ($updates !== FALSE) {
|
||||
$default = drupal_get_installed_schema_version($module);
|
||||
if (max($updates) > $default) {
|
||||
$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 <a href="@update">database update script</a> immediately.', array('@update' => \Drupal::url('system.db_update')));
|
||||
$has_pending_updates = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$has_pending_updates) {
|
||||
/** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */
|
||||
$post_update_registry = \Drupal::service('update.post_update_registry');
|
||||
$missing_post_update_functions = $post_update_registry->getPendingUpdateFunctions();
|
||||
if (!empty($missing_post_update_functions)) {
|
||||
$has_pending_updates = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
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 <a href=":update">database update script</a> immediately.', array(':update' => \Drupal::url('system.db_update')));
|
||||
}
|
||||
|
||||
// Verify that no entity updates are pending after running every DB update.
|
||||
if (!isset($requirements['update']['severity']) && \Drupal::entityDefinitionUpdateManager()->needsUpdates()) {
|
||||
|
@ -698,9 +730,9 @@ function system_requirements($phase) {
|
|||
$requirements['update status'] = array(
|
||||
'value' => t('Not enabled'),
|
||||
'severity' => REQUIREMENT_WARNING,
|
||||
'description' => t('Update notifications are not enabled. It is <strong>highly recommended</strong> that you enable the Update Manager module from the <a href="@module">module administration page</a> in order to stay up-to-date on new releases. For more information, <a href="@update">Update status handbook page</a>.', array(
|
||||
'@update' => 'https://www.drupal.org/documentation/modules/update',
|
||||
'@module' => \Drupal::url('system.modules_list'),
|
||||
'description' => t('Update notifications are not enabled. It is <strong>highly recommended</strong> that you enable the Update Manager module from the <a href=":module">module administration page</a> in order to stay up-to-date on new releases. For more information, <a href=":update">Update status handbook page</a>.', array(
|
||||
':update' => 'https://www.drupal.org/documentation/modules/update',
|
||||
':module' => \Drupal::url('system.modules_list'),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
@ -729,7 +761,7 @@ function system_requirements($phase) {
|
|||
$requirements['trusted_host_patterns'] = array(
|
||||
'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 <strong>highly recommended</strong> that you configure this. See <a href="@url">Protecting against HTTP HOST Header attacks</a> 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 <strong>highly recommended</strong> that you configure this. See <a href=":url">Protecting against HTTP HOST Header attacks</a> for more information.', array(':url' => 'https://www.drupal.org/node/1992030')),
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
);
|
||||
}
|
||||
|
@ -751,10 +783,10 @@ function system_requirements($phase) {
|
|||
];
|
||||
if (!function_exists('twig_template_get_attributes')) {
|
||||
$requirements['twig_c_extension']['value'] = t('Not available');
|
||||
$requirements['twig_c_extension']['description'] = t('Enabling the Twig C extension can greatly increase rendering performance. See <a href="@url">the installation instructions</a> for more detail.', ['@url' => $url]);
|
||||
$requirements['twig_c_extension']['description'] = t('Enabling the Twig C extension can greatly increase rendering performance. See <a href=":url">the installation instructions</a> for more detail.', [':url' => $url]);
|
||||
}
|
||||
else {
|
||||
$requirements['twig_c_extension']['description'] = t('The <a href="@url">Twig C extension</a> is available', ['@url' => $url]);
|
||||
$requirements['twig_c_extension']['description'] = t('The <a href=":url">Twig C extension</a> is available', [':url' => $url]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1236,7 @@ function system_update_8001(&$sandbox = NULL) {
|
|||
$schema->changeField('menu_tree', $name, 'system_update_8001_' . $name, $spec);
|
||||
}
|
||||
$spec = array(
|
||||
'description' => 'The title for the link. May be a serialized TranslationWrapper.',
|
||||
'description' => 'The title for the link. May be a serialized TranslatableMarkup.',
|
||||
'type' => 'blob',
|
||||
'size' => 'big',
|
||||
'not null' => FALSE,
|
||||
|
@ -1307,7 +1339,8 @@ function system_update_8004() {
|
|||
// https://www.drupal.org/node/2542748. Regenerate the related schemas to
|
||||
// ensure they match the currently expected status.
|
||||
$manager = \Drupal::entityDefinitionUpdateManager();
|
||||
foreach (array_keys(\Drupal::entityManager()->getDefinitions()) as $entity_type_id) {
|
||||
foreach (array_keys(\Drupal::entityManager()
|
||||
->getDefinitions()) as $entity_type_id) {
|
||||
$manager->updateEntityType($manager->getEntityType($entity_type_id));
|
||||
}
|
||||
}
|
||||
|
@ -1407,6 +1440,7 @@ function system_update_8005() {
|
|||
] + $tabs_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
|
||||
$name = 'block.block.seven_secondary_local_tasks';
|
||||
$values = [
|
||||
'region' => 'pre_content',
|
||||
'id' => 'seven_secondary_local_tasks',
|
||||
|
@ -1437,16 +1471,16 @@ function system_update_8005() {
|
|||
|
||||
default:
|
||||
$custom_themes_installed = TRUE;
|
||||
$name = sprintf('block.block.%s_local_actions', $theme_name);
|
||||
$name = 'block.block.' . $theme_name . '_local_actions';
|
||||
$values = [
|
||||
'id' => sprintf('%s_local_actions', $theme_name),
|
||||
'id' => $theme_name . '_local_actions',
|
||||
'weight' => -10,
|
||||
] + $local_actions_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
|
||||
$name = sprintf('block.block.%s_local_tasks', $theme_name);
|
||||
$values = [
|
||||
'id' => sprintf('%s_local_tasks', $theme_name),
|
||||
'id' => $theme_name . '_local_tasks',
|
||||
'weight' => -20,
|
||||
] + $tabs_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
|
@ -1462,7 +1496,77 @@ function system_update_8005() {
|
|||
}
|
||||
|
||||
/**
|
||||
* Helper function to create block configuration objects for the update.
|
||||
* Place branding blocks in every theme.
|
||||
*/
|
||||
function system_update_8006() {
|
||||
// When block module is not installed, there is nothing that could be done
|
||||
// except showing a warning.
|
||||
if (!\Drupal::moduleHandler()->moduleExists('block')) {
|
||||
return t('Block module is not enabled so site branding elements, which have been converted to a block, are not visible anymore.');
|
||||
}
|
||||
|
||||
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
||||
$theme_handler = \Drupal::service('theme_handler');
|
||||
$custom_themes_installed = FALSE;
|
||||
$message = NULL;
|
||||
$langcode = \Drupal::service('language_manager')->getCurrentLanguage()->getId();
|
||||
|
||||
$site_branding_default_settings = [
|
||||
'plugin' => 'system_branding_block',
|
||||
'region' => 'content',
|
||||
'settings.label' => 'Site branding',
|
||||
'settings.label_display' => 0,
|
||||
'visibility' => [],
|
||||
'weight' => 0,
|
||||
'langcode' => $langcode,
|
||||
];
|
||||
foreach ($theme_handler->listInfo() as $theme) {
|
||||
$theme_name = $theme->getName();
|
||||
switch ($theme_name) {
|
||||
case 'bartik':
|
||||
$name = 'block.block.bartik_branding';
|
||||
$values = [
|
||||
'id' => 'bartik_branding',
|
||||
'region' => 'header',
|
||||
] + $site_branding_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
|
||||
case 'stark':
|
||||
$name = 'block.block.stark_branding';
|
||||
$values = [
|
||||
'id' => 'stark_branding',
|
||||
'region' => 'header',
|
||||
] + $site_branding_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
|
||||
case 'seven':
|
||||
case 'classy':
|
||||
// Don't place any blocks or trigger custom themes installed warning.
|
||||
break;
|
||||
default:
|
||||
$custom_themes_installed = TRUE;
|
||||
$name = sprintf('block.block.%s_branding', $theme_name);
|
||||
$values = [
|
||||
'id' => sprintf('%s_branding', $theme_name),
|
||||
'region' => 'content',
|
||||
'weight' => '-50',
|
||||
] + $site_branding_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($custom_themes_installed) {
|
||||
$message = t('Because your site has custom theme(s) installed, we had to set the branding block into the content region. Please manually review the block configuration and remove the site name, slogan, and logo variables from your templates.');
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to create block configuration objects for an update.
|
||||
*
|
||||
* @param string $name
|
||||
* The name of the config object.
|
||||
|
@ -1484,6 +1588,264 @@ function _system_update_create_block($name, $theme_name, array $values) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set langcode fields to be ASCII-only.
|
||||
*/
|
||||
function system_update_8007() {
|
||||
$database = \Drupal::database();
|
||||
$database_schema = $database->schema();
|
||||
$entity_types = \Drupal::entityManager()->getDefinitions();
|
||||
|
||||
$schema = \Drupal::keyValue('entity.storage_schema.sql')->getAll();
|
||||
$schema_copy = $schema;
|
||||
foreach ($schema as $item_name => $item) {
|
||||
list($entity_type_id, , ) = explode('.', $item_name);
|
||||
if (!isset($entity_types[$entity_type_id])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($item as $table_name => $table_schema) {
|
||||
foreach ($table_schema as $schema_key => $schema_data) {
|
||||
if ($schema_key == 'fields') {
|
||||
foreach ($schema_data as $field_name => $field_data) {
|
||||
foreach ($field_data as $field_data_property => $field_data_value) {
|
||||
// Langcode fields have the property 'is_ascii' set, instead
|
||||
// they should have set the type to 'varchar_ascii'.
|
||||
if ($field_data_property == 'is_ascii') {
|
||||
unset($schema_copy[$item_name][$table_name]['fields'][$field_name]['is_ascii']);
|
||||
$schema_copy[$item_name][$table_name]['fields'][$field_name]['type'] = 'varchar_ascii';
|
||||
if ($database->driver() == 'mysql') {
|
||||
$database_schema->changeField($table_name, $field_name, $field_name, $schema_copy[$item_name][$table_name]['fields'][$field_name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
\Drupal::keyValue('entity.storage_schema.sql')->setMultiple($schema_copy);
|
||||
|
||||
$definitions = \Drupal::keyValue('entity.definitions.installed')->getAll();
|
||||
$definitions_copy = $definitions;
|
||||
foreach ($definitions as $item_name => $item_value) {
|
||||
$suffix = '.field_storage_definitions';
|
||||
if (substr($item_name, -strlen($suffix)) == $suffix) {
|
||||
foreach ($item_value as $field_name => $field_definition) {
|
||||
$reflection = new \ReflectionObject($field_definition);
|
||||
$schema_property = $reflection->getProperty('schema');
|
||||
$schema_property->setAccessible(TRUE);
|
||||
$schema = $schema_property->getValue($field_definition);
|
||||
if (isset($schema['columns']['value']['is_ascii'])) {
|
||||
$schema['columns']['value']['type'] = 'varchar_ascii';
|
||||
unset($schema['columns']['value']['is_ascii']);
|
||||
}
|
||||
$schema_property->setValue($field_definition, $schema);
|
||||
$schema_property->setAccessible(FALSE);
|
||||
$definitions_copy[$item_name][$field_name] = $field_definition;
|
||||
}
|
||||
}
|
||||
}
|
||||
\Drupal::keyValue('entity.definitions.installed')->setMultiple($definitions_copy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge field schema data for uninstalled entity types.
|
||||
*/
|
||||
function system_update_8008() {
|
||||
$entity_types = \Drupal::entityManager()->getDefinitions();
|
||||
/** @var \Drupal\Core\KeyValueStore\KeyValueStoreInterface $schema */
|
||||
$schema = \Drupal::keyValue('entity.storage_schema.sql');
|
||||
foreach ($schema->getAll() as $key => $item) {
|
||||
list($entity_type_id, ,) = explode('.', $key);
|
||||
if (!isset($entity_types[$entity_type_id])) {
|
||||
$schema->delete($key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add allowed attributes to existing html filters.
|
||||
*/
|
||||
function system_update_8009() {
|
||||
$default_mapping = [
|
||||
'<a>' => '<a href hreflang>',
|
||||
'<blockquote>' => '<blockquote cite>',
|
||||
'<ol>' => '<ol start type>',
|
||||
'<ul>' => '<ul type>',
|
||||
'<img>' => '<img src alt height width>',
|
||||
'<h2>' => '<h2 id>',
|
||||
'<h3>' => '<h3 id>',
|
||||
'<h4>' => '<h4 id>',
|
||||
'<h5>' => '<h5 id>',
|
||||
'<h6>' => '<h6 id>',
|
||||
];
|
||||
$config_factory = \Drupal::configFactory();
|
||||
foreach ($config_factory->listAll('filter.format') as $name) {
|
||||
$allowed_html_mapping = $default_mapping;
|
||||
$config = $config_factory->getEditable($name);
|
||||
// The image alignment filter needs the data-align attribute.
|
||||
$align_enabled = $config->get('filters.filter_align.status');
|
||||
if ($align_enabled) {
|
||||
$allowed_html_mapping['<img>'] = str_replace('>', ' data-align>', $allowed_html_mapping['<img>']);
|
||||
}
|
||||
// The image caption filter needs the data-caption attribute.
|
||||
$caption_enabled = $config->get('filters.filter_caption.status');
|
||||
if ($caption_enabled) {
|
||||
$allowed_html_mapping['<img>'] = str_replace('>', ' data-caption>', $allowed_html_mapping['<img>']);
|
||||
}
|
||||
$allowed_html = $config->get('filters.filter_html.settings.allowed_html');
|
||||
if (!empty($allowed_html)) {
|
||||
$allowed_html = strtr($allowed_html, $allowed_html_mapping);
|
||||
$config->set('filters.filter_html.settings.allowed_html', $allowed_html);
|
||||
$config->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Place page title blocks in every theme.
|
||||
*/
|
||||
function system_update_8010() {
|
||||
// When block module is not installed, there is nothing that could be done
|
||||
// except showing a warning.
|
||||
if (!\Drupal::moduleHandler()->moduleExists('block')) {
|
||||
return t('Block module is not enabled. The page title has been converted to a block, but default page title markup will still display at the top of the main content area.');
|
||||
}
|
||||
|
||||
/** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
|
||||
$theme_handler = \Drupal::service('theme_handler');
|
||||
$custom_themes_installed = FALSE;
|
||||
$message = NULL;
|
||||
$langcode = \Drupal::service('language_manager')->getCurrentLanguage()->getId();
|
||||
|
||||
$page_title_default_settings = [
|
||||
'plugin' => 'page_title_block',
|
||||
'region' => 'content',
|
||||
'settings.label' => 'Page title',
|
||||
'settings.label_display' => 0,
|
||||
'visibility' => [],
|
||||
'weight' => -50,
|
||||
'langcode' => $langcode,
|
||||
];
|
||||
foreach ($theme_handler->listInfo() as $theme) {
|
||||
$theme_name = $theme->getName();
|
||||
switch ($theme_name) {
|
||||
case 'bartik':
|
||||
$name = 'block.block.bartik_page_title';
|
||||
$values = [
|
||||
'id' => 'bartik_page_title',
|
||||
] + $page_title_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
|
||||
case 'stark':
|
||||
$name = 'block.block.stark_page_title';
|
||||
$values = [
|
||||
'id' => 'stark_page_title',
|
||||
'region' => 'content',
|
||||
] + $page_title_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
|
||||
case 'seven':
|
||||
$name = 'block.block.seven_page_title';
|
||||
$values = [
|
||||
'id' => 'seven_page_title',
|
||||
'region' => 'header',
|
||||
] + $page_title_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
|
||||
case 'classy':
|
||||
$name = 'block.block.classy_page_title';
|
||||
$values = [
|
||||
'id' => 'classy_page_title',
|
||||
'region' => 'content',
|
||||
] + $page_title_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
|
||||
default:
|
||||
$custom_themes_installed = TRUE;
|
||||
$name = sprintf('block.block.%s_page_title', $theme_name);
|
||||
$values = [
|
||||
'id' => sprintf('%s_page_title', $theme_name),
|
||||
'region' => 'content',
|
||||
'weight' => '-50',
|
||||
] + $page_title_default_settings;
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($custom_themes_installed) {
|
||||
$message = t('Because your site has custom theme(s) installed, we have placed the page title block in the content region. Please manually review the block configuration and remove the page title variables from your page templates.');
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add secondary local tasks block to Seven (fixes system_update_8005).
|
||||
*/
|
||||
function system_update_8011() {
|
||||
$langcode = \Drupal::service('language_manager')->getCurrentLanguage()->getId();
|
||||
$theme_name = 'seven';
|
||||
$name = 'block.block.seven_secondary_local_tasks';
|
||||
$values = [
|
||||
'plugin' => 'local_tasks_block',
|
||||
'region' => 'pre_content',
|
||||
'id' => 'seven_secondary_local_tasks',
|
||||
'settings.label' => 'Secondary tabs',
|
||||
'settings.label_display' => 0,
|
||||
'settings.primary' => FALSE,
|
||||
'settings.secondary' => TRUE,
|
||||
'visibility' => [],
|
||||
'weight' => 0,
|
||||
'langcode' => $langcode,
|
||||
];
|
||||
_system_update_create_block($name, $theme_name, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the Stable base theme if needed.
|
||||
*/
|
||||
function system_update_8012() {
|
||||
$theme_handler = \Drupal::service('theme_handler');
|
||||
// Ensure we have fresh info.
|
||||
$theme_handler->rebuildThemeData();
|
||||
foreach ($theme_handler->listInfo() as $theme) {
|
||||
// We first check that a base theme is set because if it's set to false then
|
||||
// it's unset in \Drupal\Core\Extension\ThemeHandler::rebuildThemeData().
|
||||
if (isset($theme->info['base theme']) && $theme->info['base theme'] == 'stable') {
|
||||
$theme_handler->install(['stable']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable automated cron module and move the config into it.
|
||||
*/
|
||||
function system_update_8013() {
|
||||
$config_factory = \Drupal::configFactory();
|
||||
$system_cron_config = $config_factory->getEditable('system.cron');
|
||||
if ($autorun = $system_cron_config->get('threshold.autorun')) {
|
||||
// Install 'automated_cron' module.
|
||||
\Drupal::service('module_installer')->install(['automated_cron'], FALSE);
|
||||
|
||||
// Copy 'autorun' value into the new module's 'interval' setting.
|
||||
$config_factory->getEditable('automated_cron.settings')
|
||||
->set('interval', $autorun)
|
||||
->save(TRUE);
|
||||
}
|
||||
|
||||
// Remove the 'autorun' key in system module config.
|
||||
$system_cron_config
|
||||
->clear('threshold.autorun')
|
||||
->save(TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-8.0.0-beta".
|
||||
*/
|
||||
|
|
Reference in a new issue