From cd29abbe05d2c6978bffd49ec889b5d00fddeb14 Mon Sep 17 00:00:00 2001
From: Max Petyurenko <drupalrv@gmail.com>
Date: Sat, 20 Jul 2013 12:37:10 +0300
Subject: [PATCH] Issue #2045919, by benjy: replace module_implements() calls

---
 core/includes/bootstrap.inc                                  |  2 +-
 core/includes/common.inc                                     |  4 ++--
 core/includes/menu.inc                                       |  4 ++--
 core/includes/schema.inc                                     |  2 +-
 core/includes/theme.inc                                      |  2 +-
 .../Drupal/Core/Config/Entity/ConfigStorageController.php    |  2 +-
 core/lib/Drupal/Core/Entity/DatabaseStorageController.php    |  2 +-
 core/modules/block/block.module                              |  2 +-
 .../Plugin/entity_reference/selection/CommentSelection.php   |  2 +-
 core/modules/field/field.attach.inc                          | 10 +++++-----
 core/modules/field/field.crud.inc                            |  2 +-
 core/modules/field/field.info.inc                            |  2 +-
 core/modules/field/field.module                              |  4 ++--
 core/modules/file/file.module                                |  2 +-
 core/modules/help/help.module                                |  2 +-
 core/modules/help/lib/Drupal/help/Tests/HelpTest.php         |  2 +-
 core/modules/image/image.module                              |  2 +-
 core/modules/node/lib/Drupal/node/NodeFormController.php     |  4 ++--
 core/modules/node/lib/Drupal/node/NodeStorageController.php  |  2 +-
 .../node/Plugin/entity_reference/selection/NodeSelection.php |  2 +-
 core/modules/node/node.module                                | 12 ++++++------
 core/modules/rdf/rdf.module                                  |  2 +-
 core/modules/search/search.module                            |  4 ++--
 .../lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php   | 10 +++++-----
 .../system/lib/Drupal/system/Tests/Theme/ThemeTest.php       |  2 +-
 .../lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php    |  2 +-
 .../lib/Drupal/system/Tests/Theme/TwigSettingsTest.php       |  2 +-
 .../user/lib/Drupal/user/Plugin/views/access/Permission.php  |  2 +-
 core/modules/user/user.admin.inc                             |  2 +-
 core/modules/user/user.module                                |  2 +-
 30 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 9daa71a..f1931ef 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1579,7 +1579,7 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG
     }

     // Call the logging hooks to log/process the message
-    foreach (module_implements('watchdog') as $module) {
+    foreach (Drupal::moduleHandler()->getImplementations('watchdog') as $module) {
       $function = $module . '_watchdog';
       $function($log_entry);
     }
diff --git a/core/includes/common.inc b/core/includes/common.inc
index a4805c0..145692d 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3247,7 +3247,7 @@ function drupal_cron_run() {
     }

     // Iterate through the modules calling their cron handlers (if any):
-    foreach (module_implements('cron') as $module) {
+    foreach (Drupal::moduleHandler()->getImplementations('cron') as $module) {
       // Do not let an exception thrown by one module disturb another.
       try {
         module_invoke($module, 'cron');
@@ -3637,7 +3637,7 @@ function drupal_render_page($page) {
   }

   // Modules can add elements to $page as needed in hook_page_build().
-  foreach (module_implements('page_build') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('page_build') as $module) {
     $function = $module . '_page_build';
     $function($page);
   }
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index 08c7aff..c64e58e 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1746,7 +1746,7 @@ function menu_get_active_help() {

   $arg = drupal_help_arg(arg(NULL));

-  foreach (module_implements('help') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('help') as $module) {
     $function = $module . '_help';
     // Lookup help for this path.
     if ($help = $function($router_path, $arg)) {
@@ -2753,7 +2753,7 @@ function menu_router_build($save = FALSE) {
   // We need to manually call each module so that we can know which module
   // a given item came from.
   $callbacks = array();
-  foreach (module_implements('menu') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('menu') as $module) {
     $router_items = call_user_func($module . '_menu');
     if (isset($router_items) && is_array($router_items)) {
       foreach (array_keys($router_items) as $path) {
diff --git a/core/includes/schema.inc b/core/includes/schema.inc
index 77faade..ac0ffad 100644
--- a/core/includes/schema.inc
+++ b/core/includes/schema.inc
@@ -81,7 +81,7 @@ function drupal_get_complete_schema($rebuild = FALSE) {

       require_once __DIR__ . '/common.inc';
       // Invoke hook_schema for all modules.
-      foreach (module_implements('schema') as $module) {
+      foreach (Drupal::moduleHandler()->getImplementations('schema') as $module) {
         // Cast the result of hook_schema() to an array, as a NULL return value
         // would cause array_merge() to set the $schema variable to NULL as well.
         // That would break modules which use $schema further down the line.
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 7bff76e..67f6d6d 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -622,7 +622,7 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) {
     $cache = $cached->data;
   }
   else {
-    foreach (module_implements('theme') as $module) {
+    foreach (Drupal::moduleHandler()->getImplementations('theme') as $module) {
       _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
     }
     // Only cache this registry if all modules are loaded.
diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
index 7fe3c49..d81ac64 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
@@ -293,7 +293,7 @@ protected function buildQuery($ids, $revision_id = FALSE) {
    */
   protected function attachLoad(&$queried_entities, $revision_id = FALSE) {
     // Call hook_entity_load().
-    foreach (module_implements('entity_load') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) {
       $function = $module . '_entity_load';
       $function($queried_entities, $this->entityType);
     }
diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
index e2dc1b4..f22f976 100644
--- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
+++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php
@@ -346,7 +346,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
     }

     // Call hook_entity_load().
-    foreach (module_implements('entity_load') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) {
       $function = $module . '_entity_load';
       $function($queried_entities, $this->entityType);
     }
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index cfbad28..0f481ad 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -290,7 +290,7 @@ function _block_get_renderable_region($list = array()) {
   // chances of having unwanted output get in the cache and later be served
   // to other users. We therefore exclude user 1 from block caching.
   $not_cacheable = $GLOBALS['user']->id() == 1 ||
-    count(module_implements('node_grants')) ||
+    count(Drupal::moduleHandler()->getImplementations('node_grants')) ||
     !\Drupal::request()->isMethodSafe();

   foreach ($list as $key => $block) {
diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php b/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php
index 2c3aada..fff8d59 100644
--- a/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php
+++ b/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php
@@ -73,7 +73,7 @@ public function entityQueryAlter(SelectInterface $query) {
     // Passing the query to node_query_node_access_alter() is sadly
     // insufficient for nodes.
     // @see SelectionEntityTypeNode::entityQueryAlter()
-    if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
+    if (!user_access('bypass node access') && !count(\Drupal::moduleHandler()->getImplementations('node_grants'))) {
       $query->condition($node_alias . '.status', 1);
     }
   }
diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc
index 5ed17ff..2f802aa 100644
--- a/core/modules/field/field.attach.inc
+++ b/core/modules/field/field.attach.inc
@@ -531,7 +531,7 @@ function field_attach_form(EntityInterface $entity, &$form, &$form_state, $langc

   // Let other modules make changes to the form.
   // Avoid module_invoke_all() to let parameters be taken by reference.
-  foreach (module_implements('field_attach_form') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('field_attach_form') as $module) {
     $function = $module . '_field_attach_form';
     $function($entity, $form, $form_state, $langcode);
   }
@@ -633,7 +633,7 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $
     // Invoke hook_field_storage_pre_load(): let any module load field
     // data before the storage engine, accumulating along the way.
     $skip_fields = array();
-    foreach (module_implements('field_storage_pre_load') as $module) {
+    foreach (Drupal::moduleHandler()->getImplementations('field_storage_pre_load') as $module) {
       $function = $module . '_field_storage_pre_load';
       $function($entity_type, $queried_entities, $age, $skip_fields, $hook_options);
     }
@@ -834,7 +834,7 @@ function field_attach_extract_form_values(EntityInterface $entity, $form, &$form

   // Let other modules act on submitting the entity.
   // Avoid module_invoke_all() to let $form_state be taken by reference.
-  foreach (module_implements('field_attach_extract_form_values') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('field_attach_extract_form_values') as $module) {
     $function = $module . 'field_attach_extract_form_values';
     $function($entity, $form, $form_state);
   }
@@ -863,7 +863,7 @@ function field_attach_insert(EntityInterface $entity) {
   // Let any module insert field data before the storage engine, accumulating
   // saved fields along the way.
   $skip_fields = array();
-  foreach (module_implements('field_storage_pre_insert') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('field_storage_pre_insert') as $module) {
     $function = $module . '_field_storage_pre_insert';
     $function($entity, $skip_fields);
   }
@@ -904,7 +904,7 @@ function field_attach_update(EntityInterface $entity) {
   // Let any module update field data before the storage engine, accumulating
   // saved fields along the way.
   $skip_fields = array();
-  foreach (module_implements('field_storage_pre_update') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('field_storage_pre_update') as $module) {
     $function = $module . '_field_storage_pre_update';
     $function($entity, $skip_fields);
   }
diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc
index ed129df..66e0e4a 100644
--- a/core/modules/field/field.crud.inc
+++ b/core/modules/field/field.crud.inc
@@ -323,7 +323,7 @@ function field_purge_data(EntityInterface $entity, $field, $instance) {
   module_invoke($field['storage']['module'], 'field_storage_purge', $entity, $field, $instance);

   // Let other modules act on purging the data.
-  foreach (module_implements('field_attach_purge') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('field_attach_purge') as $module) {
     $function = $module . '_field_attach_purge';
     $function($entity, $field, $instance);
   }
diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc
index b6b2a95..6058fcf 100644
--- a/core/modules/field/field.info.inc
+++ b/core/modules/field/field.info.inc
@@ -83,7 +83,7 @@ function _field_info_collate_types() {
       );

       // Populate storage types.
-      foreach (module_implements('field_storage_info') as $module) {
+      foreach (Drupal::moduleHandler()->getImplementations('field_storage_info') as $module) {
         $storage_types = (array) module_invoke($module, 'field_storage_info');
         foreach ($storage_types as $name => $storage_info) {
           // Provide defaults.
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 92a2c45..c1ff581 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -145,7 +145,7 @@ function field_help($path, $arg) {
       // order by displayed module name (module names are not translated).
       $items = array();
       $info = system_get_info('module');
-      $modules = array_merge(module_implements('field_info'), module_implements('field_widget_info'));
+      $modules = array_merge(Drupal::moduleHandler()->getImplementations('field_info'), Drupal::moduleHandler()->getImplementations('field_widget_info'));
       $modules = array_unique($modules);
       sort($modules);
       foreach ($modules as $module) {
@@ -882,7 +882,7 @@ function field_access($op, FieldInterface $field, $entity_type, $entity = NULL,
     $account = $user;
   }

-  foreach (module_implements('field_access') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('field_access') as $module) {
     $function = $module . '_field_access';
     $access = $function($op, $field, $entity_type, $entity, $account);
     if ($access === FALSE) {
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 0d66adb..7071f9b 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -660,7 +660,7 @@ function file_file_download($uri, $field_type = 'file') {
         // Invoke hook and collect grants/denies for download access.
         // Default to FALSE and let entities overrule this ruling.
         $grants = array('system' => FALSE);
-        foreach (module_implements('file_download_access') as $module) {
+        foreach (Drupal::moduleHandler()->getImplementations('file_download_access') as $module) {
           $grants = array_merge($grants, array($module => module_invoke($module, 'file_download_access', $field, $entity, $file)));
         }
         // Allow other modules to alter the returned grants/denies.
diff --git a/core/modules/help/help.module b/core/modules/help/help.module
index 75c15ab..36821c0 100644
--- a/core/modules/help/help.module
+++ b/core/modules/help/help.module
@@ -16,7 +16,7 @@ function help_menu() {
     'weight' => 9,
   );

-  $modules = module_implements('help');
+  $modules = Drupal::moduleHandler()->getImplementations('help');
   ksort($modules);
   foreach ($modules as $module) {
     $items['admin/help/' . $module] = array(
diff --git a/core/modules/help/lib/Drupal/help/Tests/HelpTest.php b/core/modules/help/lib/Drupal/help/Tests/HelpTest.php
index 5a40fa0..2e94f5d 100644
--- a/core/modules/help/lib/Drupal/help/Tests/HelpTest.php
+++ b/core/modules/help/lib/Drupal/help/Tests/HelpTest.php
@@ -108,7 +108,7 @@ protected function verifyHelp($response = 200) {
   protected function getModuleList() {
     $modules = array();
     $module_data = system_rebuild_module_data();
-    foreach (module_implements('help') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('help') as $module) {
       $modules[$module] = $module_data[$module]->info['name'];
     }
     return $modules;
diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 4e786bd..84634f3 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -442,7 +442,7 @@ function image_effect_definitions() {
     else {
       $effects = array();
       include_once __DIR__ . '/image.effects.inc';
-      foreach (module_implements('image_effect_info') as $module) {
+      foreach (Drupal::moduleHandler()->getImplementations('image_effect_info') as $module) {
         foreach (module_invoke($module, 'image_effect_info') as $name => $effect) {
           // Ensure the current toolkit supports the effect.
           $effect['module'] = $module;
diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php
index 814d937..1678e5b 100644
--- a/core/modules/node/lib/Drupal/node/NodeFormController.php
+++ b/core/modules/node/lib/Drupal/node/NodeFormController.php
@@ -349,7 +349,7 @@ public function validate(array $form, array &$form_state) {
     // Invoke hook_node_validate() for validation needed by modules.
     // Can't use module_invoke_all(), because $form_state must
     // be receivable by reference.
-    foreach (module_implements('node_validate') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('node_validate') as $module) {
       $function = $module . '_node_validate';
       $function($node, $form, $form_state);
     }
@@ -376,7 +376,7 @@ public function submit(array $form, array &$form_state) {
     }

     node_submit($node);
-    foreach (module_implements('node_submit') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('node_submit') as $module) {
       $function = $module . '_node_submit';
       $function($node, $form, $form_state);
     }
diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php
index c3ccc3c..6800cb0 100644
--- a/core/modules/node/lib/Drupal/node/NodeStorageController.php
+++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php
@@ -58,7 +58,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) {
     $this->hookLoadArguments = array($argument);

     // Call hook_entity_load().
-    foreach (module_implements('entity_load') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) {
       $function = $module . '_entity_load';
       $function($queried_entities, $this->entityType);
     }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php b/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php
index 04a61bd..5a087a8 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/entity_reference/selection/NodeSelection.php
@@ -34,7 +34,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
     // 'unpublished'. We need to do that as long as there are no access control
     // modules in use on the site. As long as one access control module is there,
     // it is supposed to handle this check.
-    if (!user_access('bypass node access') && !count(module_implements('node_grants'))) {
+    if (!user_access('bypass node access') && !count(\Drupal::moduleHandler()->getImplementations('node_grants'))) {
       $query->condition('status', NODE_PUBLISHED);
     }
     return $query;
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 45f19c7..d6382f4 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -2227,7 +2227,7 @@ function node_access_view_all_nodes($account = NULL) {
   }

   // If no modules implement the node access system, access is always TRUE.
-  if (!module_implements('node_grants')) {
+  if (!Drupal::moduleHandler()->getImplementations('node_grants')) {
     $access[$account->id()] = TRUE;
   }
   else {
@@ -2274,7 +2274,7 @@ function node_query_node_access_alter(AlterableInterface $query) {
   if (user_access('bypass node access', $account)) {
     return;
   }
-  if (!count(module_implements('node_grants'))) {
+  if (!count(Drupal::moduleHandler()->getImplementations('node_grants'))) {
     return;
   }
   if ($op == 'view' && node_access_view_all_nodes($account)) {
@@ -2363,7 +2363,7 @@ function node_access_rebuild($batch_mode = FALSE) {
   $access_controller = Drupal::entityManager()->getAccessController('node');
   $access_controller->deleteGrants();
   // Only recalculate if the site is using a node_access module.
-  if (count(module_implements('node_grants'))) {
+  if (count(Drupal::moduleHandler()->getImplementations('node_grants'))) {
     if ($batch_mode) {
       $batch = array(
         'title' => t('Rebuilding content access permissions'),
@@ -2481,7 +2481,7 @@ function node_requirements($phase) {
     // in the {node_access} table, or if there are modules that
     // implement hook_node_grants().
     $grant_count = Drupal::entityManager()->getAccessController('node')->countGrants();
-    if ($grant_count != 1 || count(module_implements('node_grants')) > 0) {
+    if ($grant_count != 1 || count(Drupal::moduleHandler()->getImplementations('node_grants')) > 0) {
       $value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count));
     }
     else {
@@ -2504,7 +2504,7 @@ function node_requirements($phase) {
 function node_modules_enabled($modules) {
   // Check if any of the newly enabled modules require the node_access table to
   // be rebuilt.
-  if (!node_access_needs_rebuild() && array_intersect($modules, module_implements('node_grants'))) {
+  if (!node_access_needs_rebuild() && array_intersect($modules, Drupal::moduleHandler()->getImplementations('node_grants'))) {
     node_access_needs_rebuild(TRUE);
   }
 }
@@ -2528,7 +2528,7 @@ function node_modules_disabled($modules) {

   // If there remains no more node_access module, rebuilding will be
   // straightforward, we can do it right now.
-  if (node_access_needs_rebuild() && count(module_implements('node_grants')) == 0) {
+  if (node_access_needs_rebuild() && count(Drupal::moduleHandler()->getImplementations('node_grants')) == 0) {
     node_access_rebuild();
   }
 }
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 3c9bac3..0e86d0d 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -110,7 +110,7 @@ function rdf_get_namespaces() {
   $namespaces = array();
   // In order to resolve duplicate namespaces by using the earliest defined
   // namespace, do not use module_invoke_all().
-  foreach (module_implements('rdf_namespaces') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('rdf_namespaces') as $module) {
     $function = $module . '_rdf_namespaces';
     if (function_exists($function)) {
       $namespaces = NestedArray::mergeDeep($function(), $namespaces);
diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index fce4630..f58b279 100644
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -238,7 +238,7 @@ function search_get_info($all = FALSE) {
   $search_hooks = &drupal_static(__FUNCTION__);

   if (!isset($search_hooks)) {
-    foreach (module_implements('search_info') as $module) {
+    foreach (Drupal::moduleHandler()->getImplementations('search_info') as $module) {
       $search_hooks[$module] = call_user_func($module . '_search_info');
       // Use module name as the default value.
       $search_hooks[$module] += array('title' => $module, 'path' => $module);
@@ -537,7 +537,7 @@ function _search_index_truncate(&$text) {
  * Invokes hook_search_preprocess() in modules.
  */
 function search_invoke_preprocess(&$text, $langcode = NULL) {
-  foreach (module_implements('search_preprocess') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('search_preprocess') as $module) {
     $text = module_invoke($module, 'search_preprocess', $text, $langcode);
   }
 }
diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
index 58da4c3..cdf7651 100644
--- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
+++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php
@@ -40,7 +40,7 @@ function testSetUp() {
     $this->assertTrue(function_exists('entity_test_permission'), "$module.module was loaded.");
     // Verify that there is a fixed module list.
     $this->assertIdentical(array_keys(\Drupal::moduleHandler()->getModuleList()), array($module));
-    $this->assertIdentical(module_implements('permission'), array($module));
+    $this->assertIdentical(\Drupal::moduleHandler()->getImplementations('permission'), array($module));

     // Verify that no modules have been installed.
     $this->assertFalse(db_table_exists($table), "'$table' database table not found.");
@@ -56,7 +56,7 @@ function testEnableModulesLoad() {
     $this->assertFalse(module_exists($module), "$module module not found.");
     $list = array_keys(\Drupal::moduleHandler()->getModuleList());
     $this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list.");
-    $list = module_implements('permission');
+    $list = \Drupal::moduleHandler()->getImplementations('permission');
     $this->assertFalse(in_array($module, $list), "{$module}_permission() in module_implements() not found.");

     // Enable the module.
@@ -66,7 +66,7 @@ function testEnableModulesLoad() {
     $this->assertTrue(module_exists($module), "$module module found.");
     $list = array_keys(\Drupal::moduleHandler()->getModuleList());
     $this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list.");
-    $list = module_implements('permission');
+    $list = \Drupal::moduleHandler()->getImplementations('permission');
     $this->assertTrue(in_array($module, $list), "{$module}_permission() in module_implements() found.");
   }

@@ -81,7 +81,7 @@ function testEnableModulesInstall() {
     $this->assertFalse(module_exists($module), "$module module not found.");
     $list = array_keys(\Drupal::moduleHandler()->getModuleList());
     $this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list.");
-    $list = module_implements('permission');
+    $list = \Drupal::moduleHandler()->getImplementations('permission');
     $this->assertFalse(in_array($module, $list), "{$module}_permission() in module_implements() not found.");

     $this->assertFalse(db_table_exists($table), "'$table' database table not found.");
@@ -95,7 +95,7 @@ function testEnableModulesInstall() {
     $this->assertTrue(module_exists($module), "$module module found.");
     $list = array_keys(\Drupal::moduleHandler()->getModuleList());
     $this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list.");
-    $list = module_implements('permission');
+    $list = \Drupal::moduleHandler()->getImplementations('permission');
     $this->assertTrue(in_array($module, $list), "{$module}_permission() in module_implements() found.");

     $this->assertTrue(db_table_exists($table), "'$table' database table found.");
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 f10d83d..e9173b4 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php
@@ -258,7 +258,7 @@ public function testFindThemeTemplates() {
     $cache = array();

     // Prime the theme cache.
-    foreach (module_implements('theme') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) {
       _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
     }

diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php
index 38e183b..34675f7 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigDebugMarkupTest.php
@@ -43,7 +43,7 @@ function testTwigDebugMarkup() {

     $cache = array();
     // Prime the theme cache.
-    foreach (module_implements('theme') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) {
       _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
     }
     // Create array of Twig templates.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php
index f50f110..a764dc9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Theme/TwigSettingsTest.php
@@ -84,7 +84,7 @@ function testTwigCacheOverride() {

     $cache = array();
     // Prime the theme cache.
-    foreach (module_implements('theme') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) {
       _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module));
     }

diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/access/Permission.php b/core/modules/user/lib/Drupal/user/Plugin/views/access/Permission.php
index 0f4a387..d4e2933 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/access/Permission.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/access/Permission.php
@@ -68,7 +68,7 @@ public function buildOptionsForm(&$form, &$form_state) {
     $module_info = system_get_info('module');

     // Get list of permissions
-    foreach (module_implements('permission') as $module) {
+    foreach (\Drupal::moduleHandler()->getImplementations('permission') as $module) {
       $permissions = module_invoke($module, 'permission');
       foreach ($permissions as $name => $perm) {
         $perms[$module_info[$module]['name']][$name] = strip_tags($perm['title']);
diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index 58063e8..d802130 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -125,7 +125,7 @@ function user_admin_permissions($form, $form_state, $rid = NULL) {
   // Get a list of all the modules implementing a hook_permission() and sort by
   // display name.
   $modules = array();
-  foreach (module_implements('permission') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('permission') as $module) {
     $modules[$module] = $module_info[$module]['name'];
   }
   asort($modules);
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index 68cf77e..3095ef2 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -1651,7 +1651,7 @@ function user_role_load($rid) {
  */
 function user_permission_get_modules() {
   $permissions = array();
-  foreach (module_implements('permission') as $module) {
+  foreach (Drupal::moduleHandler()->getImplementations('permission') as $module) {
     $perms = module_invoke($module, 'permission');
     foreach ($perms as $key => $value) {
       $permissions[$key] = $module;
--
1.8.3.msysgit.0

