commit 2a8b7d763cb260531baa290dba78d4aa6d8e98bb
Author: Sebastien Corbin <seb.corbin@gmail.com>
Date:   Sun Feb 15 16:02:29 2015 +0100

    1885564-142

diff --git a/core/authorize.php b/core/authorize.php
index dbab02f..76d4c7b 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -116,10 +116,14 @@ function authorize_access_allowed() {
       $links += $results['tasks'];
     }
     else {
-      $links = array_merge($links, array(
-        \Drupal::l(t('Administration pages'), new Url('system.admin')),
-        \Drupal::l(t('Front page'), new Url('<front>')),
-      ));
+      $front_url = Url::fromRoute('<front>')
+                      ->setOption('base_url', $GLOBALS['base_url']);
+      $admin_url = Url::fromRoute('system.admin')
+                      ->setOption('base_url', $GLOBALS['base_url']);
+      $links = array_merge($links, [
+        ['#markup' => \Drupal::l(t('Administration pages'), $admin_url)],
+        ['#markup' => \Drupal::l(t('Front page'), $front_url)],
+      ]);
     }
 
     $content['next_steps'] = array(
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index b99fc6c..d6cc0cb 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -1847,17 +1847,10 @@ function drupal_common_theme() {
     'maintenance_task_list' => array(
       'variables' => array('items' => NULL, 'active' => NULL,  'variant' => NULL),
     ),
-    'authorize_message' => array(
-      'variables' => array('message' => NULL, 'success' => TRUE),
-      'function' => 'theme_authorize_message',
-      'path' => 'core/includes',
-      'file' => 'theme.maintenance.inc',
-    ),
     'authorize_report' => array(
-      'variables' => array('messages' => array()),
-      'function' => 'theme_authorize_report',
-      'path' => 'core/includes',
-      'file' => 'theme.maintenance.inc',
+      'variables' => ['messages' => [], 'attributes' => []],
+      'includes' => ['core/includes/theme.maintenance.inc'],
+      'template' => 'authorize-report',
     ),
     // From pager.inc.
     'pager' => array(
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index aca0a53..6f9cc6b 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -105,64 +105,37 @@ function _drupal_maintenance_theme() {
 }
 
 /**
- * Returns HTML for a results report of an operation run by authorize.php.
+ * Prepares variables for authorize.php operation report templates.
  *
- * @param $variables
+ * This report displays the results of an operation run via authorize.php.
+ *
+ * Default template: authorize-report.html.twig.
+ *
+ * @param array $variables
  *   An associative array containing:
  *   - messages: An array of result messages.
- *
- * @ingroup themeable
  */
-function theme_authorize_report($variables) {
+function template_preprocess_authorize_report(&$variables) {
   $messages = $variables['messages'];
-  $output = '';
+  $variables['report'] = [];
   if (!empty($messages)) {
-    $output .= '<div class="authorize-results">';
     foreach ($messages as $heading => $logs) {
-      $items = array();
+      $items = [];
       foreach ($logs as $number => $log_message) {
         if ($number === '#abort') {
           continue;
         }
-        $authorize_message = array(
-          '#theme' => 'authorize_message',
-          '#message' => $log_message['message'],
-          '#success' => $log_message['success'],
-        );
-        $items[] = drupal_render($authorize_message);
+        $class = 'authorize-results__' . ($log_message['success'] ? 'success' : 'failure');
+        $items[] = [
+          '#wrapper_attributes' => ['class' => [$class]],
+          '#markup' => $log_message['message'],
+        ];
       }
-      $item_list = array(
+      $variables['report'][] = [
         '#theme' => 'item_list',
         '#items' => $items,
         '#title' => $heading,
-      );
-      $output .= drupal_render($item_list);
+      ];
     }
-    $output .= '</div>';
   }
-  return $output;
-}
-
-/**
- * Returns HTML for a single log message from the authorize.php batch operation.
- *
- * @param $variables
- *   An associative array containing:
- *   - message: The log message.
- *     It's the caller's responsibility to ensure this string contains no
- *     dangerous HTML such as SCRIPT tags.
- *   - success: A boolean indicating failure or success.
- *
- * @ingroup themeable
- */
-function theme_authorize_message($variables) {
-  $message = $variables['message'];
-  $success = $variables['success'];
-  if ($success) {
-    $item = array('data' => array('#markup' => $message), 'class' => array('authorize-results__success'));
-  }
-  else {
-    $item = array('data' => array('#markup' => $message), 'class' => array('authorize-results__failure'));
-  }
-  return $item;
 }
diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php
index 805c9a9..04619a2 100644
--- a/core/lib/Drupal/Core/Theme/Registry.php
+++ b/core/lib/Drupal/Core/Theme/Registry.php
@@ -424,6 +424,13 @@ protected function processExtension(&$cache, $name, $type, $theme, $path) {
           $result[$hook]['includes'] = $cache[$hook]['includes'];
         }
 
+        // Load the includes, as they may contain preprocess functions.
+        if (isset($info['includes'])) {
+          foreach ($info['includes'] as $include_file) {
+            include_once $this->root . '/' . $include_file;
+          }
+        }
+
         // If the theme implementation defines a file, then also use the path
         // that it defined. Otherwise use the default path. This allows
         // system.module to declare theme functions on behalf of core .include
diff --git a/core/lib/Drupal/Core/Updater/Module.php b/core/lib/Drupal/Core/Updater/Module.php
index 06e1c1e..9e6c396 100644
--- a/core/lib/Drupal/Core/Updater/Module.php
+++ b/core/lib/Drupal/Core/Updater/Module.php
@@ -99,11 +99,17 @@ public function getSchemaUpdates() {
    * Overrides Drupal\Core\Updater\Updater::postInstallTasks().
    */
   public function postInstallTasks() {
-    return array(
-      \Drupal::l(t('Install another module'), new Url('update.module_install')),
-      \Drupal::l(t('Enable newly added modules'), new Url('system.modules_list')),
-      \Drupal::l(t('Administration pages'), new Url('system.admin')),
-    );
+    $admin_url = Url::fromRoute('system.admin')
+                    ->setOption('base_url', $GLOBALS['base_url']);
+    $list_url = Url::fromRoute('system.modules_list')
+                   ->setOption('base_url', $GLOBALS['base_url']);
+    $install_url = Url::fromRoute('update.module_install')
+                      ->setOption('base_url', $GLOBALS['base_url']);
+    return [
+      ['#markup' => \Drupal::l(t('Install another module'), $install_url)],
+      ['#markup' => \Drupal::l(t('Enable newly added modules'), $list_url)],
+      ['#markup' => \Drupal::l(t('Administration pages'), $admin_url)],
+    ];
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Updater/Theme.php b/core/lib/Drupal/Core/Updater/Theme.php
index b379325..5d38475 100644
--- a/core/lib/Drupal/Core/Updater/Theme.php
+++ b/core/lib/Drupal/Core/Updater/Theme.php
@@ -83,9 +83,13 @@ public function postInstall() {
    * Overrides Drupal\Core\Updater\Updater::postInstallTasks().
    */
   public function postInstallTasks() {
-    return array(
-      \Drupal::l(t('Install newly added themes'), new Url('system.themes_page')),
-      \Drupal::l(t('Administration pages'), new Url('system.admin')),
-    );
+    $theme_page_url = Url::fromRoute('system.themes_page')
+                         ->setOption('base_url', $GLOBALS['base_url']);
+    $admin_url = Url::fromRoute('system.admin')
+                    ->setOption('base_url', $GLOBALS['base_url']);
+    return [
+      ['#markup' => \Drupal::l(t('Install newly added themes'), $theme_page_url)],
+      ['#markup' => \Drupal::l(t('Administration pages'), $admin_url)],
+    ];
   }
 }
diff --git a/core/modules/system/templates/authorize-report.html.twig b/core/modules/system/templates/authorize-report.html.twig
new file mode 100644
index 0000000..8e39a2a
--- /dev/null
+++ b/core/modules/system/templates/authorize-report.html.twig
@@ -0,0 +1,23 @@
+{#
+/**
+ * @file
+ * Default theme implementation for authorize.php operation report templates.
+ *
+ * This report displays the results of an operation run via authorize.php.
+ *
+ * Available variables:
+ * - report: A list of result messages.
+ * - attributes: HTML attributes for the element.
+ *
+ * @see template_preprocess_authorize_report()
+ *
+ * @ingroup themeable
+ */
+#}
+{% if report %}
+  <div class="authorize-results">
+    {% for messages in report %}
+      {{ messages }}
+    {% endfor %}
+  </div>
+{% endif %}
