diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 8817356..a8fe23e 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -516,7 +516,7 @@ function ajax_prepare_response($page_callback_result) { case MENU_SITE_OFFLINE: $commands[] = ajax_command_alert(filter_xss_admin(variable_get('maintenance_mode_message', - t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))); + t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => config('system.site')->get('site_name')))))); break; } } diff --git a/core/includes/common.inc b/core/includes/common.inc index 673ac9c..48c12ef 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2599,7 +2599,7 @@ function drupal_deliver_html_page($page_callback_result) { drupal_add_http_header('Status', '503 Service unavailable'); drupal_set_title(t('Site under maintenance')); print theme('maintenance_page', array('content' => filter_xss_admin(variable_get('maintenance_mode_message', - t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))))))); + t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => config('system.site')->get('site_name'))))))); break; } } diff --git a/core/includes/gettext.inc b/core/includes/gettext.inc index a8498dc..a29bd13 100644 --- a/core/includes/gettext.inc +++ b/core/includes/gettext.inc @@ -955,7 +955,7 @@ function _locale_export_po_generate($language = NULL, $strings = array(), $heade if (!isset($header)) { if (isset($language)) { - $header = '# ' . $language->name . ' translation of ' . variable_get('site_name', 'Drupal') . "\n"; + $header = '# ' . $language->name . ' translation of ' . config('system.site')->get('site_name') . "\n"; $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; $header .= "#\n"; $header .= "msgid \"\"\n"; diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 5cb3399..063783c 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1807,7 +1807,7 @@ function _install_configure_form($form, &$form_state, &$install_state) { '#type' => 'select', '#title' => st('Default country'), '#empty_value' => '', - '#default_value' => variable_get('site_default_country', NULL), + '#default_value' => config('system.site')->get('site_default_country'), '#options' => $countries, '#description' => st('Select the default country for the site.'), '#weight' => 0, @@ -1864,10 +1864,12 @@ function install_configure_form_validate($form, &$form_state) { function install_configure_form_submit($form, &$form_state) { global $user; - variable_set('site_name', $form_state['values']['site_name']); - variable_set('site_mail', $form_state['values']['site_mail']); - variable_set('date_default_timezone', $form_state['values']['date_default_timezone']); - variable_set('site_default_country', $form_state['values']['site_default_country']); + config('system.site') + ->set('site_name', $form_state['values']['site_name']) + ->set('site_mail', $form_state['values']['site_mail']) + ->set('date_default_timezone', $form_state['values']['date_default_timezone']) + ->set('site_default_country', $form_state['values']['site_default_country']) + ->save(); // Enable update.module if this option was selected. if ($form_state['values']['update_status_module'][1]) { @@ -1880,7 +1882,7 @@ function install_configure_form_submit($form, &$form_state) { } } - // We precreated user 1 with placeholder values. Let's save the real values. + // We pre-created user 1 with placeholder values. Let's save the real values. $account = user_load(1); $account->init = $account->mail = $form_state['values']['account']['mail']; $account->roles = !empty($account->roles) ? $account->roles : array(); diff --git a/core/includes/mail.inc b/core/includes/mail.inc index f58a76e..6fe04a0 100644 --- a/core/includes/mail.inc +++ b/core/includes/mail.inc @@ -118,7 +118,7 @@ define('MAIL_LINE_ENDINGS', isset($_SERVER['WINDIR']) || strpos($_SERVER['SERVER * accepted at php-level, which still doesn't guarantee it to be delivered.) */ function drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) { - $default_from = variable_get('site_mail', ini_get('sendmail_from')); + $default_from = config('system.site')->get('site_mail'); // Bundle up the variables into a structured array for altering. $message = array( diff --git a/core/includes/path.inc b/core/includes/path.inc index 0c7e4d4..0635f80 100644 --- a/core/includes/path.inc +++ b/core/includes/path.inc @@ -22,7 +22,7 @@ function drupal_path_initialize() { // If on the front page, resolve to the front page path, including for calls // to current_path() while drupal_get_normal_path() is in progress. if (empty($path)) { - $path = variable_get('site_frontpage', 'user'); + $path = config('system.site')->get('site_frontpage'); _current_path($path); } @@ -298,7 +298,7 @@ function drupal_is_front_page() { $is_front_page = &$drupal_static_fast['is_front_page']; if (!isset($is_front_page)) { - $is_front_page = (current_path() == variable_get('site_frontpage', 'user')); + $is_front_page = (current_path() == config('system.site')->get('site_frontpage')); } return $is_front_page; @@ -329,7 +329,7 @@ function drupal_match_path($path, $patterns) { $replacements = array( '|', '.*', - '\1' . preg_quote(variable_get('site_frontpage', 'user'), '/') . '\2' + '\1' . preg_quote(config('system.site')->get('site_frontpage'), '/') . '\2' ); $patterns_quoted = preg_quote($patterns, '/'); $regexps[$patterns] = '/^(' . preg_replace($to_replace, $replacements, $patterns_quoted) . ')$/'; diff --git a/core/includes/theme.inc b/core/includes/theme.inc index b145979..21452ce 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2529,18 +2529,18 @@ function template_preprocess_html(&$variables) { $type = theme_get_setting('favicon_mimetype'); drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); } - + $config = config('system.site'); // Construct page title. if (drupal_get_title()) { $head_title = array( 'title' => strip_tags(drupal_get_title()), - 'name' => check_plain(variable_get('site_name', 'Drupal')), + 'name' => check_plain($config->get('site_name')), ); } else { - $head_title = array('name' => check_plain(variable_get('site_name', 'Drupal'))); - if (variable_get('site_slogan', '')) { - $head_title['slogan'] = filter_xss_admin(variable_get('site_slogan', '')); + $head_title = array('name' => check_plain($config->get('site_name'))); + if ($config->get('site_slogan')) { + $head_title['slogan'] = filter_xss_admin($config->get('site_slogan')); } } $variables['head_title_array'] = $head_title; @@ -2574,6 +2574,7 @@ function template_preprocess_html(&$variables) { */ function template_preprocess_page(&$variables) { $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE); + $config = config('system.site'); // Move some variables to the top level for themer convenience and template cleanliness. $variables['show_messages'] = $variables['page']['#show_messages']; @@ -2602,8 +2603,8 @@ function template_preprocess_page(&$variables) { $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array(); $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array(); $variables['action_links'] = menu_local_actions(); - $variables['site_name'] = (theme_get_setting('toggle_name') ? filter_xss_admin(variable_get('site_name', 'Drupal')) : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin(variable_get('site_slogan', '')) : ''); + $variables['site_name'] = (theme_get_setting('toggle_name') ? filter_xss_admin($config->get('site_name')) : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? filter_xss_admin($config->get('site_slogan')) : ''); $variables['tabs'] = menu_local_tabs(); if ($node = menu_get_object()) { @@ -2784,17 +2785,18 @@ function template_preprocess_maintenance_page(&$variables) { $variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second'; } + $config = config('system.site'); // Construct page title if (drupal_get_title()) { $head_title = array( 'title' => strip_tags(drupal_get_title()), - 'name' => variable_get('site_name', 'Drupal'), + 'name' => $config->get('site_name'), ); } else { - $head_title = array('name' => variable_get('site_name', 'Drupal')); - if (variable_get('site_slogan', '')) { - $head_title['slogan'] = variable_get('site_slogan', ''); + $head_title = array('name' => $config->get('site_name')); + if ($config->get('site_slogan')) { + $head_title['slogan'] = $config->get('site_slogan'); } } @@ -2813,8 +2815,8 @@ function template_preprocess_maintenance_page(&$variables) { $variables['messages'] = $variables['show_messages'] ? theme('status_messages') : ''; $variables['main_menu'] = array(); $variables['secondary_menu'] = array(); - $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''); + $variables['site_name'] = (theme_get_setting('toggle_name') ? $config->get('site_name') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? $config->get('site_slogan') : ''); $variables['tabs'] = ''; $variables['title'] = drupal_get_title(); diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc index ebb561b..9ce56de 100644 --- a/core/modules/aggregator/aggregator.pages.inc +++ b/core/modules/aggregator/aggregator.pages.inc @@ -11,7 +11,7 @@ * @see aggregator_menu() */ function aggregator_page_last() { - drupal_add_feed('aggregator/rss', variable_get('site_name', 'Drupal') . ' ' . t('aggregator')); + drupal_add_feed('aggregator/rss', config('system.site')->get('site_name') . ' ' . t('aggregator')); $items = aggregator_load_feed_items('sum'); @@ -61,7 +61,7 @@ function aggregator_page_source_form($form, $form_state, $feed) { * @ingroup forms */ function aggregator_page_category($category) { - drupal_add_feed('aggregator/rss/' . $category['cid'], variable_get('site_name', 'Drupal') . ' ' . t('aggregator - @title', array('@title' => $category['title']))); + drupal_add_feed('aggregator/rss/' . $category['cid'], config('system.site')->get('site_name') . ' ' . t('aggregator - @title', array('@title' => $category['title']))); // It is safe to include the cid in the query because it's loaded from the // database by aggregator_category_load(). @@ -452,7 +452,7 @@ function theme_aggregator_page_rss($variables) { $items .= format_rss_item($feed->ftitle . ': ' . $feed->title, $feed->link, $feed->description, array('pubDate' => date('r', $feed->timestamp))); } - $site_name = variable_get('site_name', 'Drupal'); + $site_name = config('system.site')->get('site_name'); $url = url((isset($category) ? 'aggregator/categories/' . $category->cid : 'aggregator'), array('absolute' => TRUE)); $description = isset($category) ? t('@site_name - aggregated feeds in category @title', array('@site_name' => $site_name, '@title' => $category->title)) : t('@site_name - aggregated feeds', array('@site_name' => $site_name)); @@ -504,7 +504,7 @@ function theme_aggregator_page_opml($variables) { $output = "\n"; $output .= "\n"; $output .= "\n"; - $output .= '' . check_plain(variable_get('site_name', 'Drupal')) . "\n"; + $output .= '' . check_plain(config('system.site')->get('site_name')) . "\n"; $output .= '' . gmdate(DATE_RFC2822, REQUEST_TIME) . "\n"; $output .= "\n"; $output .= "\n"; diff --git a/core/modules/block/block.test b/core/modules/block/block.test index a5bde42..a1aab97 100644 --- a/core/modules/block/block.test +++ b/core/modules/block/block.test @@ -163,7 +163,7 @@ class BlockTestCase extends DrupalWebTestCase { function testBlockVisibility() { // Enable Node module and change the front page path to 'node'. module_enable(array('node')); - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); $block = array(); diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index c43e725..019bf2a 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1748,7 +1748,7 @@ function comment_form($form, &$form_state, Comment $comment) { '#default_value' => $author, '#maxlength' => 60, '#size' => 30, - '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))), + '#description' => t('Leave blank for %anonymous.', array('%anonymous' => config('user.account_settings')->get('anonymous'))), '#autocomplete_path' => 'user/autocomplete', ); } @@ -1908,7 +1908,7 @@ function comment_preview(Comment $comment) { $comment->picture = $account->picture; } elseif (empty($comment->name)) { - $comment->name = variable_get('anonymous', t('Anonymous')); + $comment->name = config('user.account_settings')->get('anonymous'); } $comment->created = !empty($comment->created) ? $comment->created : REQUEST_TIME; @@ -1999,7 +1999,7 @@ function comment_submit(Comment $comment) { // If the comment was posted by an anonymous user and no author name was // required, use "Anonymous" by default. if ($comment->is_anonymous && (!isset($comment->name) || $comment->name === '')) { - $comment->name = variable_get('anonymous', t('Anonymous')); + $comment->name = config('user.account_settings')->get('anonymous'); } // Validate the comment's subject. If not specified, extract from comment body. diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc index 1c6a7ee..eeaf5e7 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -131,7 +131,8 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = break; case 'name': - $name = ($comment->uid == 0) ? variable_get('anonymous', t('Anonymous')) : $comment->name; + $anonymous_name = config('user.account_settings')->get('anonymous'); + $name = ($comment->uid == 0) ? $anonymous_name : $comment->name; $replacements[$original] = $sanitize ? filter_xss($name) : $name; break; diff --git a/core/modules/contact/contact.install b/core/modules/contact/contact.install index 7ddea45..1990fb3 100644 --- a/core/modules/contact/contact.install +++ b/core/modules/contact/contact.install @@ -72,7 +72,7 @@ function contact_install() { db_insert('contact') ->fields(array( 'category' => 'Website feedback', - 'recipients' => variable_get('site_mail', ini_get('sendmail_from')), + 'recipients' => config('system.site')->get('site_mail'), 'selected' => 1, 'reply' => '', )) diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 48c12d9..4840e10c 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -170,7 +170,7 @@ function contact_load($cid) { function contact_mail($key, &$message, $params) { $language = $message['language']; $variables = array( - '!site-name' => variable_get('site_name', 'Drupal'), + '!site-name' => config('system.site')->get('site_name'), '!subject' => $params['subject'], '!category' => isset($params['category']['category']) ? $params['category']['category'] : '', '!form-url' => url(current_path(), array('absolute' => TRUE, 'language' => $language)), diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 45f5170..fdb3078 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -1270,7 +1270,7 @@ function _filter_html_tips($filter, $format, $long = FALSE) { $output .= '

' . t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') . '

'; $output .= '

' . t('For more information see W3C\'s HTML Specifications or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '

'; $tips = array( - 'a' => array(t('Anchors are used to make links to other pages.'), '' . check_plain(variable_get('site_name', 'Drupal')) . ''), + 'a' => array(t('Anchors are used to make links to other pages.'), '' . check_plain(config('system.site')->get('site_name')) . ''), 'br' => array(t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with
line break')), 'p' => array(t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '

' . t('Paragraph one.') . '

' . t('Paragraph two.') . '

'), 'strong' => array(t('Strong', array(), array('context' => 'Font weight')), '' . t('Strong', array(), array('context' => 'Font weight')) . ''), diff --git a/core/modules/locale/locale.test b/core/modules/locale/locale.test index ded11ef..8e65765 100644 --- a/core/modules/locale/locale.test +++ b/core/modules/locale/locale.test @@ -2075,7 +2075,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase { parent::setUp(array('node', 'locale', 'path')); $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page')); - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); } /** diff --git a/core/modules/node/node.install b/core/modules/node/node.install index b2616ab..141181b 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -521,9 +521,9 @@ function _update_7000_node_get_types() { * @see http://drupal.org/node/375397 */ function node_update_8000() { - $front_page = variable_get('site_frontpage'); + $front_page = config('system.site')->get('site_frontpage'); if (!isset($front_page)) { - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); } } diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 5e1c3b3..6c3404a 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2445,7 +2445,7 @@ function node_feed($nids = FALSE, $channel = array()) { $channel_defaults = array( 'version' => '2.0', - 'title' => variable_get('site_name', 'Drupal'), + 'title' => config('system.site')->get('site_name'), 'link' => $base_url, 'description' => variable_get('feed_description', ''), 'language' => $language_content->langcode @@ -2514,7 +2514,7 @@ function node_page_default() { $build = node_view_multiple($nodes); // 'rss.xml' is a path, not a file, registered in node_menu(). - drupal_add_feed('rss.xml', variable_get('site_name', 'Drupal') . ' ' . t('RSS')); + drupal_add_feed('rss.xml', config('system.site')->get('site_name') . ' ' . t('RSS')); $build['pager'] = array( '#theme' => 'pager', '#weight' => 5, @@ -2522,7 +2522,7 @@ function node_page_default() { drupal_set_title(''); } else { - drupal_set_title(t('Welcome to @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), PASS_THROUGH); + drupal_set_title(t('Welcome to @site-name', array('@site-name' => config('system.site')->get('site_name'))), PASS_THROUGH); $default_message = '

' . t('No front page content has been created yet.') . '

'; diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index 868acbd..a8db9e3 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -252,6 +252,7 @@ function node_form($form, &$form_state, Node $node) { ); // Node author information for administrators + $anonymous_name = config('user.account_settings')->get('anonymous'); $form['author'] = array( '#type' => 'fieldset', '#access' => user_access('administer nodes'), @@ -267,7 +268,7 @@ function node_form($form, &$form_state, Node $node) { drupal_get_path('module', 'node') . '/node.js', array( 'type' => 'setting', - 'data' => array('anonymous' => variable_get('anonymous', t('Anonymous'))), + 'data' => array('anonymous' => $anonymous_name), ), ), ), @@ -280,7 +281,7 @@ function node_form($form, &$form_state, Node $node) { '#autocomplete_path' => 'user/autocomplete', '#default_value' => !empty($node->name) ? $node->name : '', '#weight' => -1, - '#description' => t('Leave blank for %anonymous.', array('%anonymous' => variable_get('anonymous', t('Anonymous')))), + '#description' => t('Leave blank for %anonymous.', array('%anonymous' => $anonymous_name)), ); $form['author']['date'] = array( '#type' => 'textfield', diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module index 271f15d..49d6d81 100644 --- a/core/modules/overlay/overlay.module +++ b/core/modules/overlay/overlay.module @@ -637,7 +637,7 @@ function overlay_overlay_parent_initialize() { // Let the client side know which paths are administrative. $paths = path_get_admin_paths(); foreach ($paths as &$type) { - $type = str_replace('', variable_get('site_frontpage', 'user'), $type); + $type = str_replace('', config('system.site')->get('site_frontpage'), $type); } drupal_add_js(array('overlay' => array('paths' => $paths)), 'setting'); $path_prefixes = array(); diff --git a/core/modules/simpletest/drupal_web_test_case.php b/core/modules/simpletest/drupal_web_test_case.php index 15c1656..97ff4e9 100644 --- a/core/modules/simpletest/drupal_web_test_case.php +++ b/core/modules/simpletest/drupal_web_test_case.php @@ -1495,8 +1495,10 @@ class DrupalWebTestCase extends DrupalTestCase { // Restore necessary variables. variable_set('install_task', 'done'); - variable_set('site_mail', 'simpletest@example.com'); - variable_set('date_default_timezone', date_default_timezone_get()); + config('system.site') + ->set('site_mail', 'simpletest@example.com') + ->set('date_default_timezone', date_default_timezone_get()) + ->save(); // Set up English language. unset($conf['language_default']); diff --git a/core/modules/simpletest/simpletest.test b/core/modules/simpletest/simpletest.test index 185a71a..bacb20d 100644 --- a/core/modules/simpletest/simpletest.test +++ b/core/modules/simpletest/simpletest.test @@ -46,7 +46,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase { if (!$this->inCURL()) { $this->drupalGet('node'); $this->assertTrue($this->drupalGetHeader('Date'), t('An HTTP header was received.')); - $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.')); + $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => config('system.site')->get('site_name'))), t('Site title matches.')); $this->assertNoTitle('Foo', t('Site title does not match.')); // Make sure that we are locked out of the installer when prefixing // using the user-agent header. This is an important security check. diff --git a/core/modules/system/config/system.site.xml b/core/modules/system/config/system.site.xml new file mode 100644 index 0000000..c545a67 --- /dev/null +++ b/core/modules/system/config/system.site.xml @@ -0,0 +1,11 @@ + + + Drupal + + + + user + 10 + + + diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 9619461..0e0f5a2 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1461,6 +1461,7 @@ function system_ip_blocking_delete_submit($form, &$form_state) { * @see system_settings_form() */ function system_site_information_settings() { + $config = config('system.site'); $form['site_information'] = array( '#type' => 'fieldset', '#title' => t('Site details'), @@ -1468,19 +1469,19 @@ function system_site_information_settings() { $form['site_information']['site_name'] = array( '#type' => 'textfield', '#title' => t('Site name'), - '#default_value' => variable_get('site_name', 'Drupal'), + '#default_value' => $config->get('site_name'), '#required' => TRUE ); $form['site_information']['site_slogan'] = array( '#type' => 'textfield', '#title' => t('Slogan'), - '#default_value' => variable_get('site_slogan', ''), + '#default_value' => $config->get('site_slogan'), '#description' => t("How this is used depends on your site's theme."), ); $form['site_information']['site_mail'] = array( '#type' => 'email', '#title' => t('E-mail address'), - '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), + '#default_value' => $config->get('site_mail'), '#description' => t("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"), '#required' => TRUE, ); @@ -1491,7 +1492,7 @@ function system_site_information_settings() { $form['front_page']['site_frontpage'] = array( '#type' => 'textfield', '#title' => t('Default front page'), - '#default_value' => (variable_get('site_frontpage') != 'user' ? drupal_get_path_alias(variable_get('site_frontpage', 'user')) : ''), + '#default_value' => ($config->get('site_frontpage') != 'user' ? drupal_get_path_alias(config('system.site')->get('site_frontpage')) : ''), '#size' => 40, '#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default content feed.'), '#field_prefix' => url(NULL, array('absolute' => TRUE)), @@ -1501,7 +1502,7 @@ function system_site_information_settings() { '#default_value' => variable_get('default_nodes_main', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('The maximum number of posts displayed on overview pages such as the front page.'), - '#access' => (variable_get('site_frontpage') == 'node'), + '#access' => (config('system.site')->get('site_frontpage') == 'node'), ); $form['error_page'] = array( '#type' => 'fieldset', @@ -1913,7 +1914,7 @@ function system_regional_settings() { '#type' => 'select', '#title' => t('Default country'), '#empty_value' => '', - '#default_value' => variable_get('site_default_country', ''), + '#default_value' => config('system.site')->get('site_default_country', ''), '#options' => $countries, '#attributes' => array('class' => array('country-detect')), ); @@ -2199,7 +2200,7 @@ function system_site_maintenance_mode() { $form['maintenance_mode_message'] = array( '#type' => 'textarea', '#title' => t('Message to display when in maintenance mode'), - '#default_value' => variable_get('maintenance_mode_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))), + '#default_value' => variable_get('maintenance_mode_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => config('system.site')->get('site_name')))), ); return system_settings_form($form); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 15ffa21..a680431 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1522,7 +1522,7 @@ function hook_mail_alter(&$message) { $message['send'] = FALSE; return; } - $message['body'][] = "--\nMail sent out from " . variable_get('site_name', t('Drupal')); + $message['body'][] = "--\nMail sent out from " . config('system.site')->get('site_name'); } } @@ -1986,7 +1986,7 @@ function hook_watchdog(array $log_entry) { $to = 'someone@example.com'; $params = array(); $params['subject'] = t('[@site_name] @severity_desc: Alert from your web site', array( - '@site_name' => variable_get('site_name', 'Drupal'), + '@site_name' => config('system.site')->get('site_name'), '@severity_desc' => $severity_list[$log_entry['severity']], )); @@ -2052,7 +2052,7 @@ function hook_mail($key, &$message, $params) { $account = $params['account']; $context = $params['context']; $variables = array( - '%site_name' => variable_get('site_name', 'Drupal'), + '%site_name' => config('system.site')->get('site_name'), '%username' => user_format_name($account), ); if ($context['hook'] == 'taxonomy') { @@ -3862,7 +3862,7 @@ function hook_tokens($type, $tokens, array $data = array(), array $options = arr // Default values for the chained tokens handled below. case 'author': - $name = ($node->uid == 0) ? variable_get('anonymous', t('Anonymous')) : $node->name; + $name = ($node->uid == 0) ? config('user.account_settings')->get('anonymous') : $node->name; $replacements[$original] = $sanitize ? filter_xss($name) : $name; break; diff --git a/core/modules/system/system.install b/core/modules/system/system.install index f0e36cc..2ab97b3 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1855,6 +1855,11 @@ function system_update_8008() { variable_del('clean_url'); } +function system_update_8009() { + config_install_default_config('system'); + update_variables_to_config('system.site'); +} + /** * @} End of "defgroup updates-7.x-to-8.x" * The next series of updates should start at 9000. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 80a8403..c9b1cb2 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2802,6 +2802,7 @@ function system_settings_form_submit($form, &$form_state) { $value = array_keys(array_filter($value)); } variable_set($key, $value); + config('system.site')->set($key, $value)->save(); } drupal_set_message(t('The configuration options have been saved.')); diff --git a/core/modules/system/system.test b/core/modules/system/system.test index 4fdad71..25a063a 100644 --- a/core/modules/system/system.test +++ b/core/modules/system/system.test @@ -1122,7 +1122,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase { parent::setUp(array('node')); // Configure 'node' as front page. - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); // Create a user allowed to access site in maintenance mode. $this->user = $this->drupalCreateUser(array('access site in maintenance mode')); @@ -1143,7 +1143,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase { $admin_message = t('Operating in maintenance mode. Go online.', array('@url' => url('admin/config/development/maintenance'))); $user_message = t('Operating in maintenance mode.'); - $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))); + $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => config('system.site')->get('site_name'))); $this->drupalGet(''); $this->assertRaw($admin_message, t('Found the site maintenance mode message.')); @@ -1532,7 +1532,7 @@ class FrontPageTestCase extends DrupalWebTestCase { $this->node_path = "node/" . $this->drupalCreateNode(array('promote' => 1))->nid; // Configure 'node' as front page. - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); // Enable front page logging in system_test.module. variable_set('front_page_output', 1); } @@ -2034,13 +2034,15 @@ class TokenReplaceTestCase extends DrupalWebTestCase { ); // Set a few site variables. - variable_set('site_name', 'Drupal'); - variable_set('site_slogan', 'Slogan'); + config('system.site') + ->set('site_name', 'Drupal') + ->set('site_slogan', 'Slogan') + ->save(); // Generate and test sanitized tokens. $tests = array(); - $tests['[site:name]'] = check_plain(variable_get('site_name', 'Drupal')); - $tests['[site:slogan]'] = check_plain(variable_get('site_slogan', '')); + $tests['[site:name]'] = check_plain(config('system.site')->get('site_name')); + $tests['[site:slogan]'] = check_plain(config('system.site')->get('site_slogan')); $tests['[site:mail]'] = 'simpletest@example.com'; $tests['[site:url]'] = url('', $url_options); $tests['[site:url-brief]'] = preg_replace(array('!^https?://!', '!/$!'), '', url('', $url_options)); @@ -2055,8 +2057,8 @@ class TokenReplaceTestCase extends DrupalWebTestCase { } // Generate and test unsanitized tokens. - $tests['[site:name]'] = variable_get('site_name', 'Drupal'); - $tests['[site:slogan]'] = variable_get('site_slogan', ''); + $tests['[site:name]'] = config('system.site')->get('site_name'); + $tests['[site:slogan]'] = config('system.site')->get('site_slogan'); foreach ($tests as $input => $expected) { $output = token_replace($input, array(), array('language' => $language_interface, 'sanitize' => FALSE)); diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc index 2492890..d60ee1d 100644 --- a/core/modules/system/system.tokens.inc +++ b/core/modules/system/system.tokens.inc @@ -140,22 +140,22 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a $sanitize = !empty($options['sanitize']); $replacements = array(); - + $config = config('system.site'); if ($type == 'site') { foreach ($tokens as $name => $original) { switch ($name) { case 'name': - $site_name = variable_get('site_name', 'Drupal'); + $site_name = $config->get('site_name'); $replacements[$original] = $sanitize ? check_plain($site_name) : $site_name; break; case 'slogan': - $slogan = variable_get('site_slogan', ''); + $slogan = $config->get('site_slogan'); $replacements[$original] = $sanitize ? check_plain($slogan) : $slogan; break; case 'mail': - $replacements[$original] = variable_get('site_mail', ''); + $replacements[$original] = $config->get('site_mail'); break; case 'url': diff --git a/core/modules/system/tests/bootstrap.test b/core/modules/system/tests/bootstrap.test index 371031a..1546ae9 100644 --- a/core/modules/system/tests/bootstrap.test +++ b/core/modules/system/tests/bootstrap.test @@ -111,8 +111,10 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { function setUp() { parent::setUp(array('node', 'system_test')); - variable_set('site_name', 'Drupal'); - variable_set('site_frontpage', 'node'); + config('system.site') + ->set('site_name', 'Drupal') + ->set('site_frontpage', 'node') + ->save(); } /** @@ -120,8 +122,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { */ function testConditionalRequests() { $config = config('system.performance'); - $config->set('cache', 1); - $config->save(); + $config->set('cache', 1)->save(); // Fill the cache. $this->drupalGet(''); @@ -226,7 +227,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { $this->drupalGet(''); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.')); $this->assertFalse($this->drupalGetHeader('Content-Encoding'), t('A Content-Encoding header was not sent.')); - $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.')); + $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => config('system.site')->get('site_name'))), t('Site title matches.')); $this->assertRaw('', t('Page was not compressed.')); } } diff --git a/core/modules/system/tests/common.test b/core/modules/system/tests/common.test index 46b379e..b31fdb2 100644 --- a/core/modules/system/tests/common.test +++ b/core/modules/system/tests/common.test @@ -884,7 +884,7 @@ class CommonDrupalHTTPRequestTestCase extends DrupalWebTestCase { $result = drupal_http_request(url('node', array('absolute' => TRUE))); $this->assertEqual($result->code, 200, t('Fetched page successfully.')); $this->drupalSetContent($result->data); - $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.')); + $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => config('system.site')->get('site_name'))), t('Site title matches.')); // Test that code and status message is returned. $result = drupal_http_request(url('pagedoesnotexist', array('absolute' => TRUE))); diff --git a/core/modules/system/tests/menu.test b/core/modules/system/tests/menu.test index b38e9a1..463ab59 100644 --- a/core/modules/system/tests/menu.test +++ b/core/modules/system/tests/menu.test @@ -244,7 +244,7 @@ class MenuRouterTestCase extends DrupalWebTestCase { function testMaintenanceModeLoginPaths() { variable_set('maintenance_mode', TRUE); - $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))); + $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => config('system.site')->get('site_name'))); $this->drupalGet('node'); $this->assertText($offline_message); $this->drupalGet('menu_login_callback'); diff --git a/core/modules/system/tests/path.test b/core/modules/system/tests/path.test index f02a9b4..c7dbc2f 100644 --- a/core/modules/system/tests/path.test +++ b/core/modules/system/tests/path.test @@ -27,7 +27,7 @@ class DrupalMatchPathTestCase extends DrupalWebTestCase { // Set up a random site front page to test the '' placeholder. $this->front = $this->randomName(); - variable_set('site_frontpage', $this->front); + config('system.site')->set('site_frontpage', $this->front)->save(); // Refresh our static variables from the database. $this->refreshVariables(); } diff --git a/core/modules/system/tests/theme.test b/core/modules/system/tests/theme.test index 2a1959c..9e5d0bf 100644 --- a/core/modules/system/tests/theme.test +++ b/core/modules/system/tests/theme.test @@ -28,7 +28,7 @@ class ThemeUnitTest extends DrupalWebTestCase { function testThemeSuggestions() { // Set the front page as something random otherwise the CLI // test runner fails. - variable_set('site_frontpage', 'nobody-home'); + config('system.site')->set('site_frontpage', 'nobody-home')->save(); $args = array('node', '1', 'edit'); $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1', 'page__node__edit'), t('Found expected node edit page suggestions')); @@ -72,7 +72,7 @@ class ThemeUnitTest extends DrupalWebTestCase { $original_path = _current_path(); // Set the current path to node because theme_get_suggestions() will query // it to see if we are on the front page. - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'nobody-home')->save(); _current_path('node'); $suggestions = theme_get_suggestions(array('node'), 'page'); // Set it back to not annoy the batch runner. @@ -317,7 +317,7 @@ class ThemeFunctionsTestCase extends DrupalWebTestCase { // Required to verify the "active" class in expected links below, and // because the current path is different when running tests manually via // simpletest.module ('batch') and via the testing framework (''). - _current_path(variable_get('site_frontpage', 'user')); + _current_path(config('system.site')->get('site_frontpage')); // Verify that a list of links is properly rendered. $variables = array(); diff --git a/core/modules/system/tests/upgrade/upgrade.test b/core/modules/system/tests/upgrade/upgrade.test index 52d7800..e0e469b 100644 --- a/core/modules/system/tests/upgrade/upgrade.test +++ b/core/modules/system/tests/upgrade/upgrade.test @@ -137,7 +137,7 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase { drupal_save_session(FALSE); // Restore necessary variables. - $this->variable_set('site_mail', 'simpletest@example.com'); + config('system.site')->set('site_mail', 'simpletest@example.com')->save(); drupal_set_time_limit($this->timeLimit); $this->setup = TRUE; diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc index 7f4fa45..6c6a973 100644 --- a/core/modules/taxonomy/taxonomy.pages.inc +++ b/core/modules/taxonomy/taxonomy.pages.inc @@ -65,7 +65,7 @@ function taxonomy_term_page(TaxonomyTerm $term) { */ function taxonomy_term_feed(TaxonomyTerm $term) { $channel['link'] = url('taxonomy/term/' . $term->tid, array('absolute' => TRUE)); - $channel['title'] = variable_get('site_name', 'Drupal') . ' - ' . $term->name; + $channel['title'] = config('system.site')->get('site_name') . ' - ' . $term->name; // Only display the description if we have a single term, to avoid clutter and confusion. // HTML will be removed from feed description. $channel['description'] = check_markup($term->description, $term->format, '', TRUE); diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 44d86d6..6ef35ad 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -500,7 +500,7 @@ function _update_get_cached_available_releases() { function update_mail($key, &$message, $params) { $language = $message['language']; $langcode = $language->langcode; - $message['subject'] .= t('New release(s) available for !site_name', array('!site_name' => variable_get('site_name', 'Drupal')), array('langcode' => $langcode)); + $message['subject'] .= t('New release(s) available for !site_name', array('!site_name' => config('system.site')->get('site_name')), array('langcode' => $langcode)); foreach ($params as $msg_type => $msg_reason) { $message['body'][] = _update_message_text($msg_type, $msg_reason, FALSE, $language); } diff --git a/core/modules/user/config/user.account_settings.xml b/core/modules/user/config/user.account_settings.xml new file mode 100644 index 0000000..e7998e4 --- /dev/null +++ b/core/modules/user/config/user.account_settings.xml @@ -0,0 +1,4 @@ + + + Anonymous + diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index 8de4fb9..3a29771 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -266,7 +266,7 @@ function user_admin_settings() { $form['anonymous_settings']['anonymous'] = array( '#type' => 'textfield', '#title' => t('Name'), - '#default_value' => variable_get('anonymous', t('Anonymous')), + '#default_value' => config('user.account_settings')->get('anonymous'), '#description' => t('The name used to indicate anonymous users.'), '#required' => TRUE, ); @@ -643,6 +643,15 @@ function user_admin_settings() { } /** + * Save account settings settings. + */ +function user_admin_settings_submit($form, $form_state) { + $config = config('user.account_settings') + ->set('anonymous', $form_state['values']['anonymous']) + ->save(); +} + +/** * Menu callback: administer permissions. * * @ingroup forms diff --git a/core/modules/user/user.install b/core/modules/user/user.install index ce11aaf..a857c84 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -399,5 +399,15 @@ function user_update_8001() { } /** + * Converts account settings variables to configuration system + * + * @see http://drupal.org/node/1496534 + */ +function user_update_8002() { + config_install_default_config('user'); + update_variables_to_config('user.account_settings'); +} + +/** * @} End of "addtogroup updates-7.x-to-8.x" */ diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 4219728..f25469d 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -568,7 +568,7 @@ function user_permission() { ), 'cancel account' => array( 'title' => t('Cancel own user account'), - 'description' => t('Note: content may be kept, unpublished, deleted or transferred to the %anonymous-name user depending on the configured user settings.', array('%anonymous-name' => variable_get('anonymous', t('Anonymous')), '@user-settings-url' => url('admin/config/people/accounts'))), + 'description' => t('Note: content may be kept, unpublished, deleted or transferred to the %anonymous-name user depending on the configured user settings.', array('%anonymous-name' => config('user.account_settings')->get('anonymous'), '@user-settings-url' => url('admin/config/people/accounts'))), ), 'select account cancellation method' => array( 'title' => t('Select method for cancelling own account'), @@ -1209,7 +1209,7 @@ function user_preprocess_block(&$variables) { * printed to the page. */ function user_format_name($account) { - $name = !empty($account->name) ? $account->name : variable_get('anonymous', t('Anonymous')); + $name = !empty($account->name) ? $account->name : config('user.account_settings')->get('anonymous'); drupal_alter('user_format_name', $name, $account); return $name; } @@ -1873,7 +1873,7 @@ function user_login($form, &$form_state) { '#required' => TRUE, ); - $form['name']['#description'] = t('Enter your @s username.', array('@s' => variable_get('site_name', 'Drupal'))); + $form['name']['#description'] = t('Enter your @s username.', array('@s' => config('system.site')->get('site_name'))); $form['pass'] = array('#type' => 'password', '#title' => t('Password'), '#description' => t('Enter the password that accompanies your username.'), @@ -3334,7 +3334,7 @@ function _user_mail_notify($op, $account, $language = NULL) { if ($op == 'register_pending_approval') { // If a user registered requiring admin approval, notify the admin, too. // We use the site default language for this. - drupal_mail('user', 'register_pending_approval_admin', variable_get('site_mail', ini_get('sendmail_from')), language_default(), $params); + drupal_mail('user', 'register_pending_approval_admin', config('system.site')->get('site_mail'), language_default(), $params); } } return empty($mail) ? NULL : $mail['result']; diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 438fedb..559f975 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -414,6 +414,7 @@ function user_cancel_confirm_form_submit($form, &$form_state) { * @see user_multiple_cancel_confirm() */ function user_cancel_methods() { + $anonymous_name = config('user.account_settings')->get('anonymous'); $methods = array( 'user_cancel_block' => array( 'title' => t('Disable the account and keep its content.'), @@ -424,8 +425,8 @@ function user_cancel_methods() { 'description' => t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), ), 'user_cancel_reassign' => array( - 'title' => t('Delete the account and make its content belong to the %anonymous-name user.', array('%anonymous-name' => variable_get('anonymous', t('Anonymous')))), - 'description' => t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => variable_get('anonymous', t('Anonymous')))), + 'title' => t('Delete the account and make its content belong to the %anonymous-name user.', array('%anonymous-name' => $anonymous_name)), + 'description' => t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => $anonymous_name)), ), 'user_cancel_delete' => array( 'title' => t('Delete the account and its content.'), diff --git a/core/modules/user/user.test b/core/modules/user/user.test index c911088..3be1c68 100644 --- a/core/modules/user/user.test +++ b/core/modules/user/user.test @@ -727,7 +727,8 @@ class UserCancelTestCase extends DrupalWebTestCase { $this->drupalGet('user/' . $account->uid . '/edit'); $this->drupalPost(NULL, NULL, t('Cancel account')); $this->assertText(t('Are you sure you want to cancel your account?'), t('Confirmation form to cancel account displayed.')); - $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => variable_get('anonymous', t('Anonymous')))), t('Informs that all content will be attributed to anonymous account.')); + $anonymous_name = config('user.account_settings')->get('anonymous'); + $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => $anonymous_name)), t('Informs that all content will be attributed to anonymous account.')); // Confirm account cancellation. $timestamp = time(); @@ -2397,7 +2398,7 @@ class UserEntityCallbacksTestCase extends DrupalWebTestCase { // Setup a random anonymous name to be sure the name is used. $name = $this->randomName(); - variable_set('anonymous', $name); + config('user.account_settings')->set('anonymous', $name)->save(); $this->assertEqual(entity_label('user', $this->anonymous), $name, t('The variable anonymous should be used for name of uid 0')); } diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php index 7db1a31..b3e0cca 100644 --- a/core/themes/bartik/template.php +++ b/core/themes/bartik/template.php @@ -43,6 +43,7 @@ function bartik_process_html(&$variables) { * Implements hook_process_HOOK() for page.tpl.php. */ function bartik_process_page(&$variables) { + $config = config('system.site'); // Hook into color.module. if (module_exists('color')) { _color_page_alter($variables); @@ -53,11 +54,11 @@ function bartik_process_page(&$variables) { $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. - $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal')); + $variables['site_name'] = filter_xss_admin($config->get('site_name')); } if ($variables['hide_site_slogan']) { // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it. - $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', '')); + $variables['site_slogan'] = filter_xss_admin($config->get('site_slogan')); } // Since the title and the shortcut link are both block level elements, // positioning them next to each other is much simpler with a wrapper div. @@ -94,17 +95,18 @@ function bartik_preprocess_maintenance_page(&$variables) { * Implements hook_process_HOOK() for maintenance-page.tpl.php. */ function bartik_process_maintenance_page(&$variables) { + $config = config('system.site'); // Always print the site name and slogan, but if they are toggled off, we'll // just hide them visually. $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE; $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE; if ($variables['hide_site_name']) { // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. - $variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal')); + $variables['site_name'] = filter_xss_admin($config->get('site_name')); } if ($variables['hide_site_slogan']) { // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it. - $variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', '')); + $variables['site_slogan'] = filter_xss_admin($config->get('site_slogan')); } } diff --git a/profiles/minimal/minimal.install b/profiles/minimal/minimal.install index e02ffcc..0fb2ef7 100644 --- a/profiles/minimal/minimal.install +++ b/profiles/minimal/minimal.install @@ -79,7 +79,7 @@ function minimal_install() { $query->execute(); // Set front page to "node". - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); // Allow visitor account creation, but with administrative approval. variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL); diff --git a/profiles/standard/standard.install b/profiles/standard/standard.install index 30a943b..e1668da 100644 --- a/profiles/standard/standard.install +++ b/profiles/standard/standard.install @@ -206,7 +206,7 @@ function standard_install() { $query->execute(); // Set front page to "node". - variable_set('site_frontpage', 'node'); + config('system.site')->set('site_frontpage', 'node')->save(); // Insert default pre-defined node types into the database. For a complete // list of available node type attributes, refer to the node type API