From 4b6bdbb1ddb8dd7f8a50dcbb574d5f66a93747ae Mon Sep 17 00:00:00 2001
From: webchick <webchick@24967.no-reply.drupal.org>
Date: Mon, 2 Jul 2012 10:20:33 -0700
Subject: [PATCH] Issue #1496542 by cosmicdreams, sun, chx, vasi1186,
 aspilicious, alexpott, nadavoid, Pedro Lozano, disasm, andypost | heyrocker:
 Convert site information to config system.

---
 core/includes/ajax.inc                        |  2 +-
 core/includes/common.inc                      |  7 ++--
 core/includes/gettext.inc                     |  2 +-
 core/includes/install.core.inc                |  7 +++-
 core/includes/mail.inc                        |  6 ++-
 core/includes/path.inc                        |  6 +--
 core/includes/theme.inc                       | 30 +++++++++------
 .../MaintenanceModeSubscriber.php             |  2 +-
 .../Core/EventSubscriber/PathSubscriber.php   |  5 ++-
 core/lib/Drupal/Core/ExceptionController.php  |  4 +-
 core/modules/aggregator/aggregator.pages.inc  |  8 ++--
 .../lib/Drupal/block/Tests/BlockTest.php      |  2 +-
 core/modules/contact/contact.install          |  6 ++-
 core/modules/contact/contact.module           |  2 +-
 core/modules/filter/filter.module             |  2 +-
 .../Drupal/locale/Tests/LocalePathTest.php    |  2 +-
 core/modules/node/node.module                 |  9 +++--
 core/modules/overlay/overlay.module           |  2 +-
 .../simpletest/Tests/SimpleTestTest.php       |  2 +-
 .../lib/Drupal/simpletest/WebTestBase.php     |  2 +-
 core/modules/system/language.api.php          |  4 +-
 .../system/Tests/Bootstrap/PageCacheTest.php  |  8 ++--
 .../system/Tests/Common/HttpRequestTest.php   |  2 +-
 .../Drupal/system/Tests/Menu/RouterTest.php   |  2 +-
 .../Drupal/system/Tests/Menu/TrailTest.php    |  6 ++-
 .../system/Tests/Path/MatchPathTest.php       |  2 +-
 .../system/Tests/System/AccessDeniedTest.php  |  2 +-
 .../system/Tests/System/FrontPageTest.php     |  2 +-
 .../Tests/System/SiteMaintenanceTest.php      |  4 +-
 .../system/Tests/System/TokenReplaceTest.php  | 14 ++++---
 .../system/Tests/Theme/FunctionsTest.php      |  2 +-
 .../Drupal/system/Tests/Theme/ThemeTest.php   |  4 +-
 .../Tests/Upgrade/UpgradePathTestBase.php     |  1 -
 core/modules/system/system.admin.inc          | 38 ++++++++++++++-----
 core/modules/system/system.api.php            |  6 +--
 core/modules/system/system.install            | 16 ++++++++
 core/modules/system/system.tokens.inc         |  6 +--
 core/modules/taxonomy/taxonomy.pages.inc      |  2 +-
 core/modules/update/update.module             |  2 +-
 core/modules/user/user.module                 |  8 +++-
 core/themes/bartik/template.php               | 10 +++--
 profiles/minimal/minimal.install              |  2 +-
 profiles/standard/standard.install            |  2 +-
 43 files changed, 161 insertions(+), 92 deletions(-)

diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc
index ede35daf068e..a72fc5543a90 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('name'))))));
         break;
     }
   }
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 23069cba24e7..689d136bad9d 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -2482,6 +2482,7 @@ function drupal_deliver_html_page($page_callback_result) {
 
   // Menu status constants are integers; page content is a string or array.
   if (is_int($page_callback_result)) {
+    $site_config = config('system.site');
     // @todo: Break these up into separate functions?
     switch ($page_callback_result) {
       case MENU_NOT_FOUND:
@@ -2498,7 +2499,7 @@ function drupal_deliver_html_page($page_callback_result) {
           $_GET['destination'] = current_path();
         }
 
-        $path = drupal_get_normal_path(variable_get('site_404', ''));
+        $path = drupal_get_normal_path($site_config->get('page.404'));
         if ($path && $path != current_path()) {
           // Custom 404 handler. Set the active item in case there are tabs to
           // display, or other dependencies on the path.
@@ -2527,7 +2528,7 @@ function drupal_deliver_html_page($page_callback_result) {
           $_GET['destination'] = current_path();
         }
 
-        $path = drupal_get_normal_path(variable_get('site_403', ''));
+        $path = drupal_get_normal_path($site_config->get('page.403'));
         if ($path && $path != current_path()) {
           // Custom 403 handler. Set the active item in case there are tabs to
           // display or other dependencies on the path.
@@ -2550,7 +2551,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' => $site_config->get('name')))))));
         break;
     }
   }
diff --git a/core/includes/gettext.inc b/core/includes/gettext.inc
index 4e3b22132cf8..ef9d25d0dc06 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('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 eb9dff9dd3c3..c145cc79c280 100644
--- a/core/includes/install.core.inc
+++ b/core/includes/install.core.inc
@@ -1916,8 +1916,11 @@ 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']);
+  config('system.site')
+    ->set('name', $form_state['values']['site_name'])
+    ->set('mail', $form_state['values']['site_mail'])
+    ->save();
+
   variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
   variable_set('site_default_country', $form_state['values']['site_default_country']);
 
diff --git a/core/includes/mail.inc b/core/includes/mail.inc
index f58a76e799b7..b875f92ff5e2 100644
--- a/core/includes/mail.inc
+++ b/core/includes/mail.inc
@@ -118,7 +118,11 @@
  *   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'));
+  $site_mail = config('system.site')->get('mail');
+  if (empty($site_mail)) {
+    $site_mail = ini_get('sendmail_from');
+  }
+  $default_from = $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 0c7e4d40ff0a..62a58a6e0bb3 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('page.front');
     _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('page.front'));
   }
 
   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('page.front'), '/') . '\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 22ace17f0626..335753262c7a 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2458,17 +2458,18 @@ function template_preprocess_html(&$variables) {
     drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type));
   }
 
+  $site_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($site_config->get('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($site_config->get('name')));
+    if ($site_config->get('slogan')) {
+      $head_title['slogan'] = filter_xss_admin($site_config->get('slogan'));
     }
   }
   $variables['head_title_array'] = $head_title;
@@ -2534,6 +2535,7 @@ function template_preprocess_html(&$variables) {
  */
 function template_preprocess_page(&$variables) {
   $language_interface = drupal_container()->get(LANGUAGE_TYPE_INTERFACE);
+  $site_config = config('system.site');
 
   // Move some variables to the top level for themer convenience and template cleanliness.
   $variables['show_messages'] = $variables['page']['#show_messages'];
@@ -2562,8 +2564,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($site_config->get('name')) : '');
+  $variables['site_slogan']       = (theme_get_setting('toggle_slogan') ? filter_xss_admin($site_config->get('slogan')) : '');
   $variables['tabs']              = menu_local_tabs();
 
   if ($node = menu_get_object()) {
@@ -2745,17 +2747,21 @@ function template_preprocess_maintenance_page(&$variables) {
     $variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second';
   }
 
+  $site_config = config('system.site');
+  $site_name = $site_config->get('name');
+  $site_slogan = $site_config->get('slogan');
+
   // Construct page title
   if (drupal_get_title()) {
     $head_title = array(
       'title' => strip_tags(drupal_get_title()),
-      'name' => variable_get('site_name', 'Drupal'),
+      'name' => $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' => $site_name);
+    if ($site_slogan) {
+      $head_title['slogan'] = $site_slogan;
     }
   }
 
@@ -2772,8 +2778,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') ? $site_name : '');
+  $variables['site_slogan']       = (theme_get_setting('toggle_slogan') ? $site_slogan : '');
   $variables['tabs']              = '';
   $variables['title']             = drupal_get_title();
 
diff --git a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
index daed1c90b5b1..6485fa11a3bd 100644
--- a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php
@@ -39,7 +39,7 @@ public function onKernelRequestMaintenanceModeCheck(GetResponseEvent $event) {
       // Deliver the 503 page.
       drupal_maintenance_theme();
       drupal_set_title(t('Site under maintenance'));
-      $content = 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')))))));
+      $content = 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' => config('system.site')->get('name')))))));
       $response = new Response('Service unavailable', 503);
       $response->setContent($content);
       $event->setResponse($response);
diff --git a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
index 910454438cae..2e1beced9d62 100644
--- a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php
@@ -50,7 +50,10 @@ public function onKernelRequestFrontPageResolve(GetResponseEvent $event) {
 
     if (empty($path)) {
       // @todo Temporary hack. Fix when configuration is injectable.
-      $path = variable_get('site_frontpage', 'user');
+      $path = config('system.site')->get('page.front');
+      if (empty($path)) {
+        $path = 'user';
+      }
     }
 
     $this->setPath($request, $path);
diff --git a/core/lib/Drupal/Core/ExceptionController.php b/core/lib/Drupal/Core/ExceptionController.php
index b16339504110..9870cd490e1b 100644
--- a/core/lib/Drupal/Core/ExceptionController.php
+++ b/core/lib/Drupal/Core/ExceptionController.php
@@ -94,7 +94,7 @@ public function on403Html(FlattenException $exception, Request $request) {
     $system_path = $request->attributes->get('system_path');
     watchdog('access denied', $system_path, NULL, WATCHDOG_WARNING);
 
-    $path = drupal_get_normal_path(variable_get('site_403', ''));
+    $path = drupal_get_normal_path(config('system.site')->get('page.403'));
     if ($path && $path != $system_path) {
       // Keep old path for reference, and to allow forms to redirect to it.
       if (!isset($_GET['destination'])) {
@@ -160,7 +160,7 @@ public function on404Html(FlattenException $exception, Request $request) {
       $_GET['destination'] = $system_path;
     }
 
-    $path = drupal_get_normal_path(variable_get('site_404', ''));
+    $path = drupal_get_normal_path(config('system.site')->get('page.404'));
     if ($path && $path != $system_path) {
       // @todo Um, how do I specify an override URL again? Totally not clear. Do
       //   that and sub-call the kernel rather than using meah().
diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc
index fcc61b002367..e41058728c02 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('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('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('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  = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
   $output .= "<opml version=\"1.1\">\n";
   $output .= "<head>\n";
-  $output .= '<title>' . check_plain(variable_get('site_name', 'Drupal')) . "</title>\n";
+  $output .= '<title>' . check_plain(config('system.site')->get('name')) . "</title>\n";
   $output .= '<dateModified>' . gmdate(DATE_RFC2822, REQUEST_TIME) . "</dateModified>\n";
   $output .= "</head>\n";
   $output .= "<body>\n";
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
index 38e65c40a4d0..696a2813d4d2 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
@@ -167,7 +167,7 @@ function testCustomBlockFormat() {
   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('page.front', 'node')->save();
 
     $block = array();
 
diff --git a/core/modules/contact/contact.install b/core/modules/contact/contact.install
index 7ddea4562665..595674001b67 100644
--- a/core/modules/contact/contact.install
+++ b/core/modules/contact/contact.install
@@ -68,11 +68,15 @@ function contact_schema() {
  * Implements hook_install().
  */
 function contact_install() {
+  $site_mail = config('system.site')->get('mail');
+  if (empty($site_mail)) {
+    $site_mail = ini_get('sendmail_from');
+  }
   // Insert a default contact category.
   db_insert('contact')
     ->fields(array(
       'category' => 'Website feedback',
-      'recipients' => variable_get('site_mail', ini_get('sendmail_from')),
+      'recipients' => $site_mail,
       'selected' => 1,
       'reply' => '',
     ))
diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module
index 0976519e57c3..a6c8aed916de 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('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 b7a3059a53ae..0e2f8d46db9f 100644
--- a/core/modules/filter/filter.module
+++ b/core/modules/filter/filter.module
@@ -1277,7 +1277,7 @@ function _filter_html_tips($filter, $format, $long = FALSE) {
   $output .= '<p>' . 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.') . '</p>';
   $output .= '<p>' . t('For more information see W3C\'s <a href="@html-specifications">HTML Specifications</a> or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '</p>';
   $tips = array(
-    'a' => array(t('Anchors are used to make links to other pages.'), '<a href="' . $base_url . '">' . check_plain(variable_get('site_name', 'Drupal')) . '</a>'),
+    'a' => array(t('Anchors are used to make links to other pages.'), '<a href="' . $base_url . '">' . check_plain(config('system.site')->get('name')) . '</a>'),
     '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 <br />line break')),
     'p' => array(t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '<p>' . t('Paragraph one.') . '</p> <p>' . t('Paragraph two.') . '</p>'),
     'strong' => array(t('Strong', array(), array('context' => 'Font weight')), '<strong>' . t('Strong', array(), array('context' => 'Font weight')) . '</strong>'),
diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
index 61fd67fef873..5476a7a7957a 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocalePathTest.php
@@ -25,7 +25,7 @@ function setUp() {
     parent::setUp(array('node', 'locale', 'path'));
 
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
-    variable_set('site_frontpage', 'node');
+    config('system.site')->set('page.front', 'node')->save();
   }
 
   /**
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 319f4220734a..42d968de8b28 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -2482,7 +2482,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('name'),
     'link'        => $base_url,
     'description' => config('system.rss-publishing')->get('feed_description'),
     'language'    => $language_content->langcode
@@ -2533,6 +2533,7 @@ function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcod
  * @see node_menu()
  */
 function node_page_default() {
+  $site_config = config('system.site');
   $select = db_select('node', 'n')
     ->fields('n', array('nid', 'sticky', 'created'))
     ->condition('promote', 1)
@@ -2550,7 +2551,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', $site_config->get('name') . ' ' . t('RSS'));
     $build['pager'] = array(
       '#theme' => 'pager',
       '#weight' => 5,
@@ -2558,7 +2559,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' => $site_config->get('name'))), PASS_THROUGH);
 
     $default_message = '<p>' . t('No front page content has been created yet.') . '</p>';
 
@@ -2781,7 +2782,7 @@ function node_form_system_site_information_settings_form_alter(&$form, &$form_st
     '#title' => t('Number of posts on front page'),
     '#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)),
-    '#access' => (variable_get('site_frontpage') == 'node'),
+    '#access' => (config('system.site')->get('page.front') == 'node'),
     '#description' => t('The maximum number of posts displayed on overview pages such as the front page.'),
   );
   $form['#submit'][] = 'node_form_system_site_information_settings_form_submit';
diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module
index 2a429e78de45..e57ff5fa4a5e 100644
--- a/core/modules/overlay/overlay.module
+++ b/core/modules/overlay/overlay.module
@@ -661,7 +661,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('<front>', variable_get('site_frontpage', 'user'), $type);
+    $type = str_replace('<front>', config('system.site')->get('page.front'), $type);
   }
   drupal_add_js(array('overlay' => array('paths' => $paths)), 'setting');
   $path_prefixes = array();
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
index 8ef2c1405e24..938054a75b63 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
@@ -51,7 +51,7 @@ function testInternalBrowser() {
     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('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/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
index f1a5f954dcb1..d54ccd3a4153 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php
@@ -664,7 +664,7 @@ protected function setUp() {
 
     // Restore necessary variables.
     variable_set('install_task', 'done');
-    variable_set('site_mail', 'simpletest@example.com');
+    config('system.site')->set('mail', 'simpletest@example.com')->save();
     variable_set('date_default_timezone', date_default_timezone_get());
 
     // Set up English language.
diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php
index 903de4a0ba10..d18b273c3cf7 100644
--- a/core/modules/system/language.api.php
+++ b/core/modules/system/language.api.php
@@ -28,11 +28,11 @@ function hook_language_init() {
 
   switch (drupal_container()->get(LANGUAGE_TYPE_INTERFACE)->langcode) {
     case 'it':
-      $conf['site_name'] = 'Il mio sito Drupal';
+      $conf['system.site']['name'] = 'Il mio sito Drupal';
       break;
 
     case 'fr':
-      $conf['site_name'] = 'Mon site Drupal';
+      $conf['system.site']['name'] = 'Mon site Drupal';
       break;
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
index 6355d54ac7c6..af6bf6cd7c00 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
@@ -25,8 +25,10 @@ public static function getInfo() {
   function setUp() {
     parent::setUp(array('node', 'system_test'));
 
-    variable_set('site_name', 'Drupal');
-    variable_set('site_frontpage', 'node');
+    config('system.site')
+      ->set('name', 'Drupal')
+      ->set('page.front', 'node')
+      ->save();
   }
 
   /**
@@ -140,7 +142,7 @@ function testPageCompression() {
     $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('name'))), t('Site title matches.'));
     $this->assertRaw('</html>', t('Page was not compressed.'));
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/HttpRequestTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/HttpRequestTest.php
index 549c439d425a..f6c37c7030a9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/HttpRequestTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/HttpRequestTest.php
@@ -41,7 +41,7 @@ function testDrupalHTTPRequest() {
     $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('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/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
index ac699762d668..05c0024ad364 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
@@ -136,7 +136,7 @@ function testThemeCallbackMaintenanceMode() {
   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('name')));
     $this->drupalGet('node');
     $this->assertText($offline_message);
     $this->drupalGet('menu_login_callback');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php
index a3c024f03624..f6164c972fa5 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/TrailTest.php
@@ -119,8 +119,10 @@ function testMenuTreeSetPath() {
    */
   function testCustom403And404Pages() {
     // Set the custom 403 and 404 pages we will use.
-    variable_set('site_403', 'menu-test/custom-403-page');
-    variable_set('site_404', 'menu-test/custom-404-page');
+    config('system.site')
+      ->set('page.403', 'menu-test/custom-403-page')
+      ->set('page.404', 'menu-test/custom-404-page')
+      ->save();
 
     // Define the paths we'll visit to trigger 403 and 404 responses during
     // this test, and the expected active trail for each case.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php b/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
index db11056cb0a8..a5cbfee548ff 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
@@ -31,7 +31,7 @@ function setUp() {
 
     // Set up a random site front page to test the '<front>' placeholder.
     $this->front = $this->randomName();
-    variable_set('site_frontpage', $this->front);
+    config('system.site')->set('page.front', $this->front)->save();
     // Refresh our static variables from the database.
     $this->refreshVariables();
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php b/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
index 6c17c16792d4..f278f60aa443 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
@@ -73,7 +73,7 @@ function testAccessDenied() {
 
     // Log back in, set the custom 403 page to /user and remove the block
     $this->drupalLogin($this->admin_user);
-    variable_set('site_403', 'user');
+    config('system.site')->set('page.403', 'user')->save();
     $this->drupalPost('admin/structure/block', array('blocks[user_login][region]' => '-1'), t('Save blocks'));
 
     // Check that we can log in from the 403 page.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
index 25fe590dce97..2323a07fa1d8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/FrontPageTest.php
@@ -31,7 +31,7 @@ function setUp() {
     $this->node_path = "node/" . $this->drupalCreateNode(array('promote' => 1))->nid;
 
     // Configure 'node' as front page.
-    variable_set('site_frontpage', 'node');
+    config('system.site')->set('page.front', 'node')->save();
     // Enable front page logging in system_test.module.
     variable_set('front_page_output', 1);
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
index f586ca18230f..7788c67a35fa 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/SiteMaintenanceTest.php
@@ -27,7 +27,7 @@ function setUp() {
     parent::setUp(array('node'));
 
     // Configure 'node' as front page.
-    variable_set('site_frontpage', 'node');
+    config('system.site')->set('page.front', 'node')->save();
 
     // Create a user allowed to access site in maintenance mode.
     $this->user = $this->drupalCreateUser(array('access site in maintenance mode'));
@@ -48,7 +48,7 @@ function testSiteMaintenance() {
 
     $admin_message = t('Operating in maintenance mode. <a href="@url">Go online.</a>', 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('name')));
 
     $this->drupalGet('');
     $this->assertRaw($admin_message, t('Found the site maintenance mode message.'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
index 0ea8ca92251e..c329b9683a91 100644
--- a/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/System/TokenReplaceTest.php
@@ -111,13 +111,15 @@ function testSystemSiteTokenReplacement() {
     );
 
     // Set a few site variables.
-    variable_set('site_name', '<strong>Drupal<strong>');
-    variable_set('site_slogan', '<blink>Slogan</blink>');
+    config('system.site')
+      ->set('name', '<strong>Drupal<strong>')
+      ->set('slogan', '<blink>Slogan</blink>')
+      ->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('name'));
+    $tests['[site:slogan]'] = check_plain(config('system.site')->get('slogan'));
     $tests['[site:mail]'] = 'simpletest@example.com';
     $tests['[site:url]'] = url('<front>', $url_options);
     $tests['[site:url-brief]'] = preg_replace(array('!^https?://!', '!/$!'), '', url('<front>', $url_options));
@@ -132,8 +134,8 @@ function testSystemSiteTokenReplacement() {
     }
 
     // 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('name');
+    $tests['[site:slogan]'] = config('system.site')->get('slogan');
 
     foreach ($tests as $input => $expected) {
       $output = token_replace($input, array(), array('language' => $language_interface, 'sanitize' => FALSE));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
index cb25c6f1b5e5..a8a66f6ed091 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php
@@ -98,7 +98,7 @@ function testLinks() {
     // 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('page.front'));
 
     // Verify that a list of links is properly rendered.
     $variables = array();
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
index 502c955d6558..4be9dd5b8285 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
@@ -33,7 +33,7 @@ function setUp() {
   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('page.front', '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'));
@@ -77,7 +77,7 @@ function testFrontPageThemeSuggestion() {
     $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('page.front', 'node')->save();
     _current_path('node');
     $suggestions = theme_get_suggestions(array('node'), 'page');
     // Set it back to not annoy the batch runner.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
index e990fe7ddf22..4d12123cb208 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
@@ -135,7 +135,6 @@ protected function setUp() {
     $this->prepareD8Session();
 
     // Restore necessary variables.
-    // @todo Convert into config('system.site')->set('mail')?
     $this->variable_set('site_mail', 'simpletest@example.com');
 
     drupal_set_time_limit($this->timeLimit);
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index da54c96892f7..f64447e95d2b 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -1465,7 +1465,13 @@ function system_ip_blocking_delete_submit($form, &$form_state) {
  * @ingroup forms
  * @see system_settings_form()
  */
-function system_site_information_settings() {
+function system_site_information_settings($form, &$form_state) {
+  $site_config = config('system.site');
+  $site_mail = $site_config->get('mail');
+  if (empty($site_mail)) {
+    $site_mail = ini_get('sendmail_from');
+  }
+
   $form['site_information'] = array(
     '#type' => 'fieldset',
     '#title' => t('Site details'),
@@ -1473,19 +1479,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' => $site_config->get('name'),
     '#required' => TRUE
   );
   $form['site_information']['site_slogan'] = array(
     '#type' => 'textfield',
     '#title' => t('Slogan'),
-    '#default_value' => variable_get('site_slogan', ''),
+    '#default_value' => $site_config->get('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' => $site_mail,
     '#description' => t("The <em>From</em> 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,
   );
@@ -1496,7 +1502,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' => ($site_config->get('page.front') != 'user' ? drupal_get_path_alias($site_config->get('page.front')) : ''),
     '#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)),
@@ -1508,7 +1514,7 @@ function system_site_information_settings() {
   $form['error_page']['site_403'] = array(
     '#type' => 'textfield',
     '#title' => t('Default 403 (access denied) page'),
-    '#default_value' => variable_get('site_403', ''),
+    '#default_value' => $site_config->get('page.403'),
     '#size' => 40,
     '#description' => t('This page is displayed when the requested document is denied to the current user. Leave blank to display a generic "access denied" page.'),
     '#field_prefix' => url(NULL, array('absolute' => TRUE)),
@@ -1516,7 +1522,7 @@ function system_site_information_settings() {
   $form['error_page']['site_404'] = array(
     '#type' => 'textfield',
     '#title' => t('Default 404 (not found) page'),
-    '#default_value' => variable_get('site_404', ''),
+    '#default_value' => $site_config->get('page.404'),
     '#size' => 40,
     '#description' => t('This page is displayed when no other content matches the requested document. Leave blank to display a generic "page not found" page.'),
     '#field_prefix' => url(NULL, array('absolute' => TRUE)),
@@ -1524,7 +1530,7 @@ function system_site_information_settings() {
 
   $form['#validate'][] = 'system_site_information_settings_validate';
 
-  return system_settings_form($form);
+  return system_config_form($form, $form_state);
 }
 
 /**
@@ -1561,6 +1567,20 @@ function system_site_information_settings_validate($form, &$form_state) {
   }
 }
 
+/**
+ * Form submission handler for system_site_information_settings().
+ */
+function system_site_information_settings_submit($form, &$form_state) {
+  config('system.site')
+    ->set('name', $form_state['values']['site_name'])
+    ->set('mail', $form_state['values']['site_mail'])
+    ->set('slogan', $form_state['values']['site_slogan'])
+    ->set('page.front', $form_state['values']['site_frontpage'])
+    ->set('page.403', $form_state['values']['site_403'])
+    ->set('page.404', $form_state['values']['site_404'])
+    ->save();
+}
+
 /**
  * Form builder; Cron form.
  *
@@ -2219,7 +2239,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('name')))),
   );
 
   return system_settings_form($form);
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index f7a0e3529982..12428fe3a0cd 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -1526,7 +1526,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('name');
   }
 }
 
@@ -1914,7 +1914,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('name'),
     '@severity_desc' => $severity_list[$log_entry['severity']],
   ));
 
@@ -1980,7 +1980,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('name'),
     '%username' => user_format_name($account),
   );
   if ($context['hook'] == 'taxonomy') {
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 16bac0ff1feb..9a2217d5a548 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1937,6 +1937,22 @@ function system_update_8011() {
     ->execute();
 }
 
+/**
+ * Moves site system settings from variable to config.
+ *
+ * @ingroup config_upgrade
+ */
+function system_update_8012() {
+  update_variables_to_config('system.site', array(
+    'site_name' => 'name',
+    'site_mail' => 'mail',
+    'site_slogan' => 'slogan',
+    'site_frontpage' => 'page.front',
+    'site_403' => 'page.403',
+    'site_404' => 'page.404',
+  ));
+}
+
 /**
  * @} 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.tokens.inc b/core/modules/system/system.tokens.inc
index 249289077e1a..d3df60e6c17f 100644
--- a/core/modules/system/system.tokens.inc
+++ b/core/modules/system/system.tokens.inc
@@ -145,17 +145,17 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
     foreach ($tokens as $name => $original) {
       switch ($name) {
         case 'name':
-          $site_name = variable_get('site_name', 'Drupal');
+          $site_name = config('system.site')->get('name');
           $replacements[$original] = $sanitize ? check_plain($site_name) : $site_name;
           break;
 
         case 'slogan':
-          $slogan = variable_get('site_slogan', '');
+          $slogan = config('system.site')->get('slogan');
           $replacements[$original] = $sanitize ? check_plain($slogan) : $slogan;
           break;
 
         case 'mail':
-          $replacements[$original] = variable_get('site_mail', '');
+          $replacements[$original] = config('system.site')->get('mail');
           break;
 
         case 'url':
diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index 48d07748e5fe..879d6852997b 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -69,7 +69,7 @@ function taxonomy_term_page(Term $term) {
  */
 function taxonomy_term_feed(Term $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('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 2293799f5272..4e6a474537a8 100644
--- a/core/modules/update/update.module
+++ b/core/modules/update/update.module
@@ -521,7 +521,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('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/user.module b/core/modules/user/user.module
index 1e7aa99c2a54..2250110c5453 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1880,7 +1880,7 @@ function user_login($form, &$form_state) {
     ),
   );
 
-  $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('name')));
   $form['pass'] = array('#type' => 'password',
     '#title' => t('Password'),
     '#description' => t('Enter the password that accompanies your username.'),
@@ -3308,7 +3308,11 @@ 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);
+      $site_mail = config('system.site')->get('mail');
+      if (empty($site_mail)) {
+        $site_mail = ini_get('sendmail_from');
+      }
+      drupal_mail('user', 'register_pending_approval_admin', $site_mail, language_default(), $params);
     }
   }
   return empty($mail) ? NULL : $mail['result'];
diff --git a/core/themes/bartik/template.php b/core/themes/bartik/template.php
index 7db1a31c8556..eaeb38dbdb10 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) {
+  $site_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($site_config->get('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($site_config->get('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) {
+  $site_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($site_config->get('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($site_config->get('slogan'));
   }
 }
 
diff --git a/profiles/minimal/minimal.install b/profiles/minimal/minimal.install
index 50ef44618153..2c4cee1bfc65 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('page.front', '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 5c7032a166fe..ff3d1d62d3e1 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('page.front', '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
-- 
GitLab