- <?php
- * @file
- * Install, update and uninstall functions for the system module.
- */
-
- * Implements hook_requirements().
- */
- function system_requirements($phase) {
- global $base_url;
- $site_config = config('system.core');
- $requirements = array();
-
- $t = get_t();
-
- if ($phase == 'runtime') {
-
- $requirements['backdrop'] = array(
- 'title' => $t('Backdrop CMS'),
- 'value' => BACKDROP_VERSION,
- 'severity' => REQUIREMENT_INFO,
- 'weight' => -10,
- );
-
-
-
- $profile = backdrop_get_profile();
- if ($profile != 'standard') {
- $info = system_get_info('module', $profile);
-
- $profile .= !empty($info['version']) ? '-' . $info['version'] : '';
- $requirements['install_profile'] = array(
- 'title' => $t('Install profile'),
- 'value' => $t('%profile_name (%profile)', array(
- '%profile_name' => $info['name'],
- '%profile' => $profile,
- )),
- 'severity' => REQUIREMENT_INFO,
- 'weight' => -9,
- );
- }
-
-
- $config_storage_types = array(
- 'active' => t('Active'),
- 'staging' => t('Staging'),
- );
- foreach ($config_storage_types as $type => $type_name) {
- $storage = config_get_config_storage($type);
- $class = get_class($storage);
-
- switch ($class) {
- case 'ConfigDatabaseStorage':
- $config_locations[$type] = t('!type: database: <code>@config_location</code>', array (
-
-
- '!type' => $type_name,
- '@config_location' => 'db://default/config_' . $type,
- ));
- break;
- case 'ConfigFileStorage':
- default:
- $config_locations[$type] = t('!type: JSON files: <code>@config_location</code>', array (
-
-
- '!type' => $type_name,
- '@config_location' => config_get_config_directory($type),
- ));
- }
- }
-
- $requirements['config_storage'] = array(
- 'title' => $t('Configuration storage'),
- 'value' => theme('item_list', array('items' => $config_locations)),
- 'severity' => REQUIREMENT_INFO,
- );
- }
-
-
- $software = $_SERVER['SERVER_SOFTWARE'];
- $requirements['webserver'] = array(
- 'title' => $t('Web server'),
- 'value' => check_plain($software),
- 'severity' => REQUIREMENT_INFO,
- );
-
-
- $phpversion = phpversion();
- if (function_exists('phpinfo')) {
- if ($phase == 'runtime') {
- $php_value = $t('Version: !version (<a href="!infourl">PHP information</a>)', array('!version' => $phpversion, '!infourl' => url('admin/reports/status/php')));
- }
- else {
- $php_value = $t('Version: !version', array('!version' => $phpversion));
- }
- $requirements['php'] = array(
- 'title' => $t('PHP'),
- 'value' => $php_value,
- 'severity' => REQUIREMENT_INFO,
- );
- }
- else {
- $requirements['php'] = array(
- 'title' => $t('PHP'),
- 'value' => $phpversion,
- 'description' => $t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings. For more information, see the <a href="@phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array('@phpinfo' => 'https://backdropcms.org/user-guide/enabling-and-disabling-phpinfo')),
- 'severity' => REQUIREMENT_INFO,
- );
- }
-
-
-
-
- $minimum_recommended_version = '5.6.0';
- $minimum_warning = $t('Your PHP installation is too old. Backdrop requires at least PHP %version.', array('%version' => $minimum_recommended_version));
- if (version_compare($phpversion, $minimum_recommended_version) < 0) {
- $requirements['php']['description'] = $minimum_warning . ' ' . l(t('Read about the minimum version increase'), 'https://backdropcms.org/news/backdrop-cms-drops-support-for-php-versions-prior-to-56') . '.';
- $requirements['php']['severity'] = $phase === 'runtime' ? REQUIREMENT_ERROR : REQUIREMENT_INFO;
- }
-
-
- if (version_compare($phpversion, BACKDROP_MINIMUM_PHP) < 0) {
- $requirements['php']['description'] = $minimum_warning;
- $requirements['php']['severity'] = REQUIREMENT_ERROR;
- return $requirements;
- }
-
-
- $requirements['php_register_globals'] = array(
- 'title' => $t('PHP register globals'),
- );
- $register_globals = trim(ini_get('register_globals'));
-
-
-
-
-
- if (!empty($register_globals) && strtolower($register_globals) != 'off') {
- $requirements['php_register_globals']['description'] = $t('<em>register_globals</em> is enabled. Backdrop requires this configuration directive to be disabled. Your site may not be secure when <em>register_globals</em> is enabled. The PHP manual has instructions for <a href="http://php.net/configuration.changes">how to change configuration settings</a>.');
- $requirements['php_register_globals']['severity'] = REQUIREMENT_ERROR;
- $requirements['php_register_globals']['value'] = $t("Enabled ('@value')", array('@value' => $register_globals));
- }
- else {
- $requirements['php_register_globals']['value'] = $t('Disabled');
- }
-
-
- $max_input_vars = ini_get('max_input_vars');
- $requirements['php_max_input_vars'] = array(
- 'title' => $t('PHP <code>max_input_vars</code> setting'),
- 'value' => $t('PHP limits the number of input variables in each form to @value items.', array('@value' => number_format($max_input_vars, 0, '.', ','))),
- );
-
-
- if ($max_input_vars <= 1000) {
- $requirements['php_max_input_vars']['description'] = $t('When set too low, the <code>max_input_vars</code> PHP setting can cause silent failures on large forms, such as the permissions page. A value of <code>10000</code> is recommended. <a href="@documentation" target="_blank">Read more about increasing the <code>max_input_vars</code> PHP setting</a>.', array('@documentation' => 'https://docs.backdropcms.org/max-input-vars'));
- $requirements['php_max_input_vars']['severity'] = REQUIREMENT_WARNING;
- if ($phase == 'install' || $phase == 'update') {
- $requirements['php_max_input_vars']['severity'] = REQUIREMENT_INFO;
- }
- }
-
-
- $requirements['php_extensions'] = array(
- 'title' => $t('PHP extensions'),
- );
-
- $missing_extensions = array();
- $required_extensions = array(
- 'date',
- 'dom',
- 'filter',
- 'gd',
- 'hash',
- 'json',
- 'pcre',
- 'pdo',
- 'session',
- 'SimpleXML',
- 'SPL',
- 'xml',
- );
- foreach ($required_extensions as $extension) {
- if (!extension_loaded($extension)) {
- $missing_extensions[] = $extension;
- }
- }
-
- if (!empty($missing_extensions)) {
- $description = $t('Backdrop requires you to enable the PHP extensions in the following list (see the <a href="@system_requirements" target="_blank">system requirements page</a> for more information):', array(
- '@system_requirements' => 'https://backdropcms.org/requirements',
- ));
-
- $description .= theme('item_list', array('items' => $missing_extensions));
-
- $requirements['php_extensions']['value'] = $t('Disabled');
- $requirements['php_extensions']['severity'] = REQUIREMENT_ERROR;
- $requirements['php_extensions']['description'] = $description;
- }
- else {
- $description = $t('Enabled: !extensions', array('!extensions' => implode(', ', $required_extensions)));
- $requirements['php_extensions']['value'] = $description;
- }
-
- if ($phase == 'install' || $phase == 'update') {
-
- $requirements['database_extensions'] = array(
- 'title' => $t('Database support'),
- );
-
-
- if (!extension_loaded('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.');
- }
- else {
-
-
- if (!defined('PDO::ATTR_DEFAULT_FETCH_MODE')) {
- $pdo_message = $t('Your web server seems to have the wrong version of PDO installed. Backdrop CMS requires the PDO extension from PHP core. This system has the older PECL version. See the <a href="@link" target="_blank">System Requirements</a> page for more information.');
- }
- }
-
- if (isset($pdo_message)) {
- $pdo_more_info = $t('See the <a href="@link" target="_blank">System Requirements</a> page for more information.', array('@link' => 'https://backdropcms.org/requirements'));
- $requirements['database_extensions']['value'] = $t('Disabled');
- $requirements['database_extensions']['severity'] = REQUIREMENT_ERROR;
- $requirements['database_extensions']['description'] = $pdo_message . ' ' . $pdo_more_info;
- }
- else {
- $requirements['database_extensions']['value'] = $t('Enabled');
- }
- }
- else {
-
- $class = 'DatabaseTasks_' . Database::getConnection()->driver();
-
- $tasks = new $class();
- $dbinfo = $t('!system version !version', array('!system' => $tasks->name(), '!version' => Database::getConnection()->version()));
- $requirements['database_system'] = array(
- 'title' => $t('MySQL Database'),
- 'severity' => REQUIREMENT_INFO,
- 'value' => $dbinfo,
- );
- }
-
-
- $charset_requirements = _system_check_db_utf8mb4_requirements($phase);
- if (!empty($charset_requirements)) {
- $requirements['database_charset'] = $charset_requirements;
- }
-
-
- if ($phase == 'runtime') {
- $jquery = backdrop_get_library('system', 'jquery');
- $jquery_ui = backdrop_get_library('system', 'ui');
- $requirements['jquery'] = array(
- 'title' => $t('jQuery'),
- 'severity' => REQUIREMENT_OK,
- 'value' => $t('jQuery version !jqv / jQuery UI version !jquiv', array(
- '!jqv' => $jquery['version'],
- '!jquiv' => $jquery_ui['version'],
- )),
- );
- }
-
-
- $memory_limit = ini_get('memory_limit');
- $requirements['php_memory_limit'] = array(
- 'title' => $t('PHP memory limit'),
- 'value' => $memory_limit == -1 ? t('-1 (Unlimited)') : $memory_limit,
- );
-
- if (!backdrop_check_memory_limit(BACKDROP_MINIMUM_PHP_MEMORY_LIMIT, $memory_limit)) {
- $description = '';
- if ($phase == 'install') {
- $description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the installation process.', array('%memory_minimum_limit' => BACKDROP_MINIMUM_PHP_MEMORY_LIMIT));
- }
- elseif ($phase == 'update') {
- $description = $t('Consider increasing your PHP memory limit to %memory_minimum_limit to help prevent errors in the update process.', array('%memory_minimum_limit' => BACKDROP_MINIMUM_PHP_MEMORY_LIMIT));
- }
- elseif ($phase == 'runtime') {
- $description = $t('Depending on your configuration, Backdrop 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' => BACKDROP_MINIMUM_PHP_MEMORY_LIMIT));
- }
-
- if (!empty($description)) {
- if ($php_ini_path = get_cfg_var('cfg_file_path')) {
- $description .= ' ' . $t('Increase the memory limit by editing the memory_limit parameter in the file %configuration-file and then restart your web server.', array('%configuration-file' => $php_ini_path));
- }
-
- $requirements['php_memory_limit']['description'] = $description . ' ' . $t('See the <a href="@url" target="_blank">Backdrop requirements</a> for more information.', array('@url' => 'https://backdropcms.org/requirements'));
- $requirements['php_memory_limit']['severity'] = REQUIREMENT_WARNING;
- }
- }
-
-
- if ($phase == 'runtime' && backdrop_is_apache()) {
-
-
- foreach (array('active', 'staging') as $type) {
- $config_storage = config_get_config_storage($type);
- if (is_a($config_storage, 'ConfigFileStorage')) {
- $config_directory = config_get_config_directory($type);
- file_save_htaccess($config_directory);
-
- $htaccess_files[$config_directory . '/.htaccess'] = array(
- 'title' => $t('%type config directory', array('%type' => backdrop_ucfirst($type))),
- 'directory' => $config_directory,
- );
- }
- }
-
-
-
- file_ensure_htaccess();
-
- $htaccess_files['public://.htaccess'] = array(
- 'title' => $t('Public files directory'),
- 'directory' => $site_config->get('file_public_path'),
- );
- if ($private_files_directory = $site_config->get('file_private_path')) {
- $htaccess_files['private://.htaccess'] = array(
- 'title' => $t('Private files directory'),
- 'directory' => $private_files_directory,
- );
- }
- $htaccess_files['temporary://.htaccess'] = array(
- 'title' => $t('Temporary files directory'),
- 'directory' => file_directory_temp(),
- );
-
- foreach ($htaccess_files as $htaccess_file => $info) {
-
-
- if (!file_exists($htaccess_file) || !($contents = @file_get_contents($htaccess_file)) || strpos($contents, 'Drupal_Security_Do_Not_Remove_See_SA_2013_003') === FALSE) {
- $requirements[$htaccess_file] = array(
- 'title' => $info['title'],
- 'value' => $t('Not fully protected'),
- 'severity' => REQUIREMENT_ERROR,
- 'description' => $t('See <a href="@url" target="_blank">@url</a> for information about the recommended <code>.htaccess</code> file which should be added to the <code>%directory</code> directory to help protect against arbitrary code execution.', array(
- '@url' => 'http://drupal.org/SA-CORE-2013-003',
- '%directory' => $info['directory'],
- )),
- );
- }
- }
- }
-
-
- if ($phase == 'runtime') {
- $config = config('system.core');
-
- $threshold_warning = $config->get('cron_threshold_warning');
-
- $threshold_error = $config->get('cron_threshold_error');
-
- $help = $t('For more information, see the online handbook entry for <a href="@cron-handbook" target="_blank">configuring cron jobs</a>.', array('@cron-handbook' => 'https://backdropcms.org/cron'));
-
-
- $cron_last = state_get('cron_last');
- if (!is_numeric($cron_last)) {
- $cron_last = state_get('install_time', 0);
- }
-
-
- $severity = REQUIREMENT_OK;
- if (REQUEST_TIME - $cron_last > $threshold_error) {
- $severity = REQUIREMENT_ERROR;
- }
- elseif (REQUEST_TIME - $cron_last > $threshold_warning) {
- $severity = REQUIREMENT_WARNING;
- }
-
-
- $summary = $t('Last run !time ago (<a href="@url">Run cron manually</a>)', array(
- '!time' => format_interval(REQUEST_TIME - $cron_last),
- '@url' => url('admin/reports/status/run-cron'),
- ));
- $description = '';
- if ($severity != REQUIREMENT_OK) {
- $description = $t('Cron has not run recently.') . ' ' . $help;
- }
-
- $description .= $t('To run cron from outside the site, go to <a href="!cron">!cron</a>', array('!cron' => url($base_url . '/core/cron.php', array('external' => TRUE, 'query' => array('cron_key' => state_get('cron_key'))))));
-
- $requirements['cron'] = array(
- 'title' => $t('Cron maintenance tasks'),
- 'severity' => $severity,
- 'value' => $summary,
- 'description' => $description,
- );
- }
-
-
- $directories = array();
- if ($phase == 'runtime') {
- $directories[] = $site_config->get('file_public_path');
- $directories[] = $site_config->get('file_private_path');
- $directories[] = file_directory_temp();
- }
- else {
- $directories[] = conf_path() . '/files';
- }
-
- $requirements['file system'] = array(
- 'title' => $t('File system'),
- );
-
- $error = '';
-
- foreach ($directories as $directory) {
- if (!$directory) {
- continue;
- }
- $prepared = file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
- $is_writable = is_writable($directory);
- $is_directory = is_dir($directory);
- if (!$prepared || !$is_writable || !$is_directory) {
- $description = '';
- $requirements['file system']['value'] = $t('Not writable');
- if (!$is_directory) {
- $error .= $t('The directory %directory does not exist.', array('%directory' => $directory)) . ' ';
- }
- else {
- $error .= $t('The directory %directory is not writable.', array('%directory' => $directory)) . ' ';
- }
-
- if ($phase == 'runtime') {
- $description = $error . $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' => url('admin/config/media/file-system')));
- }
- elseif ($phase == 'install') {
-
-
- if ($is_directory && !$is_writable) {
- $description = $error . ' ' . $t('To proceed with installation, you must modify the permissions of this directory to make it writable by the web server.');
- }
- else {
- $description = $error . ' ' . $t('An automated attempt to create this directory failed. To proceed with the installation, either create the directory and modify its permissions to make it writable or adjust the permissions on the parent directory to allow the installer to create it automatically.');
- }
- $description .= ' ' . $t('If you are unsure how to do this, see the <a href="@handbook_url" target="_blank">Installation Instructions</a> page.', array('@handbook_url' => 'https://backdropcms.org/installation'));
- $requirements['file system']['value'] = '';
- }
- if (!empty($description)) {
- $requirements['file system']['description'] = $description;
- $requirements['file system']['severity'] = REQUIREMENT_ERROR;
- }
- }
- else {
- if (file_default_scheme() == 'public') {
- $requirements['file system']['value'] = $t('Writable (<em>public</em> download method)');
- }
- else {
- $requirements['file system']['value'] = $t('Writable (<em>private</em> download method)');
- }
- }
- }
-
-
- if ($phase == 'runtime') {
- $requirements['update'] = array(
- 'title' => $t('Site updates'),
- 'severity' => REQUIREMENT_OK,
- 'value' => $t('Up to date'),
- );
-
-
- foreach (module_list() as $module) {
- $updates = backdrop_get_schema_versions($module);
- if ($updates !== FALSE) {
- $current_schema = backdrop_get_installed_schema_version($module);
- $latest_schema = end($updates);
- if ($current_schema < $latest_schema) {
- $update_link = base_path() . 'core/update.php';
- $requirements['update']['severity'] = REQUIREMENT_ERROR;
- $requirements['update']['value'] = $t('Out of date (<a href="@update">Run site updates</a>)', array('@update' => $update_link));
- $requirements['update']['description'] = $t('Some modules have database schema updates to install. You should run the <a href="@update">site update script</a> immediately.', array('@update' => $update_link));
- break;
- }
- }
- }
- }
-
-
- if ($phase == 'runtime') {
- if (!empty($GLOBALS['settings']['update_free_access'])) {
- $requirements['update access'] = array(
- 'value' => $t('Not protected'),
- 'severity' => REQUIREMENT_ERROR,
- 'description' => $t('The <code>update.php</code> script is accessible to everyone without authentication check, which is a security risk. You must change the <code>update_free_access</code> value in your <code>settings.php</code> back to <code>FALSE</code>.'),
- );
- }
- else {
- $requirements['update access'] = array(
- 'value' => $t('Protected'),
- );
- }
- $requirements['update access']['title'] = $t('Access to update.php');
- }
-
-
- if ($phase == 'update') {
- $profile = backdrop_get_profile();
- $files = system_rebuild_module_data();
- foreach ($files as $module => $file) {
-
- if (!$file->status || $module == $profile) {
- continue;
- }
-
- $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']['severity'] = REQUIREMENT_ERROR;
- }
-
- foreach ($file->requires as $requirement) {
- $required_module = $requirement['name'];
-
- if (!isset($files[$required_module])) {
- $requirements["$module-$required_module"] = array(
- 'title' => $t('Unresolved dependency'),
- 'description' => $t('@name requires this module.', array('@name' => $name)),
- 'value' => t('@required_name (Missing)', array('@required_name' => $required_module)),
- 'severity' => REQUIREMENT_ERROR,
- );
- continue;
- }
-
- $required_file = $files[$required_module];
- $required_name = $required_file->info['name'];
- $version = '';
- if (!empty($required_file->info['version'])) {
- $version = preg_replace('/^' . preg_quote(BACKDROP_CORE_COMPATIBILITY, '/') . '-/', '', $required_file->info['version']);
- }
- $compatibility = backdrop_check_incompatibility($requirement, $version);
- if ($compatibility) {
- $compatibility = rtrim(substr($compatibility, 2), ')');
- $requirements["$module-$required_module"] = array(
- '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)),
- 'severity' => REQUIREMENT_ERROR,
- );
- continue;
- }
- }
- }
- }
-
-
- include_once BACKDROP_ROOT . '/core/includes/unicode.inc';
- $requirements = array_merge($requirements, unicode_requirements());
-
- if ($phase == 'runtime') {
-
- if (!module_exists('update')) {
- $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" target="_blank">Update status handbook page</a>.', array(
- '@update' => 'http://drupal.org/handbook/modules/update',
- '@module' => url('admin/modules'),
- )),
- );
- }
- else {
- $requirements['update status'] = array(
- 'value' => $t('Enabled'),
- );
- }
- $requirements['update status']['title'] = $t('Backdrop CMS update notifications');
- }
-
- if ($phase == 'runtime') {
-
- $token_problems = token_get_token_problems();
-
- foreach ($token_problems as $problem_key => $problem) {
- if (!empty($problem['problems'])) {
- $problems = array_unique($problem['problems']);
- $problems = array_map('check_plain', $problems);
- $token_problems[$problem_key] = $problem['label'] . theme('item_list', array('items' => $problems));
- }
- else {
- unset($token_problems[$problem_key]);
- }
- }
- if (!empty($token_problems)) {
- $requirements['token_problems'] = array(
- 'title' => $t('Tokens'),
- 'value' => $t('Problems detected'),
- 'severity' => REQUIREMENT_WARNING,
- 'description' => '<p>' . implode('</p><p>', $token_problems) . '</p>',
- );
- }
- }
-
- if ($phase == 'runtime' && !settings_get('disable_multiple_modules_warnings')) {
-
- $files = system_rebuild_module_data();
- foreach ($files as $filename => $file) {
- if (isset($file->all_uris) && count($file->all_uris) > 1) {
- $uris = array_reverse($file->all_uris);
- $items = array();
- foreach ($uris as $i => $uri) {
- $items[] = array(
- 'data' => !$i ? '<strong>' . $uri . '</strong>' : $uri,
- 'class' => array(!$i ? 'module-overriding' : 'module-overridden'),
- );
- }
- $description = $t('The competing module files are listed below. Only the first of the module versions in the list will be loaded.') . theme('item_list', array('items' => $items));
-
-
- $path = substr($file->uri, 0, strlen($file->uri) - strlen($file->name) - 8);
- $change_notice = 0;
- switch ($file->name) {
- case 'ckeditor':
- $change_notice = 42827;
- break;
-
- case 'email':
- $change_notice = 42928;
- break;
-
- case 'link':
- $change_notice = 42930;
- break;
-
- case 'date':
- $change_notice = 43066;
- break;
-
- case 'redirect':
- $change_notice = 43994;
- break;
-
- case 'entityreference':
- $change_notice = 47321;
- break;
- }
- if ($change_notice) {
- $description .= $t('Backdrop core provides a bundled @name module. A different copy of @name module is at %path. Remove this module from your installation to use the core @name module. For more information see the <a href="!url" target="_blank">@name change notice</a>.', array(
- '@name' => $file->info['name'],
- '%path' => $path,
- '!url' => 'https://docs.backdropcms.org/node/' . $change_notice));
- }
-
- $requirements['multiple_' . $file->name] = array(
- 'title' => $file->info['name'],
- 'value' => $t('There are multiple versions of module %name in the installation.', array('%name' => $file->info['name'])),
- 'severity' => REQUIREMENT_WARNING,
- 'description' => $description,
- );
- }
- }
- }
-
- if ($phase == 'runtime') {
-
- $error_level = $site_config->get('error_level');
- $description = $t('Backdrop CMS provides the ability to display error messages, which can be useful while a site is in development.');
- $logging_url = url('admin/config/development/logging');
- if ($error_level != ERROR_REPORTING_HIDE) {
- $value = $t('Enabled');
- $severity = REQUIREMENT_WARNING;
- $description .= ' ' . $t('Do not forget to <a href="@url">disable the display of errors</a> when you have finished testing and this site goes live.', array('@url' => $logging_url));
- }
- else {
- $value = $t('Disabled');
- $severity = REQUIREMENT_OK;
- $description .= ' ' . $t('If your site is in development, you might want to <a href="@url">enable the display of errors</a>.', array('@url' => $logging_url));
- }
-
- $requirements['error_level'] = array(
- 'title' => $t('Display error messages'),
- 'value' => $value,
- 'severity' => $severity,
- 'description' => $description,
- );
- }
-
- if ($phase == 'runtime') {
-
- $theme_debug_enabled = $site_config->get('theme_debug');
- if ($theme_debug_enabled) {
- $requirements['theme_debug'] = array(
- 'title' => $t('Theme debug'),
- 'value' => $t('Enabled'),
- 'severity' => REQUIREMENT_WARNING,
- 'description' => $t('Theme debugging is currently enabled, and should be disabled on a live site. This setting can be changed using the <a href="!url">Devel module</a>.', array('!url' => module_exists('devel') ? url('admin/config/development/devel') : 'https://backdropcms.org/project/devel')),
- );
- }
- }
-
-
- if ($phase == 'runtime') {
- $trusted_host_patterns = settings_get('trusted_host_patterns', array());
- $more_info = $t('See <a href="@url" target="_blank">Protecting against HTTP HOST Header attacks</a> for more information.', array('@url' => 'https://docs.backdropcms.org/documentation/trusted-host-settings'));
-
-
- if (empty($trusted_host_patterns)) {
- $requirements['trusted_host_patterns'] = array(
- 'title' => $t('Trusted Host Setting'),
- 'value' => $t('Not configured'),
- 'description' => $t('The <code>trusted_host_patterns</code> setting is not configured in <code>settings.php</code>. It is highly recommended that you configure this to protect your site.') . ' ' . $more_info,
- 'severity' => $trusted_host_patterns === FALSE ? REQUIREMENT_INFO : REQUIREMENT_WARNING,
- );
- }
- else {
- $description = format_plural(count($trusted_host_patterns), 'Configured to allow the following pattern:', 'Configured to allow the following patterns:');
-
- foreach ($trusted_host_patterns as $key => $trusted_host_pattern) {
- $trusted_host_patterns[$key] = '<code>' . $trusted_host_pattern . '</code>';
- }
-
- if (count($trusted_host_patterns) == 1) {
- $description .= ' ' . $trusted_host_patterns[0] . '<br>';
- }
-
- else {
- $description .= theme('item_list', array('items' => $trusted_host_patterns));
- }
- $description .= $t('You can change this by editing the <code>trusted_host_patterns</code> setting in <code>settings.php</code>.') . ' ' . $more_info;
- $requirements['trusted_host_patterns'] = array(
- 'title' => $t('Trusted Host Settings'),
- 'value' => $t('Current hostname is trusted'),
- 'description' => $description,
- );
- }
- }
-
- return $requirements;
- }
-
- * Checks whether the requirements for multi-byte UTF-8 support are met.
- *
- * @param string $phase
- * The hook_requirements() stage.
- *
- * @return array
- * A requirements array with the result of the charset check.
- */
- function _system_check_db_utf8mb4_requirements($phase) {
- global $install_state;
-
-
-
-
- if (isset($install_state['settings_verified']) && !$install_state['settings_verified']) {
- return array();
- }
-
- $connection = Database::getConnection();
- $t = get_t();
- $requirements['title'] = $t('MySQL Database 4-byte UTF-8 support');
-
- $utf8mb4_active = $connection->utf8mb4IsActive();
- $utf8mb4_supported = $connection->utf8mb4IsSupported();
- $documentation_url = 'https://docs.backdropcms.org/documentation/database-configuration';
- $upgrade_path = 'admin/config/development/utf8mb4-upgrade';
-
- $requirements['description'] = $t('4-byte UTF-8 support enables extended characters to be saved into the database, including emojis, Asian symbols and mathematical symbols.');
-
- if ($utf8mb4_active) {
- if ($utf8mb4_supported) {
- if ($phase != 'install' && $phase != 'update' && !state_get('database_utf8mb4_active', FALSE)) {
-
-
- $requirements['value'] = l($t('Database tables need conversion'), $upgrade_path);
- $requirements['description'] .= ' ' . $t('Your server supports this feature but not all tables have been converted to use it.');
- if ($_GET['q'] !== $upgrade_path) {
- $requirements['description'] .= ' ' . $t('After making a database backup, you should <a href="@url">convert existing tables</a>.', array('@url' => url($upgrade_path)));
- }
- $requirements['severity'] = REQUIREMENT_ERROR;
- }
- else {
-
- $requirements['value'] = $t('Enabled');
- $requirements['severity'] = REQUIREMENT_OK;
- }
- }
- else {
-
- $requirements['value'] = $t('Not supported');
- $requirements['description'] .= ' ' . $t('This feature is enabled, but not supported on your system. Please turn this off in <code>settings.php</code>, or ensure that all database-related requirements are met. See the <a href="@url" target="_blank">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@url' => $documentation_url));
- $requirements['severity'] = REQUIREMENT_ERROR;
- }
- }
- else {
- if ($utf8mb4_supported) {
-
- $requirements['value'] = $t('Not enabled');
- $requirements['description'] .= ' ' . $t('This feature is not enabled, but it is supported on your system. See the <a href="@url" target="_blank">documentation on adding 4 byte UTF-8 support</a> for more information.', array('@url' => $documentation_url));
- $requirements['severity'] = REQUIREMENT_INFO;
- }
- else {
-
- $requirements['value'] = $t('Not available');
- $requirements['description'] .= ' ' . $t('This feature is not supported on your system. See the <a href="@url" target="_blank">documentation on adding 4-byte UTF-8 support</a> for more information.', array('@url' => $documentation_url));
- $requirements['severity'] = REQUIREMENT_INFO;
- }
- }
- return $requirements;
- }
-
- * Implements hook_install().
- */
- function system_install() {
-
- backdrop_install_schema('system');
- $versions = backdrop_get_schema_versions('system');
- $version = $versions ? max($versions) : SCHEMA_INSTALLED;
- backdrop_set_installed_schema_version('system', $version);
-
-
- config_set('system.core', 'file_public_path', str_replace('./', '', conf_path() . '/files'));
-
-
- config_set('system.core', 'file_temporary_path', file_directory_temp());
-
-
-
- module_list(TRUE);
- module_implements_reset();
-
-
- backdrop_static_reset('drupal_get_schema_versions');
-
-
- system_rebuild_theme_data();
-
-
- db_update('system')
- ->fields(array('status' => 1))
- ->condition('type', 'theme')
- ->condition('name', 'stark')
- ->execute();
-
-
- $cron_key = backdrop_random_key();
- state_set('cron_key', $cron_key);
-
-
-
-
- $site_mail = 'noreply@' . backdrop_get_bare_domain($_SERVER['SERVER_NAME']);
- if (valid_email_address($site_mail)) {
- config_set('system.core', 'site_mail', $site_mail);
- }
- }
-
- * Implements hook_schema().
- */
- function system_schema() {
- $schema['variable'] = array(
- 'description' => 'Named variable/value pairs created by Backdrop core or any other module or theme. All variables are cached in memory at the start of every Backdrop request so developers should not be careless about what is stored here.',
- 'fields' => array(
- 'name' => array(
- 'description' => 'The name of the variable.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value of the variable.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- 'translatable' => TRUE,
- ),
- ),
- 'primary key' => array('name'),
- );
-
- $schema['batch'] = array(
- 'description' => 'Stores details about batches (processes that run in multiple HTTP requests).',
- 'fields' => array(
- 'bid' => array(
- 'description' => 'Primary Key: Unique batch ID.',
-
-
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'token' => array(
- 'description' => "A string token generated against the current user's session id and the batch id, used to ensure that only the user who submitted the batch can effectively access it.",
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- ),
- 'timestamp' => array(
- 'description' => 'A Unix timestamp indicating when this batch was submitted for processing. Stale batches are purged at cron time.',
- 'type' => 'int',
- 'not null' => TRUE,
- ),
- 'batch' => array(
- 'description' => 'A serialized array containing the processing data for the batch.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- ),
- ),
- 'primary key' => array('bid'),
- 'indexes' => array(
- 'token' => array('token'),
- ),
- );
-
- $schema['cache'] = array(
- 'description' => 'Generic cache table for caching things not separated out into their own tables. Contributed modules may also use this to store cached items.',
- 'fields' => array(
- 'cid' => array(
- 'description' => 'Primary Key: Unique cache ID.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'data' => array(
- 'description' => 'A collection of data to cache.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- ),
- 'expire' => array(
- 'description' => 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'created' => array(
- 'description' => 'A Unix timestamp indicating when the cache entry was created.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'serialized' => array(
- 'description' => 'A flag to indicate whether content is serialized (1) or not (0).',
- 'type' => 'int',
- 'size' => 'small',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array(
- 'expire' => array('expire'),
- ),
- 'primary key' => array('cid'),
- );
- $schema['cache_bootstrap'] = $schema['cache'];
- $schema['cache_bootstrap']['description'] = 'Cache table for data required to bootstrap Backdrop, may be routed to a shared memory cache.';
- $schema['cache_page'] = $schema['cache'];
- $schema['cache_page']['description'] = 'Cache table used to store compressed pages for anonymous users, if page caching is enabled.';
- $schema['cache_menu'] = $schema['cache'];
- $schema['cache_menu']['description'] = 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.';
- $schema['cache_path'] = $schema['cache'];
- $schema['cache_path']['description'] = 'Cache table for URL alias lookup.';
- $schema['cache_token'] = $schema['cache'];
- $schema['cache_token']['description'] = 'Cache table for token information.';
-
- $schema['flood'] = array(
- 'description' => 'Flood controls the threshold of events, such as the number of contact attempts.',
- 'fields' => array(
- 'fid' => array(
- 'description' => 'Unique flood event ID.',
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'event' => array(
- 'description' => 'Name of event (e.g. contact).',
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'identifier' => array(
- 'description' => 'Identifier of the visitor, such as an IP address or hostname.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'timestamp' => array(
- 'description' => 'Timestamp of the event.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'expiration' => array(
- 'description' => 'Expiration timestamp. Expired events are purged on cron run.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('fid'),
- 'indexes' => array(
- 'allow' => array('event', 'identifier', 'timestamp'),
- 'purge' => array('expiration'),
- ),
- );
-
- $schema['menu_router'] = array(
- 'description' => 'Maps paths to various callbacks (access, page and title)',
- 'fields' => array(
- 'path' => array(
- 'description' => 'Primary Key: the Backdrop path this entry describes',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'load_functions' => array(
- 'description' => 'A serialized array of function names (like node_load) to be called to load an object corresponding to a part of the current path.',
- 'type' => 'blob',
- 'not null' => TRUE,
- ),
- 'to_arg_functions' => array(
- 'description' => 'A serialized array of function names (like user_uid_optional_to_arg) to be called to replace a part of the router path with another string.',
- 'type' => 'blob',
- 'not null' => TRUE,
- ),
- 'access_callback' => array(
- 'description' => 'The callback which determines the access to this router path. Defaults to user_access.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'access_arguments' => array(
- 'description' => 'A serialized array of arguments for the access callback.',
- 'type' => 'blob',
- 'not null' => FALSE,
- ),
- 'page_callback' => array(
- 'description' => 'The name of the function that renders the page.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'page_arguments' => array(
- 'description' => 'A serialized array of arguments for the page callback.',
- 'type' => 'blob',
- 'not null' => FALSE,
- ),
- 'delivery_callback' => array(
- 'description' => 'The name of the function that sends the result of the page_callback function to the browser.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'fit' => array(
- 'description' => 'A numeric representation of how specific the path is.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'number_parts' => array(
- 'description' => 'Number of parts in this router path.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'context' => array(
- 'description' => 'Only for local tasks (tabs) - the context of a local task to control its placement.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'tab_parent' => array(
- 'description' => 'Only for local tasks (tabs) - the router path of the parent page (which may also be a local task).',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'tab_root' => array(
- 'description' => 'Router path of the closest non-tab parent page. For pages that are not local tasks, this will be the same as the path.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'title' => array(
- 'description' => 'The title for the current page, or the title for the tab if this is a local task.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'title_callback' => array(
- 'description' => 'A function which will alter the title. Defaults to t()',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'title_arguments' => array(
- 'description' => 'A serialized array of arguments for the title callback. If empty, the title will be used as the sole argument for the title callback.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'theme_callback' => array(
- 'description' => 'A function which returns the name of the theme that will be used to render this page. If left empty, the default theme will be used.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'theme_arguments' => array(
- 'description' => 'A serialized array of arguments for the theme callback.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'type' => array(
- 'description' => 'Numeric representation of the type of the menu item, like MENU_LOCAL_TASK.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'description' => array(
- 'description' => 'A description of this item.',
- 'type' => 'text',
- 'not null' => TRUE,
- ),
- 'position' => array(
- 'description' => 'The position of the block (left or right) on the system administration page for this item.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'weight' => array(
- 'description' => 'Weight of the element. Lighter weights are higher up, heavier weights go down.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'include_file' => array(
- 'description' => 'The file to include for this element, usually the page callback function lives in this file.',
- 'type' => 'text',
- 'size' => 'medium',
- ),
- ),
- 'indexes' => array(
- 'fit' => array('fit'),
- 'tab_parent' => array(array('tab_parent', 64), 'weight', 'title'),
- 'tab_root_weight_title' => array(array('tab_root', 64), 'weight', 'title'),
- ),
- 'primary key' => array('path'),
- );
-
- $schema['menu_links'] = array(
- 'description' => 'Contains the individual links within a menu.',
- 'fields' => array(
- 'menu_name' => array(
- 'description' => "The menu name. All links with the same menu name (such as 'main-menu') are part of the same menu.",
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'mlid' => array(
- 'description' => 'The menu link ID (mlid) is the integer primary key.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'plid' => array(
- 'description' => 'The parent link ID (plid) is the mlid of the link above in the hierarchy, or zero if the link is at the top level in its menu.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'link_path' => array(
- 'description' => 'The Backdrop path or external path this link points to.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'router_path' => array(
- 'description' => 'For links corresponding to a Backdrop path (external = 0), this connects the link to a {menu_router}.path for joins.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'link_title' => array(
- 'description' => 'The text displayed for the link, which may be modified by a title callback stored in {menu_router}.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'translatable' => TRUE,
- ),
- 'langcode' => array(
- 'description' => 'The language code for this menu link; if \'und\', the link will be shown in all languages.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'options' => array(
- 'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.',
- 'type' => 'blob',
- 'not null' => FALSE,
- 'translatable' => TRUE,
- ),
- 'module' => array(
- 'description' => 'The name of the module that generated this link.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => 'system',
- ),
- 'hidden' => array(
- 'description' => 'A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link)',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'external' => array(
- 'description' => 'A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'has_children' => array(
- 'description' => 'Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'expanded' => array(
- 'description' => 'Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded)',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'weight' => array(
- 'description' => 'Link weight among links in the same menu at the same depth.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'depth' => array(
- 'description' => 'The depth relative to the top level. A link with plid == 0 will have depth == 1.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'customized' => array(
- 'description' => 'A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- 'p1' => array(
- 'description' => 'The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the plid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p2' => array(
- 'description' => 'The second mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p3' => array(
- 'description' => 'The third mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p4' => array(
- 'description' => 'The fourth mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p5' => array(
- 'description' => 'The fifth mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p6' => array(
- 'description' => 'The sixth mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p7' => array(
- 'description' => 'The seventh mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p8' => array(
- 'description' => 'The eighth mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'p9' => array(
- 'description' => 'The ninth mlid in the materialized path. See p1.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'updated' => array(
- 'description' => 'Flag that indicates that this link was generated during the update from Drupal 5.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'small',
- ),
- ),
- 'indexes' => array(
- 'path_menu' => array(array('link_path', 128), 'menu_name'),
- 'menu_plid_expand_child' => array('menu_name', 'plid', 'expanded', 'has_children'),
- 'menu_parents' => array('menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'),
- 'router_path' => array(array('router_path', 128)),
- ),
- 'primary key' => array('mlid'),
- );
-
- $schema['queue'] = array(
- 'description' => 'Stores items in queues.',
- 'fields' => array(
- 'item_id' => array(
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique item ID.',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The queue name.',
- ),
- 'data' => array(
- 'type' => 'blob',
- 'not null' => FALSE,
- 'size' => 'big',
- 'serialize' => TRUE,
- 'description' => 'The arbitrary data for the item.',
- ),
- 'expire' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Timestamp when the claim lease expires on the item.',
- ),
- 'created' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'Timestamp when the item was created.',
- ),
- ),
- 'primary key' => array('item_id'),
- 'indexes' => array(
- 'name_created' => array('name', 'created'),
- 'expire' => array('expire'),
- ),
- );
-
- $schema['semaphore'] = array(
- 'description' => 'Table for holding semaphores, locks, flags, etc. that cannot be stored as Backdrop variables since they must not be cached.',
- 'fields' => array(
- 'name' => array(
- 'description' => 'Primary Key: Unique name.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'A value for the semaphore.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'expire' => array(
- 'description' => 'A Unix timestamp with microseconds indicating when the semaphore should expire.',
- 'type' => 'float',
- 'size' => 'big',
- 'not null' => TRUE,
- ),
- ),
- 'indexes' => array(
- 'value' => array('value'),
- 'expire' => array('expire'),
- ),
- 'primary key' => array('name'),
- );
-
- $schema['sequences'] = array(
- 'description' => 'Stores IDs.',
- 'fields' => array(
- 'value' => array(
- 'description' => 'The value of the sequence.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- ),
- 'primary key' => array('value'),
- );
-
- $schema['sessions'] = array(
- 'description' => "Backdrop's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated.",
- 'fields' => array(
- 'uid' => array(
- 'description' => 'The {users}.uid corresponding to a session, or 0 for anonymous user.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'sid' => array(
- 'description' => "A session ID. The value is generated by Backdrop's session handlers.",
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- ),
- 'ssid' => array(
- 'description' => "Secure session ID. The value is generated by Backdrop's session handlers.",
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'hostname' => array(
- 'description' => 'The IP address that last used this session ID (sid).',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'timestamp' => array(
- '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(
- 'description' => 'The serialized contents of $_SESSION, an array of name/value pairs that persists across page requests by this session ID. Backdrop 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(
- 'sid',
- 'ssid',
- ),
- 'indexes' => array(
- 'timestamp' => array('timestamp'),
- 'uid' => array('uid'),
- 'ssid' => array('ssid'),
- ),
- 'foreign keys' => array(
- 'session_user' => array(
- 'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- ),
- );
-
- $schema['state'] = array(
- 'description' => 'Stores environment-specific state values.',
- 'fields' => array(
- 'name' => array(
- 'description' => 'The name of the state.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value of the state.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- ),
- ),
- 'primary key' => array('name'),
- );
-
- $schema['system'] = array(
- 'description' => "A list of all modules, themes, and theme engines that are or have been installed in Backdrop's file system.",
- 'fields' => array(
- 'filename' => array(
- 'description' => 'The path of the primary file for this item, relative to the Backdrop root; e.g. modules/node/node.module.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'description' => 'The name of the item; e.g. node.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'type' => array(
- 'description' => 'The type of the item, either module, theme, or theme_engine.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'owner' => array(
- 'description' => "A theme's 'parent' . Can be either a theme or an engine.",
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'status' => array(
- 'description' => 'Boolean indicating whether or not this item is enabled.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'bootstrap' => array(
- 'description' => "Boolean indicating whether this module is loaded during Backdrop's early bootstrapping phase (e.g. even before the page cache is consulted).",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'schema_version' => array(
- 'description' => "The module's database schema version number. -1 if the module is not installed (its tables do not exist); 0 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(
- '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(
- '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'),
- ),
- );
-
- $schema['tempstore'] = array(
- 'description' => 'Generic temporary key/value storage table with an expiration.',
- 'fields' => array(
- 'collection' => array(
- 'description' => 'A named collection of key and value pairs.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
-
- 'description' => 'The key of the key/value pair.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value of the key/value pair.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- ),
- 'expire' => array(
- 'description' => 'The time since Unix epoch in seconds when this item expires.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('collection', 'name'),
- 'indexes' => array(
- 'all' => array('name', 'collection', 'expire'),
- 'expire' => array('expire'),
- ),
- );
-
- $schema['url_alias'] = array(
- 'description' => 'A list of URL aliases for Backdrop paths; a user may visit either the source or destination path.',
- 'fields' => array(
- 'pid' => array(
- 'description' => 'A unique URL alias identifier.',
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'source' => array(
- 'description' => 'The Backdrop path this alias is for; e.g. node/12.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'alias' => array(
- 'description' => 'The alias for this path; e.g. title-of-the-story.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'langcode' => array(
- 'description' => "The language code this alias is for; if 'und', the alias will be used for unknown languages. Each Backdrop path can have an alias for each supported language.",
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'auto' => array(
- 'description' => 'Boolean indicator if this path was generated from a pattern or manually.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => FALSE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('pid'),
- 'indexes' => array(
- 'alias_langcode_pid' => array('alias', 'langcode', 'pid'),
- 'source_langcode_pid' => array('source', 'langcode', 'pid'),
- ),
- );
-
- return $schema;
- }
-
- * Implements hook_update_last_removed().
- *
- * Returns latest required Drupal 7 schema version for upgrade to Backdrop CMS.
- */
- function system_update_last_removed() {
-
- return 7078;
- }
-
- * @defgroup updates-7.x-to-1.x Updates from 7.x to 1.x
- * @{
- * Update functions from Drupal 7.x to Backdrop CMS 1.x.
- */
-
- * Enable entity module.
- */
- function system_update_1000() {
- update_module_enable(array('entity'));
- }
-
- * Move from the Garland theme.
- */
- function system_update_1001() {
- $themes = array('theme_default', 'maintenance_theme', 'admin_theme');
- foreach ($themes as $theme) {
- if (update_variable_get($theme) == 'garland') {
- update_variable_set($theme, 'bartik');
- }
- }
- }
-
- * Set Bartik as default theme if it implicitly was the default before.
- *
- * The default theme for Backdrop core was changed from Bartik to Stark.
- * Installation profiles (including Standard and Minimal) were changed to
- * explicitly configure Bartik as default theme. Since Bartik was the default
- * theme by default and may not have been explicitly configured as such
- * previously, this update ensures that the implicit Bartik default is still the
- * default.
- *
- * @see http://drupal.org/node/1181776
- */
- function system_update_1002() {
- $theme = update_variable_get('theme_default');
- if (!isset($theme)) {
- update_variable_set('theme_default', 'bartik');
- }
- }
-
- * Convert performance module settings to use configuration files.
- */
- function system_update_1003() {
- $config = config('system.core');
- $config->set('cache', update_variable_get('cache', 0));
- $config->set('cache_lifetime', update_variable_get('cache_lifetime', '0'));
- $config->set('page_cache_maximum_age', update_variable_get('page_cache_maximum_age', '0'));
- $config->set('page_compression', update_variable_get('page_compression', 1));
- $config->set('preprocess_css', update_variable_get('preprocess_css', 0));
- $config->set('preprocess_js', update_variable_get('preprocess_js', 0));
- $config->save();
-
- update_variable_del('cache');
- update_variable_del('cache_lifetime');
- update_variable_del('page_cache_maximum_age');
- update_variable_del('page_compression');
- update_variable_del('preprocess_css');
- update_variable_del('preprocess_js');
- }
-
- * Create the "state" table for the state storage system.
- */
- function system_update_1004() {
- if (!db_table_exists('state')) {
- $schema = array(
- 'description' => 'Stores environment-specific state values.',
- 'fields' => array(
- 'name' => array(
- 'description' => 'The name of the state.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value of the state.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- ),
- ),
- 'primary key' => array('name'),
- );
- db_create_table('state', $schema);
- }
- }
-
- * Convert basic system variables to the state system.
- */
- function system_update_1005() {
- $variables = array(
- 'install_time' => REQUEST_TIME,
- 'install_task' => 'done',
- 'maintenance_mode' => FALSE,
- 'cron_key' => NULL,
- 'cron_last' => REQUEST_TIME,
- 'css_js_query_string' => '',
- );
- foreach ($variables as $name => $default) {
- state_set($name, update_variable_get($name, $default));
- update_variable_del($name);
- }
- }
-
- * Delete unneeded actions for manually saving comments and nodes.
- */
- function system_update_1006() {
- db_delete('actions')
- ->condition('aid', array('comment_save_action', 'node_save_action'), 'IN')
- ->execute();
- }
-
- * Create the tempstore table and remove the cache_form table.
- */
- function system_update_1007() {
- $schema = array(
- 'description' => 'Generic temporary key/value storage table with an expiration.',
- 'fields' => array(
- 'collection' => array(
- 'description' => 'A named collection of key and value pairs.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
-
- 'description' => 'The key of the key/value pair.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'value' => array(
- 'description' => 'The value of the key/value pair.',
- 'type' => 'blob',
- 'not null' => TRUE,
- 'size' => 'big',
- ),
- 'expire' => array(
- 'description' => 'The time since Unix epoch in seconds when this item expires.',
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'primary key' => array('collection', 'name'),
- 'indexes' => array(
- 'all' => array('name', 'collection', 'expire'),
- 'expire' => array('expire'),
- ),
- );
- if (!db_table_exists('tempstore')) {
- db_create_table('tempstore', $schema);
- }
- if (db_table_exists('cache_form')) {
- db_drop_table('cache_form');
- }
- }
-
- * Convert the 'filesize' column in {file_managed} to a bigint.
- */
- function system_update_1008() {
- $spec = array(
- 'description' => 'The size of the file in bytes.',
- 'type' => 'int',
- 'size' => 'big',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- );
- db_change_field('file_managed', 'filesize', 'filesize', $spec);
- }
-
- * Enable Admin Menu module.
- */
- function system_update_1009() {
- update_module_enable(array('admin_bar'));
-
-
- $config = config('admin_bar.settings');
- $config->set('margin_top', 1);
- $config->set('position_fixed', 0);
- $config->set('components', array(
- 'admin_bar.icon',
- 'admin_bar.menu',
- 'admin_bar.search',
- 'admin_bar.page',
- 'admin_bar.users',
- 'admin_bar.account',
- ));
- $config->save();
-
-
- if (!db_table_exists('cache_admin_bar')) {
- $cache_admin_bar = backdrop_get_schema_unprocessed('system', 'cache');
- $cache_admin_bar['description'] = 'Cache table for Administration menu to store client-side caching hashes.';
- db_create_table('cache_admin_bar', $cache_admin_bar);
- }
- }
-
- * Remove the registry and registry_file tables.
- */
- function system_update_1010() {
- if (db_table_exists('registry')) {
- db_drop_table('registry');
- }
- if (db_table_exists('registry_file')) {
- db_drop_table('registry_file');
- }
- }
-
- * Specify the files directory manually if needed.
- */
- function system_update_1011() {
- $file_path = update_variable_get('file_public_path', NULL);
- if (is_null($file_path)) {
- $conf_path = conf_path();
- if ($conf_path != '.') {
- $conf_path = str_replace('./', '', $conf_path);
- update_variable_set('file_public_path', $conf_path . '/files');
- }
- else {
- update_variable_set('file_public_path', 'sites/default/files');
- }
- }
- }
-
- * Convert cron settings to use configuration files.
- */
- function system_update_1012() {
-
- $config = config('system.core');
- $config->set('cron_threshold_warning', update_variable_get('cron_threshold_warning', 172800));
- $config->set('cron_safe_threshold', update_variable_get('cron_safe_threshold', 10800));
- $config->set('cron_max_threshold', update_variable_get('cron_max_threshold', 10800));
- $config->set('cron_threshold_error', update_variable_get('cron_threshold_error', 1209600));
- $config->save();
-
-
- update_variable_del('cron_threshold_warning');
- update_variable_del('cron_safe_threshold');
- update_variable_del('cron_max_threshold');
- update_variable_del('cron_threshold_error');
- }
-
- * Moves site system settings from variable to config.
- */
- function system_update_1013() {
-
- $config = config('system.core');
- $config->set('site_name', update_variable_get('site_name', 'Backdrop'));
- $config->set('site_mail', update_variable_get('site_mail', ''));
- $config->set('site_slogan', update_variable_get('site_slogan', ''));
- $config->set('site_frontpage', update_variable_get('site_frontpage', 'node'));
- $config->set('site_403', update_variable_get('site_403', ''));
- $config->set('site_404', update_variable_get('site_404', ''));
- $config->save();
-
- update_variable_del('site_name');
- update_variable_del('site_mail');
- update_variable_del('site_slogan');
- update_variable_del('site_frontpage');
- update_variable_del('site_403');
- update_variable_del('site_404');
- }
-
- * Move the system maintenance settings from variable to config.
- */
- function system_update_1014() {
-
- state_set('maintenance_mode', update_variable_get('maintenance_mode', TRUE));
- config_set('system.core', 'maintenance_mode_message', update_variable_get('maintenance_mode_message', 'message'));
-
-
- update_variable_del('maintenance_mode');
- update_variable_del('maintenance_mode_message');
- }
-
- * Convert RSS publishing settings to use configuration files.
- */
- function system_update_1015() {
-
- $config = config('system.core');
- $config->set('rss_description', update_variable_get('feed_description', ''));
- $config->set('rss_limit', update_variable_get('feed_default_items', 10));
-
- $config->set('rss_viewmode', update_variable_get('feed_item_length', 'fulltext'));
- $config->save();
-
-
- update_variable_del('feed_description');
- update_variable_del('feed_default_items');
- update_variable_del('feed_item_length');
- }
-
- * Moves action_max_stack from variable to config.
- */
- function system_update_1016() {
-
- $config = config('system.core');
- $config->set('action_recursion_limit', update_variable_get('actions_max_stack', 35));
- $config->save();
-
-
- update_variable_del('actions_max_stack');
- }
-
- * Moves system logging settings from variables to config.
- */
- function system_update_1017() {
-
- switch ((int) update_variable_get('error_level', '2')) {
- case 0:
- $error_level = 'hide';
- break;
- case 1:
- $error_level = 'some';
- break;
- default:
- $error_level = 'all';
- }
-
-
- $config = config('system.core');
- $config->set('log_row_limit', update_variable_get('dblog_row_limit', 1000));
- $config->set('log_identity', update_variable_get('syslog_identity', 'backdrop'));
- $config->set('log_facility', update_variable_get('syslog_facility', ''));
- $config->set('log_format', update_variable_get('syslog_format', '!base_url|!timestamp|!type|!ip|!request_uri|!referer|!uid|!link|!message'));
- $config->set('error_level', $error_level);
- $config->save();
-
-
- update_variable_del('error_level');
- update_variable_del('dblog_row_limit');
- update_variable_del('syslog_identity');
- update_variable_del('syslog_facility');
- update_variable_del('syslog_format');
- }
-
- * Moves authorize system settings from variable to config.
- */
- function system_update_1018() {
-
- $config = config('system.authorize');
- $config->set('filetransfer_default', update_variable_get('authorize_filetransfer_default', ''));
- $settings = db_query("SELECT name, value FROM {variable} WHERE name LIKE 'authorize_filetransfer_connection_settings_%'");
- foreach ($settings as $row) {
- $row = unserialize($row);
- $config->set('authorize_filetransfer_connection_settings_' . $row[0], $row[1]);
- }
- $config->save();
-
-
- update_variable_del('allow_authorize_operations');
- update_variable_del('authorize_filetransfer_default');
-
- }
-
- * Converts active_menus_default variable to config.
- */
- function system_update_1019() {
-
- $config = config('system.core');
- $config->set('active_menus_default', update_variable_get('menu_default_active_menus', array()));
- $config->save();
-
-
- update_variable_del('menu_default_active_menus');
- }
-
- * Convert date settings to config.
- */
- function system_update_1020() {
-
- if (!db_table_exists('date_format_type')) {
- return;
- }
-
-
- $config = config('system.date');
- $config->set('first_day', update_variable_get('date_first_day', 0));
- $config->set('default_country', update_variable_get('site_default_country', ''));
- $config->set('default_timezone', update_variable_get('date_default_timezone', ''));
- $config->set('user_configurable_timezones', update_variable_get('configurable_timezones', 1));
- $config->set('user_empty_timezone_message', update_variable_get('empty_timezone_message', 0));
- $config->set('user_default_timezone', update_variable_get('user_default_timezone', 0));
-
-
- update_variable_del('site_default_country');
- update_variable_del('date_first_day');
- update_variable_del('date_default_timezone');
- update_variable_del('configurable_timezones');
- update_variable_del('empty_timezone_message');
- update_variable_del('user_default_timezone');
-
-
- $formats = array(
- 'long' => array(
- 'label' => 'Default Long Date',
- 'pattern' => 'l, F j, Y - H:i',
- 'module' => 'system',
- ),
- 'medium' => array(
- 'label' => 'Default Medium Date',
- 'pattern' => 'D, m/d/Y - H:i',
- 'module' => 'system',
- ),
- 'short' => array(
- 'label' => 'Default Short Date',
- 'pattern' => 'm/d/Y - H:i',
- 'module' => 'system',
- ),
- 'html_datetime' => array(
- 'label' => 'HTML Datetime',
- 'pattern' => 'Y-m-d\\TH:i:sO',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- 'html_date' => array(
- 'label' => 'HTML Date',
- 'pattern' => 'Y-m-d',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- 'html_time' => array(
- 'label' => 'HTML Time',
- 'pattern' => 'H:i:s',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- 'html_yearless_date' => array(
- 'label' => 'HTML Yearless date',
- 'pattern' => 'm-d',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- 'html_week' => array(
- 'label' => 'HTML Week',
- 'pattern' => 'Y-\\WW',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- 'html_month' => array(
- 'label' => 'HTML Month',
- 'pattern' => 'Y-m',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- 'html_year' => array(
- 'label' => 'HTML Year',
- 'pattern' => 'Y',
- 'module' => 'system',
- 'hidden' => 1,
- ),
- );
-
-
- $result = db_query("SELECT * FROM {date_format_type}");
- foreach ($result as $row) {
- if ($pattern = update_variable_get('date_format_' . $row->type)) {
- $format = isset($formats[$row->type]) ? $formats[$row->type] : array();
- $format['label'] = $row->title;
- $format['pattern'] = $pattern;
- $formats[$row->type] = $format;
- update_variable_del('date_format_' . $row->type);
- }
- }
-
-
- $locale_result = db_query("SELECT * FROM {date_format_locale}");
- foreach ($locale_result as $row) {
- if (array_key_exists($row->type, $formats)) {
- $formats[$row->type]['locales'][$row->language] = $row->format;
- }
- }
-
- $config->set('formats', $formats);
- $config->save();
-
- db_drop_table('date_formats');
- db_drop_table('date_format_type');
- db_drop_table('date_format_locale');
- }
-
- * Removes the js_cache_files variable.
- */
- function system_update_1021() {
- update_variable_del('js_cache_files');
- }
-
- * Converts theme logo and shortcut settings to site-wide config.
- */
- function system_update_1022() {
-
- $config = config('system.core');
- $config->set('site_logo_theme', 1);
- $config->set('site_logo_path', '');
- $config->set('site_favicon_theme', 1);
- $config->set('site_favicon_path', 'core/misc/favicon.ico');
- $config->set('site_favicon_mimetype', 'image/vnd.microsoft.icon');
-
- $settings = update_variable_get('theme_settings');
-
-
- if (!empty($settings['toggle_logo'])) {
- $config->set('site_logo_theme', $settings['default_logo']);
- if (is_file($settings['logo_path'])) {
- $config->set('site_favicon_path', $settings['logo_path']);
- $config->set('site_favicon_mimetype', file_get_mimetype($settings['logo_path']));
- }
- }
-
-
- if (!empty($settings['toggle_favicon'])) {
- $config->set('site_favicon_theme', $settings['default_favicon']);
- if (is_file($settings['favicon_path'])) {
- $config->set('site_favicon_path', $settings['favicon_path']);
- }
- }
- }
-
- * Enable admin_bar, replacing the renamed admin_menu.
- */
- function system_update_1023() {
-
- }
-
- * Consolidate common config files into "system.core".
- */
- function system_update_1024() {
-
-
- $core_config = config('system.core');
- if (!$core_config->isNew()) {
- return;
- }
-
- $files_to_upgrade = array(
- 'system.site',
- 'system.rss',
- 'system.performance',
- 'system.menu',
- 'system.maintenance',
- 'system.logging',
- 'system.cron',
- 'user.settings',
- );
-
- $combined_data = array();
- foreach ($files_to_upgrade as $file) {
- $config = config($file);
- if ($config_data = $config->get()) {
- $combined_data = array_merge($combined_data, $config_data);
- }
- $config->delete();
- }
- $combined_data['_config_name'] = 'system.core';
- $combined_data['_config_static'] = TRUE;
- ksort($combined_data);
-
- $core_config->setData($combined_data);
- $core_config->save();
- }
-
- * Convert block positioning and configuration to the default layout.
- */
- function system_update_1025() {
- update_module_enable(array('layout'));
-
-
- $layout_settings_config = config('layout.settings');
- $legacy = array('one_column', 'two_column', 'two_column_flipped', 'three_three_four_column');
- $layout_settings_config->set('excluded_templates', $legacy);
- $layout_settings_config->save();
-
-
- if (!db_table_exists('cache_layout_path')) {
- $cache_table = backdrop_get_schema_unprocessed('system', 'cache');
- $cache_table['description'] = 'Cache table to store which layouts are active at a given path.';
- db_create_table('cache_layout_path', $cache_table);
- }
-
- $admin_layout = array(
- 'path' => NULL,
- 'name' => 'admin_default',
- 'title' => 'Default Administrative Layout',
- 'description' => NULL,
- 'module' => 'layout',
- 'weight' => 1,
- 'layout_template' => 'boxton',
- 'settings' => array(),
- 'positions' => array(
- 'content' => array(
- 'default',
- ),
- 'top' => array(
- '55f542fe-0763-453b-ba3e-62677ea559e5',
- ),
- ),
- 'content' => array(
- '55f542fe-0763-453b-ba3e-62677ea559e5' => array(
- 'plugin' => 'system:breadcrumb',
- 'data' => array(
- 'module' => 'system',
- 'delta' => 'breadcrumb',
- ),
- 'uuid' => '55f542fe-0763-453b-ba3e-62677ea559e5',
- ),
- 'default' => array(
- 'plugin' => 'system:main',
- 'data' => array(
- 'module' => 'system',
- 'delta' => 'main',
- ),
- 'uuid' => 'default',
- ),
- ),
- );
- $admin_config = config('layout.layout.admin_default');
- $admin_config->setData($admin_layout);
- $admin_config->save();
-
- $layout_name = state_get('upgrade_layout_name', 'simmons');
-
- $default_layout = array(
- 'path' => NULL,
- 'name' => 'default',
- 'title' => 'Default Layout',
- 'description' => NULL,
- 'module' => 'layout',
- 'weight' => 0,
- 'layout_template' => $layout_name,
- 'settings' => array(),
- 'positions' => array(
- 'header' => array(
- '84c43df4-1165-4faf-8700-c362a7153c0b',
- '13b2f325-af26-40bb-8c61-97fe1d93f19f',
- ),
- 'content' => array(
- 'default',
- ),
- 'footer' => array(
- 'cd4d033d-3f67-4191-8655-85ee758877c0',
- ),
- 'top' => array(
- '09f11b4e-877e-45ab-9000-a4c6254faa04',
- ),
- ),
- 'content' => array(
- '84c43df4-1165-4faf-8700-c362a7153c0b' => array(
- 'plugin' => 'system:header',
- 'data' => array(
- 'module' => 'system',
- 'delta' => 'header',
- 'settings' => array(),
- 'uuid' => '84c43df4-1165-4faf-8700-c362a7153c0b',
- ),
- ),
- '13b2f325-af26-40bb-8c61-97fe1d93f19f' => array(
- 'plugin' => 'system:main-menu',
- 'data' => array(
- 'module' => 'system',
- 'delta' => 'main-menu',
- 'uuid' => '13b2f325-af26-40bb-8c61-97fe1d93f19f',
- 'settings' => array(
- 'title_display' => 'none',
- ),
- ),
- ),
- '09f11b4e-877e-45ab-9000-a4c6254faa04' => array(
- 'plugin' => 'system:breadcrumb',
- 'data' => array(
- 'module' => 'system',
- 'delta' => 'breadcrumb',
- 'uuid' => '09f11b4e-877e-45ab-9000-a4c6254faa04',
- ),
- ),
- 'default' => array(
- 'plugin' => 'system:main',
- 'data' => array(
- 'module' => 'system',
- 'delta' => 'main',
- 'uuid' => 'default',
- ),
- ),
- ),
- );
-
- $current_theme = update_variable_get('theme_default', 'bartik');
- $layout_regions = state_get('upgrade_layout_regions', array(
- 'header' => 'header',
- 'top' => 'top',
- 'content' => 'content',
- 'sidebar_first' => 'sidebar',
- 'sidebar_second' => 'sidebar2',
- 'triptych_first' => 'third1',
- 'triptych_middle' => 'third2',
- 'triptych_last' => 'third3',
- 'footer_firstcolumn' => 'quarter1',
- 'footer_secondcolumn' => 'quarter2',
- 'footer_thirdcolumn' => 'quarter3',
- 'footer_fourthcolumn' => 'quarter4',
- 'footer' => 'footer',
- ));
- $default_layout['layout_template'] = $layout_name;
-
-
- $node_layout = $default_layout;
- $node_layout['title'] = t('Node layout');
- $node_layout['name'] = 'node';
- $node_layout['path'] = 'node/%';
- unset($node_layout['module']);
- $node_layout_required = FALSE;
-
- $result = db_query("SELECT * FROM {block} WHERE theme = :theme AND status = 1 AND NOT (module = 'system' AND delta = 'main') ORDER BY region, weight", array(':theme' => $current_theme));
- foreach ($result as $block_row) {
- if (array_key_exists($block_row->region, $layout_regions)) {
- $region = $layout_regions[$block_row->region];
- $is_node_block = FALSE;
-
-
- $uuid = new Uuid();
- $block_uuid = $uuid->generate();
- $block_config = array(
- 'plugin' => $block_row->module . ':' . $block_row->delta,
- 'data' => array(
- 'module' => $block_row->module,
- 'delta' => $block_row->delta,
- 'uuid' => $block_uuid,
- 'conditions' => array(),
- ),
- );
-
-
- $pages = trim($block_row->pages);
- $visibility = (int) $block_row->visibility;
- if ($pages && $visibility !== 2) {
- $settings = array(
- 'paths' => $pages,
- 'visibility_setting' => $visibility,
- );
- $access_config = array(
- 'plugin' => 'path',
- 'data' => array(
- 'settings' => $settings,
- ),
- );
- $block_config['data']['conditions'][] = $access_config;
- }
-
-
- if (db_table_exists('block_role')) {
- $role_result = db_query("SELECT * FROM {block_role} WHERE module = :module AND delta = :delta", array(':module' => $block_row->module, ':delta' => $block_row->delta));
- $roles = array();
- foreach ($role_result as $role_row) {
- switch ($role_row->rid) {
- case 1:
- $roles[] = 'anonymous';
- break;
- case 2:
- $roles[] = 'authenticated';
- break;
- default:
- $roles[] = $role_row->rid;
- }
- }
- if ($roles) {
- $settings = array('roles' => $roles);
- $access_config = array(
- 'plugin' => 'user_role',
- 'data' => array(
- 'settings' => $settings,
- ),
- );
- $block_config['data']['conditions'][] = $access_config;
- }
- }
-
-
- if (db_table_exists('block_node_type')) {
- $type_result = db_query("SELECT * FROM {block_node_type} WHERE module = :module AND delta = :delta", array(':module' => $block_row->module, ':delta' => $block_row->delta));
- $types = array();
- foreach ($type_result as $type_row) {
- $types[] = $type_row->type;
- $node_layout_required = TRUE;
- $is_node_block = TRUE;
- }
- if ($types) {
- $settings = array('bundles' => $types);
- $access_config = array(
- 'plugin' => 'node:bundle',
- 'data' => array(
- 'settings' => $settings,
- ),
- );
- $block_config['data']['conditions'][] = $access_config;
- }
- }
-
-
- if (!$is_node_block) {
- $default_layout['positions'][$region][] = $block_uuid;
- $default_layout['content'][$block_uuid] = $block_config;
- }
-
-
- $node_layout['positions'][$region][] = $block_uuid;
- $node_layout['content'][$block_uuid] = $block_config;
- }
- }
-
-
- $layout_config = config('layout.layout.default');
- $layout_config->setData($default_layout);
- $layout_config->save();
-
-
- if ($node_layout_required) {
- $layout_config = config('layout.layout.node');
- $layout_config->setData($node_layout);
- $layout_config->save();
- }
-
-
- config_set('system.core', 'menu_route_handler', 'layout_route_handler');
- }
-
- * Convert file system, clean URL, profile, and theme variables to config.
- */
- function system_update_1026() {
- $config = config('system.core');
- $config->set('file_additional_public_schemes', update_variable_get('file_additional_public_schemes', array()));
- $config->set('file_default_scheme', update_variable_get('file_default_scheme', 'public'));
- $config->set('file_public_path', update_variable_get('file_public_path', 'files'));
- $config->set('file_temporary_path', update_variable_get('file_temporary_path', ''));
- $config->set('file_private_path', update_variable_get('file_private_path', ''));
- $config->set('image_jpeg_quality', update_variable_get('image_jpeg_quality', 75));
-
-
-
- $current_profile = update_variable_get('install_profile', 'standard');
- $available_profiles = backdrop_system_listing('/\.profile$/', 'profiles');
- if (!array_key_exists($current_profile, $available_profiles)) {
- $old_profile = $current_profile;
- $current_profile = 'standard';
-
-
- db_update('system')
- ->fields(array('status' => 1, 'schema_version' => 0))
- ->condition('name', $current_profile)
- ->execute();
-
- db_update('system')
- ->fields(array('status' => 0))
- ->condition('name', $old_profile)
- ->execute();
- }
- $config->set('install_profile', $current_profile);
-
- $config->set('clean_url', update_variable_get('clean_url', 0));
- $config->set('theme_default', update_variable_get('theme_default', 'stark'));
- $config->set('admin_theme', update_variable_get('admin_theme', ''));
- $config->set('node_admin_theme', update_variable_get('node_admin_theme', ''));
- $config->save();
-
-
- update_variable_del('file_default_scheme');
- update_variable_del('file_public_path');
- update_variable_del('file_temporary_path');
- update_variable_del('file_private_path');
- update_variable_del('install_profile');
- update_variable_del('clean_url');
- update_variable_del('theme_default');
- update_variable_del('admin_theme');
- update_variable_del('node_admin_theme');
- update_variable_del('image_jpeg_quality');
-
-
- update_variable_del('css_gzip_compression');
- update_variable_del('js_gzip_compression');
-
-
- update_variable_del('javascript_parsed');
- }
-
- * Remove the per-user cache column from the session table.
- */
- function system_update_1027() {
- if (db_field_exists('sessions', 'cache')) {
- db_drop_field('sessions', 'cache');
- }
-
- $config = config('system.core');
- $config->clear('cache_lifetime');
- $config->save();
- }
-
- * Convert filter fallback and user cancellation method variables to config.
- */
- function system_update_1028() {
- $config = config('system.core');
- $config->set('filter_fallback_format', update_variable_get('filter_fallback_format', 'plain_text'));
- $config->set('user_cancel_method', update_variable_get('user_cancel_method', 'user_cancel_block'));
- $config->save();
-
- update_variable_del('filter_fallback_format');
- update_variable_del('user_cancel_method');
- }
-
- * Convert config sync size to config.
- */
- function system_update_1029() {
- $config = config('system.core');
- $config->set('config_sync_batch_size', update_variable_get('config_sync_batch_size', 20));
- $config->set('default_nodes_main', update_variable_get('default_nodes_main', 10));
- $config->save();
- }
-
- * Convert mail system variable to config.
- */
- function system_update_1030() {
- $config = config('system.mail');
- $config->setData(update_variable_get('mail_system', array('default-system' => 'DefaultMailSystem')));
- $config->save();
- update_variable_del('mail_system');
- }
-
- * Drop the actions table, no longer used by Backdrop.
- */
- function system_update_1031() {
-
-
-
- if (db_table_exists('actions')) {
- db_drop_table('actions');
- }
-
-
- $action_config = config('system.action');
- if (!$action_config->isNew()) {
- $config = config('system.core');
- $config->set('action_recursion_limit', $action_config->get('action_recursion_limit'));
- $config->save();
- $action_config->delete();
- }
- }
-
- * Enable config module.
- */
- function system_update_1032() {
- update_module_enable(array('config'));
- }
-
- * Set the minimum page cache lifetime to 5 minutes by default.
- */
- function system_update_1033() {
- $config = config('system.core');
- if ($config->get('page_cache_maximum_age') == 0) {
- $config->set('page_cache_maximum_age', 300);
- $config->save();
- }
- }
-
- * Set the theme_debug flag to FALSE.
- */
- function system_update_1034() {
- config_set('system.core', 'theme_debug', FALSE);
- }
-
- * Set the weight of Layout module to run last.
- */
- function system_update_1035() {
-
-
-
- module_set_weight('layout', 60);
- }
-
- * Remove the private key from configuration.
- */
- function system_update_1036() {
-
- $config = config('system.core');
- $config->clear('private_key');
- $config->save();
- }
-
- * Set the default value for canonical_secure option.
- * Check if old menu item exists and remove it.
- */
- function system_update_1037() {
- config_set('system.core', 'canonical_secure', 0);
-
- $res = db_query("SELECT mlid FROM {menu_links} WHERE menu_name = 'management' AND link_title = 'Clean URLs'");
- if ($res->rowCount()) {
- $mlid = $res->fetch()->mlid;
- db_delete('menu_links')
- ->condition('mlid', $mlid, '=')
- ->execute();
- }
- }
-
- * Upgrade or prepare for token module in core.
- */
- function system_update_1038() {
-
- if (!db_table_exists('cache_token')) {
- $cache_token = backdrop_get_schema_unprocessed('system', 'cache');
- $cache_token['description'] = 'Cache table for token information.';
- db_create_table('cache_token', $cache_token);
- }
-
-
-
- db_query("DELETE FROM {system} WHERE name = 'token' AND type = 'module'");
- }
-
- * Add the "auto" column to the url_alias table.
- */
- function system_update_1039() {
- if (!db_field_exists('url_alias', 'auto')) {
- $spec = array(
- 'description' => 'Boolean indicator if this path was generated from a pattern or manually.',
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => FALSE,
- 'default' => 0,
- );
- db_add_field('url_alias', 'auto', $spec);
-
-
- db_query("UPDATE {url_alias} SET auto = NULL");
- }
- }
-
- * Notify administrators if a non-core version of CKEditor module is present.
- */
- function system_update_1040() {
- $path = backdrop_get_path('module', 'ckeditor');
- if ($path && strpos($path, 'core/modules/ckeditor') === FALSE) {
- backdrop_set_message(t('Backdrop core now provides a bundled CKEditor module. A different copy of CKEditor module has been located at %path. To use the new CKEditor module, disable and then uninstall the current module, remove it from your installation, and then enable the new CKEditor module from the modules page. For more information see the <a href="https://docs.backdropcms.org/node/42827" target="_blank">CKEditor change notice</a>.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
- }
- }
-
- * Notify administrators if a non-core version of Email module is present.
- */
- function system_update_1041() {
- $path = backdrop_get_path('module', 'email');
- if ($path && strpos($path, 'core/modules/email') === FALSE) {
- backdrop_set_message(t('Backdrop core now provides a bundled Email module. A different copy of Email module has been located at %path. Remove this module from your installation to use the core Email module. For more information see the <a href="https://docs.backdropcms.org/node/42928" target="_blank">Email module change notice</a>.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
- }
- }
-
- * Notify administrators if a non-core version of Link module is present.
- */
- function system_update_1042() {
- $path = backdrop_get_path('module', 'link');
- if ($path && strpos($path, 'core/modules/link') === FALSE) {
- backdrop_set_message(t('Backdrop core now provides a bundled Link module. A different copy of Link module has been located at %path. Remove this module from your installation to use new Link module. For more information see the <a href="https://docs.backdropcms.org/node/42930" target="_blank">Link change notice</a>.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
- }
- }
-
- * Remove old Date configuration files.
- */
- function system_update_1043() {
- config('date_api.settings')->delete();
- config('date.settings')->delete();
-
- $config = config('date_views.settings');
- if ($config->isNew()) {
- $config->set('date_views_month_format_with_year', update_variable_get('date_views_month_format_with_year', 'F Y'));
- $config->set('date_views_month_format_without_year', update_variable_get('date_views_month_format_without_year', 'F'));
- $config->set('date_views_day_format_with_year', update_variable_get('date_views_day_format_with_year', 'l, F j, Y'));
- $config->set('date_views_day_format_without_year', update_variable_get('date_views_day_format_without_year', 'l, F j'));
- $config->set('date_views_week_format_with_year', update_variable_get('date_views_week_format_with_year', 'F j, Y'));
- $config->set('date_views_week_format_without_year', update_variable_get('date_views_week_format_without_year', 'F j'));
- $config->save();
- }
-
-
- update_variable_del('date_min_year');
- update_variable_del('date_max_year');
- update_variable_del('date_php_min_year');
- update_variable_del('date_api_use_iso8601');
- update_variable_del('date_db_tz_support');
- update_variable_del('date_api_version');
- update_variable_del('date_popup_timepicker');
- update_variable_del('date_views_month_format_with_year');
- update_variable_del('date_views_month_format_without_year');
- update_variable_del('date_views_day_format_with_year');
- update_variable_del('date_views_day_format_without_year');
- update_variable_del('date_views_week_format_with_year');
- update_variable_del('date_views_week_format_without_year');
-
-
- $default_timezone = config_get('system.date', 'default_timezone');
- if (empty($default_timezone)) {
- $default_timezone = @date_default_timezone_get();
- config_set('system.date', 'default_timezone', $default_timezone);
- }
- }
-
- * Notify administrators if a non-core version of the Date module is present.
- */
- function system_update_1044() {
- $path = backdrop_get_path('module', 'date');
- if ($path && strpos($path, 'core/modules/date') === FALSE) {
- backdrop_set_message(t('Backdrop core now provides a bundled Date module. A different copy of Date module has been located at %path. Remove this module from your installation to use new Date module. For more information see the <a href="https://docs.backdropcms.org/node/43066" target="_blank">Date change notice</a>.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
- }
- }
-
- * Ensure that the installation flag is properly set.
- */
- function system_update_1045() {
- state_set('install_task', 'done');
- }
-
- * Upgrade or prepare for transliteration functions in core.
- */
- function system_update_1046() {
- $config = config('system.core');
-
-
- if (module_exists('transliteration')) {
- $contrib_config = config('transliteration.settings');
- $config->set('file_transliterate_lowercase', $contrib_config->get('file_lowercase'));
- $config->set('file_transliterate_uploads', $contrib_config->get('file_uploads'));
- $config->set('file_transliterate_uploads_display_name', $contrib_config->get('file_uploads_display_name'));
-
- $path = backdrop_get_path('module', 'transliteration');
- backdrop_set_message(t('Backdrop core now provides transliteration functions in core. A copy of Transliteration module has been located at %path. The module has been disabled, you can remove it safely from your installation.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
-
- db_query("DELETE FROM {system} WHERE name = 'transliteration' AND type = 'module'");
- }
- else {
-
- $config->set('file_transliterate_lowercase', update_variable_get('transliteration_file_lowercase', FALSE));
- $config->set('file_transliterate_uploads', update_variable_get('transliteration_file_uploads', TRUE));
- $config->set('file_transliterate_uploads_display_name', update_variable_get('transliteration_file_uploads_display_name', FALSE));
-
-
- update_variable_del('transliteration_file_lowercase');
- update_variable_del('transliteration_file_uploads');
- update_variable_del('transliteration_file_uploads_display_name');
-
-
- module_load_include('inc', 'system', 'system.admin');
- }
- $config->save();
-
- return t('Transliteration has been merged into core. <a href="@transliteration-url">Fix existing file names</a>.', array('@transliteration-url' => url('admin/config/media/file-system/transliteration')));
- }
-
- * Provide a default value for maintenance_page_maximum_age.
- */
- function system_update_1047() {
- config_set('system.core', 'maintenance_page_maximum_age', 10);
- }
-
- * Set background fetch defaults.
- */
- function system_update_1048() {
- config('system.core')
- ->set('page_cache_background_fetch', 1)
- ->set('page_cache_keep_stale_age', 172800)
- ->save();
- }
-
- * Bartik theme settings update: Indicate whether legacy colors should be used.
- */
- function system_update_1049() {
-
- $default_theme = config_get('system.core', 'theme_default');
- if ($default_theme == 'bartik') {
-
- if (config_get('bartik.settings', 'color') === NULL) {
-
- config_set('bartik.settings', 'color_legacy', TRUE);
- }
- config_set('bartik.settings', 'main_menu_tabs', 'rounded-tabs');
- }
- }
-
- * Fix legacy color setting in Bartik.
- */
- function system_update_1050() {
- $config = config('bartik.settings');
- if ($config->get('legacy')) {
- $config->set('color_legacy', TRUE);
- $config->clear('legacy');
- $config->save();
- }
- }
-
- * Notify administrators if a non-core version of Redirect module is present.
- */
- function system_update_1051() {
- $path = backdrop_get_path('module', 'redirect');
- if ($path && strpos($path, 'core/modules/redirect') === FALSE) {
- backdrop_set_message(t('Backdrop core now provides a bundled Redirect module. A different copy of Redirect module has been located at %path. Remove this module from your installation to use the new Redirect module. For more information see the <a href="https://docs.backdropcms.org/node/43994" target="_blank">Redirect change notice</a>.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
- }
- }
-
- * Disable project browser if it previously existed on the site.
- */
- function system_update_1052() {
-
-
- if (module_exists('project_browser')) {
- $path = backdrop_get_path('module', 'project_browser');
- backdrop_set_message(t('Backdrop core now provides project browsing functions in core. A copy of Project Browser module has been located at %path. The module has been disabled, you can remove it safely from your installation.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
-
-
- db_query("DELETE FROM {system} WHERE name = 'project_browser' AND type = 'module'");
-
-
- config('project_browser.settings')->delete();
- }
- }
-
- * Remove unnecessary items from the "main-menu" menu.
- */
- function system_update_1053() {
- db_query("DELETE FROM {menu_links} WHERE link_path LIKE '%/\%%' AND module = 'system' AND menu_name = 'main-menu'");
- db_query("DELETE FROM {menu_links} WHERE link_path LIKE 'search/%' AND module = 'system' AND menu_name = 'main-menu'");
-
-
- $add_redirect_path = config_get('system.core', 'site_404');
- if (empty($path)) {
- $add_redirect_path = 'system/404';
- }
- $add_redirect_path .= '/add-redirect';
- db_query("UPDATE {menu_links} SET menu_name = 'internal' WHERE link_path = :redirect_path AND menu_name = 'main-menu'", array(':redirect_path' => $add_redirect_path));
-
- state_set('menu_rebuild_needed', TRUE);
- }
-
- * Changes the key in layout config files from 'layout' to 'layout_template'.
- */
- function system_update_1054() {
- $layouts = config_get_names_with_prefix('layout.layout.');
- foreach ($layouts as $layout_name) {
- $config = config($layout_name);
- $configs = $config->get();
- if (isset($configs['layout'])) {
- $configs['layout_template'] = $configs['layout'];
- unset($configs['layout']);
- }
- $config->setData($configs);
- $config->save();
- }
- }
-
- * Create the new layout settings configuration file.
- */
- function system_update_1055() {
- $config = config('layout.settings');
- if ($config->isNew()) {
-
- $bootstrap = array('boxton', 'geary', 'harris', 'moscone', 'moscone_flipped', 'rolph', 'simmons', 'sutro', 'taylor', 'taylor_flipped');
- $config->set('excluded_templates', $bootstrap);
- $config->save();
- }
- }
-
- * Move incorrectly stored "log_row_limit" setting.
- */
- function system_update_1056() {
-
- $config = config('system.core');
- if ($limit = $config->get('row_limit')) {
- $config->set('log_row_limit', $limit);
- $config->clear('row_limit');
- $config->save();
- }
- }
-
- * Add default for watchdog_enabled_severity_levels.
- */
- function system_update_1057() {
- $config = config('system.core');
-
- $config->set('watchdog_enabled_severity_levels', array(
- WATCHDOG_EMERGENCY,
- WATCHDOG_ALERT,
- WATCHDOG_CRITICAL,
- WATCHDOG_ERROR,
- WATCHDOG_WARNING,
- WATCHDOG_NOTICE,
- WATCHDOG_INFO,
- ));
- $config->save();
- }
-
- * Clarify state "menu_expanded" as "menus_containing_expanded_items".
- */
- function system_update_1058() {
- state_set('menus_containing_expanded_items', state_get('menu_expanded'));
- state_del('menu_expanded');
- }
-
- * Set home page menu to render as a drop-down menu.
- */
- function system_update_1059() {
- $config = config('layout.layout.home');
-
- if (!$config->isNew()) {
- $content = $config->get('content');
- foreach ($content as $uuid => $block_info) {
-
- if ($block_info['plugin'] == 'system:main-menu' && empty($block_info['data']['settings']['block_settings']['style'])) {
- $content[$uuid]['data']['settings']['block_settings']['style'] = 'dropdown';
- $content[$uuid]['data']['settings']['block_settings']['level'] = 1;
- $content[$uuid]['data']['settings']['block_settings']['depth'] = 0;
- }
- }
- $config->set('content', $content);
- $config->save();
- }
- }
-
- * Remove the homepage breadcrumb block.
- */
- function system_update_1060() {
- $config = config('layout.layout.home');
-
- if (!$config->isNew()) {
- $positions = $config->get('positions');
- $content = $config->get('content');
- foreach ($content as $uuid => $block_config) {
-
- if ($block_config['plugin'] === 'system:breadcrumb') {
- if (in_array($uuid, $positions['top'])) {
- unset($content[$uuid]);
- $positions['top'] = array_diff($positions['top'], array($uuid));
- $config->set('positions', $positions);
- $config->set('content', $content);
- $config->save();
- }
- break;
- }
- }
- }
- }
-
- * Update contrib entity display mode module to core version.
- */
- function system_update_1061() {
- $old_config = config('entity_view_mode.settings');
- $new_config = config('entity.view_modes');
-
-
- if (!$old_config->isNew()) {
- $old_data = $old_config->get('entity_view_modes');
- }
-
- else {
- $old_data = update_variable_get('entity_view_modes');
- }
-
- $new_data = array();
- if ($old_data) {
- foreach ($old_data as $entity_type => $old_view_modes) {
- foreach ($old_view_modes as $view_mode_name => $view_mode) {
-
- if (isset($view_mode['custom settings'])) {
- unset($view_mode['custom settings']);
- }
- $new_data[$entity_type][$view_mode_name] = $view_mode;
- }
- }
- }
-
-
- if ($new_data && !$new_config->get('view_modes')) {
- $new_config->set('view_modes', $new_data);
- $new_config->save();
-
-
- $old_config->delete();
- update_variable_del('entity_view_modes');
- }
-
-
-
- db_query("DELETE FROM {system} WHERE name = 'entity_view_mode' AND type = 'module'");
- }
-
- * Remove configuration settings that were never used.
- */
- function system_update_1062() {
- $config = config('system.date');
- $config->clear('user_timezone_configurable');
- $config->clear('user_timezone_default');
- $config->clear('user_timezone_warn');
- $config->save();
- }
-
- * Set a default value for the X-Frame-Options header. This will not allow the
- * site to be rendered in an iframe on another domain unless specified.
- */
- function system_update_1063() {
- $config = config('system.core');
- $config->set('x_frame_options', 'SAMEORIGIN');
- $config->save();
- }
-
- * Add langcode column to {menu_links} table.
- */
- function system_update_1064() {
- if (!db_field_exists('menu_links', 'langcode')) {
- $spec = array(
- 'description' => 'The language code for this menu link; if \'und\', the link will be shown in all languages.',
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- );
- db_add_field('menu_links', 'langcode', $spec);
- db_query("UPDATE {menu_links} SET langcode = 'und'");
- }
- }
-
- * Update the maintenance mode message field to use tokens.
- */
- function system_update_1065() {
- $config = config('system.core');
- $old_message = $config->get('maintenance_mode_message');
- $new_message = str_replace('@site', '[site:name]', $old_message);
- $config->set('maintenance_mode_message', $new_message);
- $config->save();
- }
-
- * Update the core profile locations.
- */
- function system_update_1066() {
- $profiles = array(
- 'standard',
- 'minimal',
- 'testing',
- );
- foreach ($profiles as $profile_name) {
- db_query("UPDATE {system} SET filename = :filename WHERE name = :name AND type = 'module'", array(
- ':filename' => 'core/profiles/' . $profile_name . '/' . $profile_name . '.profile',
- ':name' => $profile_name,
- ));
- }
- }
-
- * Add default value for form_cache_expiration.
- */
- function system_update_1067() {
- $config = config('system.core');
- $config->set('form_cache_expiration', 21600);
- $config->save();
- }
-
- * Add 'jquery-extend-3.4.0.js' to the 'jquery' library.
- */
- function system_update_1068() {
-
- }
-
- * Removes an unused state value.
- */
- function system_update_1069() {
- state_del('backdrop_utf8mb4_tables');
- }
-
- * Set file_temporary_path on existing sites, if not already set.
- */
- function system_update_1070() {
- $config = config('system.core');
- if ($config->get('file_temporary_path') == NULL) {
- $config->set('file_temporary_path', file_directory_temp());
- $config->save();
- }
- }
-
- * Grant the "administer flexible templates" permission to all user roles that
- * already have the "administer layouts" permission.
- *
- * This update hook would normally go into the layout.install file, but adding
- * update hooks to new modules that did not exist in D7 is problematic.
- * See: https://github.com/backdrop/backdrop-issues/issues/1759
- */
- function system_update_1071() {
- $roles = user_roles(FALSE, 'administer layouts');
- foreach ($roles as $role_name => $role) {
- user_role_grant_permissions($role_name, array('administer flexible templates'));
- }
- }
-
- * Add 'jquery-html-prefilter-3.5.0.js' to the 'jquery' library.
- */
- function system_update_1072() {
-
- }
-
- * Set config_sync_clear_staging on existing sites, if not already set.
- */
- function system_update_1073() {
- $config = config('system.core');
- if ($config->get('config_sync_clear_staging') == NULL) {
- $config->set('config_sync_clear_staging', 1);
- $config->save();
- }
- }
-
- * Make sure that all config translatables are set for system core.
- */
- function system_update_1074() {
- $config = config('system.core');
- $available = $config->get('_config_translatables');
- if ($available === NULL || count($available) < 4 ) {
-
- $system_translatables = array(
- 'anonymous',
- 'site_name',
- 'site_slogan',
- 'maintenance_mode_message',
- );
- if (is_array($available)) {
-
- $system_translatables = array_merge($available, $system_translatables);
- $system_translatables = array_values(array_unique($system_translatables));
- }
- $config->set('_config_translatables', $system_translatables);
- $config->save();
- }
- }
-
- * Set a default value for the "Permissions-Policy: interest-cohort" header.
- *
- * This will make it so that the Google Federated Learning of Cohorts (FLoC)
- * feature that gathers user data without cookies is blocked by default, unless
- * overridden in settings.php.
- *
- * For more information, see the change record at:
- * https://docs.backdropcms.org/change-records/header-added-by-default-to-disable-floc
- */
- function system_update_1075() {
- $config = config('system.core');
- $config->set('block_interest_cohort', update_variable_get('block_interest_cohort', 1));
- $config->save();
-
- update_variable_del('block_interest_cohort');
- }
-
- * Add default values for dismissible message settings.
- */
- function system_update_1076() {
- $config = config('system.core');
- $config->set('messages_dismissible', 1);
- $config->save();
- }
-
- * Explicitly set the admin theme to an actual theme, instead of the special
- * 'Default theme' option.
- */
- function system_update_1077() {
- $config = config('system.core');
- $admin_theme = $config->get('admin_theme');
- $default_theme = $config->get('theme_default');
-
-
-
- if ($admin_theme == '0' || $admin_theme == '') {
-
-
- $config->set('admin_theme', $default_theme);
- $config->save();
- }
- }
-
- * Re-arrange flexible layout configuration so we can save region classes.
- */
- function system_update_1078() {
- $flexible_layouts = config_get_names_with_prefix('layout.flexible.');
- foreach ($flexible_layouts as $layout_name) {
- $config = config($layout_name);
- $rows = $config->get('rows');
- foreach ($rows as $row_key => $row) {
- foreach ($row['region_names'] as $region_key => $region_name) {
- $number = str_replace('region_name_', '', $region_key);
- $config->set('rows.' . $row_key . '.region_names.region_' . $number . '.label', $region_name);
- $config->set('rows.' . $row_key . '.region_names.region_' . $number . '.name', backdrop_html_class($region_name));
- $config->clear('rows.' . $row_key . '.region_names.' . $region_key);
- }
- }
- $config->save();
- }
- }
-
- * Clear the cache to reset allowlist settings.
- */
- function system_update_1079() {
- backdrop_flush_all_caches();
- }
-
- * Set homepage to 'user' if blank to match previous behavior.
- */
- function system_update_1080() {
- $config = config('system.core');
- $site_frontpage = $config->get('site_frontpage');
- if (empty($site_frontpage)) {
- $config->set('site_frontpage', 'user');
- }
- }
-
- * Enable Admin Menu's Page Links component.
- */
- function system_update_1081() {
- $config = config('admin_bar.settings');
- $components = $config->get('components');
- $components[] = 'admin_bar.page';
- $config->set('components', array_unique($components));
- $config->save();
- }
-
- * Previous check for Entity Reference module.
- */
- function system_update_1082() {
-
- }
-
- * Set the default value for "file_additional_public_schemes" setting.
- */
- function system_update_1083() {
- $config = config('system.core');
- if ($config->get('file_additional_public_schemes') == NULL) {
- $config->set('file_additional_public_schemes', array());
- $config->save();
- }
- }
-
- * Notify if a non-core version of Entity Reference module is present.
- */
- function system_update_1084() {
- $path = backdrop_get_path('module', 'entityreference');
- if ($path && strpos($path, 'core/modules/entityreference') === FALSE) {
- backdrop_set_message(t('Backdrop core provides a bundled @name module. A different copy of @name module is at %path. Remove this module from your installation to use the core @name module. For more information see the <a href="!url" target="_blank">@name change notice</a>.', array(
- '@name' => t('Entity Reference'),
- '%path' => $path,
- '!url' => 'https://docs.backdropcms.org/node/47321',
- )), 'warning');
- }
- }
-
- * Remove superfluous test files if they are present.
- */
- function system_update_1085() {
-
-
- $base = BACKDROP_ROOT . '/core/modules/system/tests/';
- $filenames = array(
- $base . 'cron_queue_test.module',
- $base . 'system_cron_test.module',
- );
- foreach ($filenames as $filename) {
- if (file_exists($filename)) {
- if (!unlink($filename)) {
- backdrop_set_message(t('Unable to remove file %filename, which is no longer used in its current location. Please remove it from the file system.', array('filename' => $filename)), 'warning');
- }
- }
- }
- }
-
- * Preserve 4-byte UTF-8 database update value if set.
- */
- function system_update_1086() {
- $connection = Database::getConnection();
- $utf8mb4_active = $connection->utf8mb4IsActive();
- $utf8mb4_supported = $connection->utf8mb4IsSupported();
-
-
- $d7_utf8mb4_run = update_variable_get('drupal_all_databases_are_utf8mb4', FALSE);
- $utf8mb4_state = state_get('database_utf8mb4_active', FALSE);
- if ($utf8mb4_supported && $utf8mb4_active && $d7_utf8mb4_run && !$utf8mb4_state) {
- state_set('database_utf8mb4_active', TRUE);
- update_variable_del('drupal_all_databases_are_utf8mb4');
- }
- }
-
- * Set the message length for the database log.
- */
- function system_update_1087() {
- if (config_get('system.core', 'log_max_length') === NULL) {
- config_set('system.core', 'log_max_length', 56);
- }
- }
-
- * Set the file schemes whose paths should not be normalized.
- */
- function system_update_1088() {
- if (config_get('system.core', 'file_not_normalized_schemes') === NULL) {
- config_set('system.core', 'file_not_normalized_schemes', array());
- }
- }
-
- * Enable Admin Bar's Language Switcher component if this is a multilingual
- * site.
- */
- function system_update_1089() {
- if (!(module_exists('locale') && language_multilingual())) {
- return;
- }
- $config = config('admin_bar.settings');
- $components = $config->get('components');
- $components[] = 'admin_bar.locale';
- $config->set('components', array_unique($components));
- $config->save();
- }
-
- * Set a default value for the new user_editor_role setting on existing sites.
- */
- function system_update_1090() {
- $config = config('system.core');
- if ($config->get('user_editor_role') === NULL) {
- $config->set('user_editor_role', '');
- $config->save();
- }
- }
-
- * Set jQuery to the backwards-compatible, legacy version for existing sites.
- */
- function system_update_1091() {
- if (config_get('system.core', 'jquery_version') === NULL) {
- config_set('system.core', 'jquery_version', 'legacy');
- }
- }
-
- * Removes the block_interest_cohort configuration added by
- * system_update_1075().
- *
- * see https://github.com/backdrop/backdrop-issues/issues/6199
- *
- * For more information, see the change record at:
- * https://docs.backdropcms.org/change-records/header-added-by-default-to-disable-floc
- */
- function system_update_1092() {
- config_clear('system.core', 'block_interest_cohort');
- }
-
- * Set defaults for date_views if not already set.
- */
- function system_update_1093() {
-
-
-
- $config = config('date_views.settings');
- if (!$config->isNew()) {
- return;
- }
- $config->set('date_views_month_format_with_year', 'F Y');
- $config->set('date_views_month_format_without_year', 'F');
- $config->set('date_views_day_format_with_year', 'l, F j, Y');
- $config->set('date_views_day_format_without_year', 'l, F j');
- $config->set('date_views_week_format_with_year', 'F j, Y');
- $config->set('date_views_week_format_without_year', 'F j');
- $config->save();
- }
-
- * Enable static caching of the "system.date" configuration file.
- */
- function system_update_1094() {
- $config = config('system.date');
- $data = $config->get();
-
- unset($data['_config_name']);
- $data = array_merge(array(
- '_config_name' => 'system.date',
- '_config_static' => TRUE,
- ), $data);
- $config->setData($data);
- $config->save();
- }
-
- * Set default values for flags for stripping sensitive headers on HTTP
- * downgrade or host change.
- */
- function system_update_1095() {
- $config = config('system.core');
- $save = FALSE;
- if ($config->get('backdrop_http_request.strip_sensitive_headers_on_host_change') === NULL) {
- $config->set('backdrop_http_request.strip_sensitive_headers_on_host_change', TRUE);
- $save = TRUE;
- }
- if ($config->get('backdrop_http_request.strip_sensitive_headers_on_https_downgrade') === NULL) {
- $config->set('backdrop_http_request.strip_sensitive_headers_on_https_downgrade', TRUE);
- $save = TRUE;
- }
- if ($save) {
- $config->save();
- }
- }
-
- * Fix icon display for customized system menu items.
- */
- function system_update_1096() {
- $icon_mapping = array(
- 'admin/dashboard' => 'speedometer-fill',
- 'admin/content' => 'pencil-fill',
- 'admin/people' => 'users-fill',
- 'admin/appearance' => 'palette-fill',
- 'admin/modules' => 'puzzle-piece-fill',
- 'admin/structure' => 'stack-fill',
- 'admin/config' => 'gear-fill',
- 'admin/reports' => 'info-fill',
- );
-
- $items = db_select('menu_links')
- ->fields('menu_links')
- ->condition('menu_name', 'management')
- ->condition('module', 'system')
- ->condition('depth', 2)
- ->condition('customized', 1)
- ->execute()->fetchAllAssoc('router_path');
-
- foreach ($items as $router_path => $item) {
- if (!array_key_exists($router_path, $icon_mapping)) {
- continue;
- }
- $existing_item = (array) $item;
- $options = unserialize($existing_item['options']);
- if (isset($options['icon'])) {
- continue;
- }
- $updated_item = $existing_item;
- $options['icon'] = $icon_mapping[$router_path];
- $updated_item['options'] = $options;
- menu_link_save($updated_item, $existing_item);
- }
- }
-
- * Set local_action_position in Admin Bar.
- */
- function system_update_1097() {
- $config = config('admin_bar.settings');
- if ($config->get('local_action_position') === NULL) {
- $config->set('local_action_position', 'top');
- $config->save();
- }
- }
-
- * @} End of "defgroup updates-7.x-to-1.x"
- * The next series of updates should start at 2000.
- */