From 2daffc4f896ee343be1b9950feb201833b7b9db5 Mon Sep 17 00:00:00 2001
From: Vadim Hirbu <vadim.hirbu@wearepropeople.com>
Date: Wed, 5 Nov 2014 13:16:42 +0200
Subject: [PATCH 1/4] Issue 2367747: Remove usage of
 system_rebuild_theme_data().

---
 core/includes/bootstrap.inc                                   | 2 +-
 core/includes/theme.maintenance.inc                           | 2 +-
 core/includes/update.inc                                      | 2 +-
 core/lib/Drupal/Core/Updater/Theme.php                        | 2 +-
 core/modules/locale/locale.compare.inc                        | 2 +-
 core/modules/system/src/Tests/Extension/ModuleHandlerTest.php | 2 +-
 core/modules/system/system.api.php                            | 2 +-
 core/modules/system/system.module                             | 2 +-
 core/modules/update/src/Tests/UpdateContribTest.php           | 2 +-
 core/modules/update/src/UpdateManager.php                     | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 0ea383f..2579f92 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -275,7 +275,7 @@ function drupal_get_filename($type, $name, $filename = NULL) {
       }
     }
     // If still unknown, retrieve the file list prepared in state by
-    // system_rebuild_module_data() and system_rebuild_theme_data().
+    // system_rebuild_module_data() and \Drupal::service('theme_handler')->rebuildThemeData().
     if (!isset($files[$type][$name]) && \Drupal::hasService('state')) {
       $files[$type] += \Drupal::state()->get('system.' . $type . '.files', array());
     }
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index e40498c..f496f51 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -64,7 +64,7 @@ function _drupal_maintenance_theme() {
   }
 
   // Ensure that system.module is loaded.
-  if (!function_exists('system_rebuild_theme_data')) {
+  if (!function_exists(\Drupal::service('theme_handler')->rebuildThemeData())) {
     $module_handler = \Drupal::moduleHandler();
     $module_handler->addModule('system', 'core/modules/system');
     $module_handler->load('system');
diff --git a/core/includes/update.inc b/core/includes/update.inc
index 510dc8c..46ab61b 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -44,7 +44,7 @@ function update_check_incompatibility($name, $type = 'module') {
     // We need to do a full rebuild here to make sure the database reflects any
     // code changes that were made in the filesystem before the update script
     // was initiated.
-    $themes = system_rebuild_theme_data();
+    $themes = \Drupal::service('theme_handler')->rebuildThemeData();
     $modules = system_rebuild_module_data();
   }
 
diff --git a/core/lib/Drupal/Core/Updater/Theme.php b/core/lib/Drupal/Core/Updater/Theme.php
index b379325..d8b7607 100644
--- a/core/lib/Drupal/Core/Updater/Theme.php
+++ b/core/lib/Drupal/Core/Updater/Theme.php
@@ -76,7 +76,7 @@ public static function canUpdate($project_name) {
   public function postInstall() {
     // Update the theme info.
     clearstatcache();
-    system_rebuild_theme_data();
+		\Drupal::service('theme_handler')->rebuildThemeData();
   }
 
   /**
diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc
index e131d99..efefa3b 100644
--- a/core/modules/locale/locale.compare.inc
+++ b/core/modules/locale/locale.compare.inc
@@ -126,7 +126,7 @@ function locale_translation_project_list() {
       'interface translation server pattern',
     );
     $module_data = _locale_translation_prepare_project_list(system_rebuild_module_data(), 'module');
-    $theme_data = _locale_translation_prepare_project_list(system_rebuild_theme_data(), 'theme');
+    $theme_data = _locale_translation_prepare_project_list(\Drupal::service('theme_handler')->rebuildThemeData(), 'theme');
     $project_info = new ProjectInfo();
     $project_info->processInfoList($projects, $module_data, 'module', TRUE, $additional_whitelist);
     $project_info->processInfoList($projects, $theme_data, 'theme', TRUE, $additional_whitelist);
diff --git a/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php b/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php
index 69f5627..5bd32c6 100644
--- a/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php
+++ b/core/modules/system/src/Tests/Extension/ModuleHandlerTest.php
@@ -235,7 +235,7 @@ public function testModuleStreamWrappers() {
    */
   function testThemeMetaData() {
     // Generate the list of available themes.
-    $themes = system_rebuild_theme_data();
+    $themes = \Drupal::service('theme_handler')->rebuildThemeData();
     // Check that the mtime field exists for the bartik theme.
     $this->assertTrue(!empty($themes['bartik']->info['mtime']), 'The bartik.info.yml file modification time field is present.');
     // Use 0 if mtime isn't present, to avoid an array index notice.
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index bdbc03f..84a7987 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -875,7 +875,7 @@ function hook_system_breadcrumb_alter(array &$breadcrumb, \Drupal\Core\Routing\R
  * Alter the information parsed from module and theme .info.yml files
  *
  * This hook is invoked in _system_rebuild_module_data() and in
- * _system_rebuild_theme_data(). A module may implement this hook in order to
+ * \Drupal::service('theme_handler')->rebuildThemeData(). A module may implement this hook in order to
  * add to or alter the data generated by reading the .info.yml file with
  * \Drupal\Core\Extension\InfoParser.
  *
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 0d41bba..9c4289a 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -737,7 +737,7 @@ function system_check_directory($form_element, FormStateInterface $form_state) {
  *   array is returned.
  *
  * @see system_rebuild_module_data()
- * @see system_rebuild_theme_data()
+ * @see \Drupal::service('theme_handler')->rebuildThemeData()
  */
 function system_get_info($type, $name = NULL) {
   $info = array();
diff --git a/core/modules/update/src/Tests/UpdateContribTest.php b/core/modules/update/src/Tests/UpdateContribTest.php
index 118a60e..cd2de6c 100644
--- a/core/modules/update/src/Tests/UpdateContribTest.php
+++ b/core/modules/update/src/Tests/UpdateContribTest.php
@@ -292,7 +292,7 @@ function testUpdateHiddenBaseTheme() {
     );
     \Drupal::config('update_test.settings')->set('system_info', $system_info)->save();
     $projects = update_get_projects();
-    $theme_data = system_rebuild_theme_data();
+    $theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
     $project_info = new ProjectInfo();
     $project_info->processInfoList($projects, $theme_data, 'theme', TRUE);
 
diff --git a/core/modules/update/src/UpdateManager.php b/core/modules/update/src/UpdateManager.php
index 21cfe80..567cc0b 100644
--- a/core/modules/update/src/UpdateManager.php
+++ b/core/modules/update/src/UpdateManager.php
@@ -123,7 +123,7 @@ public function getProjects() {
       if (empty($this->projects)) {
         // Still empty, so we have to rebuild.
         $module_data = system_rebuild_module_data();
-        $theme_data = system_rebuild_theme_data();
+        $theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
         $project_info = new ProjectInfo();
         $project_info->processInfoList($this->projects, $module_data, 'module', TRUE);
         $project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE);

From 47e9b55efad4af3cb8107b96f0de650310b6c04d Mon Sep 17 00:00:00 2001
From: Vadim Hirbu <vadim.hirbu@wearepropeople.com>
Date: Wed, 5 Nov 2014 13:58:13 +0200
Subject: [PATCH 2/4] Issue 2367747: Remove non needed whitespaces.

---
 core/lib/Drupal/Core/Updater/Theme.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/lib/Drupal/Core/Updater/Theme.php b/core/lib/Drupal/Core/Updater/Theme.php
index d8b7607..c9af8d8 100644
--- a/core/lib/Drupal/Core/Updater/Theme.php
+++ b/core/lib/Drupal/Core/Updater/Theme.php
@@ -77,7 +77,7 @@ public function postInstall() {
     // Update the theme info.
     clearstatcache();
 		\Drupal::service('theme_handler')->rebuildThemeData();
-  }
+	}
 
   /**
    * Overrides Drupal\Core\Updater\Updater::postInstallTasks().

From 5c02c18ed9e56a0b76a972daa58c98e7f0ef589a Mon Sep 17 00:00:00 2001
From: Vadim Hirbu <vadim.hirbu@wearepropeople.com>
Date: Wed, 5 Nov 2014 14:21:17 +0200
Subject: [PATCH 3/4] Issue 2367747: Remove whitespaces added by IDE.

---
 core/lib/Drupal/Core/Updater/Theme.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/lib/Drupal/Core/Updater/Theme.php b/core/lib/Drupal/Core/Updater/Theme.php
index c9af8d8..c717c41 100644
--- a/core/lib/Drupal/Core/Updater/Theme.php
+++ b/core/lib/Drupal/Core/Updater/Theme.php
@@ -76,8 +76,8 @@ public static function canUpdate($project_name) {
   public function postInstall() {
     // Update the theme info.
     clearstatcache();
-		\Drupal::service('theme_handler')->rebuildThemeData();
-	}
+	\Drupal::service('theme_handler')->rebuildThemeData();
+  }
 
   /**
    * Overrides Drupal\Core\Updater\Updater::postInstallTasks().

From f864477a84d01227b7d5e772f0f1dc061a62fdcd Mon Sep 17 00:00:00 2001
From: Vadim Hirbu <vadim.hirbu@wearepropeople.com>
Date: Wed, 5 Nov 2014 14:29:04 +0200
Subject: [PATCH 4/4] Remove whitespaces.

---
 core/lib/Drupal/Core/Updater/Theme.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/lib/Drupal/Core/Updater/Theme.php b/core/lib/Drupal/Core/Updater/Theme.php
index c717c41..ea853c8 100644
--- a/core/lib/Drupal/Core/Updater/Theme.php
+++ b/core/lib/Drupal/Core/Updater/Theme.php
@@ -76,7 +76,7 @@ public static function canUpdate($project_name) {
   public function postInstall() {
     // Update the theme info.
     clearstatcache();
-	\Drupal::service('theme_handler')->rebuildThemeData();
+    \Drupal::service('theme_handler')->rebuildThemeData();
   }
 
   /**
