diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc
index c07d44add68bae56354af4616ca6ee27681bc78e..b0b774663a77aaa3ced16c61461e74255b6af0b6 100644
--- a/core/includes/ajax.inc
+++ b/core/includes/ajax.inc
@@ -251,7 +251,7 @@ function ajax_render($commands = array()) {
     else {
       $function = '_drupal_add_' . $type;
       $items[$type] = $function();
-      drupal_alter($type, $items[$type]);
+      \Drupal::moduleHandler()->alter($type, $items[$type]);
       // @todo Inline CSS and JS items are indexed numerically. These can't be
       //   reliably diffed with array_diff_key(), since the number can change
       //   due to factors unrelated to the inline content, so for now, we strip
@@ -301,7 +301,7 @@ function ajax_render($commands = array()) {
   }
 
   // Allow modules to alter any Ajax response.
-  drupal_alter('ajax_render', $commands);
+  \Drupal::moduleHandler()->alter('ajax_render', $commands);
 
   return Json::encode($commands);
 }
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index e62c07d762c50124ec16f4abdc0e7ad9d1b73268..41edd3d349272793f1755a641b27fb8f37785fed 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1896,13 +1896,13 @@ function module_invoke($module, $hook) {
 /**
  * Invokes a hook in all enabled modules that implement it.
  *
- * All arguments are passed by value. Use drupal_alter() if you need to pass
- * arguments by reference.
+ * All arguments are passed by value. Use \Drupal::moduleHandler()->alter() if
+ * you need to pass arguments by reference.
  *
  * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
  *   Use \Drupal::moduleHandler()->invokeAll($hook).
  *
- * @see drupal_alter()
+ * @see \Drupal\Core\Extension\ModuleHandler::alter()
  * @see \Drupal\Core\Extension\ModuleHandler::invokeAll()
  */
 function module_invoke_all($hook) {
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 43201d8426e21cad76741e3cc31395b806a7f370..eb6621e9c8361df026e300c6b70db5b9d861eb26 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -358,7 +358,7 @@ function _drupal_default_html_head() {
   */
 function drupal_get_html_head() {
   $elements = drupal_add_html_head();
-  drupal_alter('html_head', $elements);
+  \Drupal::moduleHandler()->alter('html_head', $elements);
   return drupal_render($elements);
 }
 
@@ -1621,9 +1621,9 @@ function _drupal_add_css($data = NULL, $options = NULL) {
  *   (optional) An array of CSS files. If no array is provided, the default
  *   stylesheets array is used instead.
  * @param $skip_alter
- *   (optional) If set to TRUE, this function skips calling drupal_alter() on
- *   $css, useful when the calling function passes a $css array that has already
- *   been altered.
+ *   (optional) If set to TRUE, this function skips calling
+ *   \Drupal::moduleHandler->alter() on $css, useful when the calling function
+ *   passes a $css array that has already been altered.
  *
  * @return
  *   A string of XHTML CSS tags.
@@ -1639,7 +1639,7 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) {
 
   // Allow modules and themes to alter the CSS items.
   if (!$skip_alter) {
-    drupal_alter('css', $css);
+    \Drupal::moduleHandler()->alter('css', $css);
   }
 
   // Sort CSS items, so that they appear in the correct order.
@@ -2252,9 +2252,9 @@ function drupal_js_defaults($data = NULL) {
  *   (optional) An array with all JavaScript code. Defaults to the default
  *   JavaScript array for the given scope.
  * @param bool $skip_alter
- *   (optional) If set to TRUE, this function skips calling drupal_alter() on
- *   $javascript, useful when the calling function passes a $javascript array
- *   that has already been altered.
+ *   (optional) If set to TRUE, this function skips calling
+ *   \Drupal::moduleHandler->alter() on $javascript, useful when the calling
+ *   function passes a $javascript array that has already been altered.
  * @param bool $is_ajax
  *   (optional) If set to TRUE, this function is called from an Ajax request and
  *   adds javascript settings to update ajaxPageState values.
@@ -2276,7 +2276,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
 
   // Allow modules to alter the JavaScript.
   if (!$skip_alter) {
-    drupal_alter('js', $javascript);
+    \Drupal::moduleHandler()->alter('js', $javascript);
   }
 
   // Filter out elements of the given scope.
@@ -2722,7 +2722,7 @@ function drupal_add_library($module, $name, $every_page = NULL) {
     if ($library = drupal_get_library($module, $name)) {
       // Allow modules and themes to dynamically attach request and context
       // specific data for this library; e.g., localization.
-      drupal_alter('library', $library, $module, $name);
+      \Drupal::moduleHandler()->alter('library', $library, $module, $name);
 
       // Add all components within the library.
       $elements['#attached'] = array(
@@ -2816,7 +2816,7 @@ function drupal_get_library($extension, $name = NULL) {
         throw new \RuntimeException(sprintf('Invalid library definition in %s: %s', $library_file, $e->getMessage()), 0, $e);
       }
       // Allow modules to alter the module's registered libraries.
-      drupal_alter('library_info', $libraries[$extension], $extension);
+      \Drupal::moduleHandler()->alter('library_info', $libraries[$extension], $extension);
     }
 
     foreach ($libraries[$extension] as $id => &$library) {
@@ -3705,7 +3705,7 @@ function drupal_prepare_page($page) {
   }
   // Modules alter the $page as needed. Blocks are populated into regions like
   // 'sidebar_first', 'footer', etc.
-  drupal_alter('page', $page);
+  \Drupal::moduleHandler()->alter('page', $page);
 
   // The "main" and "secondary" menus are never part of the page-level render
   // array and therefore their cache tags will never bubble up into the page
@@ -4713,7 +4713,7 @@ function element_info($type) {
       $cache[$element_type]['#type'] = $element_type;
     }
     // Allow modules to alter the element type defaults.
-    drupal_alter('element_info', $cache);
+    \Drupal::moduleHandler()->alter('element_info', $cache);
   }
 
   return isset($cache[$type]) ? $cache[$type] : array();
@@ -5154,7 +5154,7 @@ function drupal_get_updaters() {
   $updaters = &drupal_static(__FUNCTION__);
   if (!isset($updaters)) {
     $updaters = \Drupal::moduleHandler()->invokeAll('updater_info');
-    drupal_alter('updater_info', $updaters);
+    \Drupal::moduleHandler()->alter('updater_info', $updaters);
     uasort($updaters, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement'));
   }
   return $updaters;
@@ -5174,7 +5174,7 @@ function drupal_get_filetransfer_info() {
   $info = &drupal_static(__FUNCTION__);
   if (!isset($info)) {
     $info = \Drupal::moduleHandler()->invokeAll('filetransfer_info');
-    drupal_alter('filetransfer_info', $info);
+    \Drupal::moduleHandler()->alter('filetransfer_info', $info);
     uasort($info, array('Drupal\Component\Utility\SortArray', 'sortByWeightElement'));
   }
   return $info;
diff --git a/core/includes/entity.inc b/core/includes/entity.inc
index 9e939902dbaad9ec68319a985b4912018f0b0fa2..0ade970ba5f565b65f82e741a379f1eb61a28c1f 100644
--- a/core/includes/entity.inc
+++ b/core/includes/entity.inc
@@ -103,7 +103,7 @@ function entity_get_form_modes($entity_type = NULL) {
         list($form_mode_entity_type, $form_mode_name) = explode('.', $form_mode->id(), 2);
         $form_modes[$form_mode_entity_type][$form_mode_name] = (array) $form_mode;
       }
-      drupal_alter('entity_form_mode_info', $form_modes);
+      \Drupal::moduleHandler()->alter('entity_form_mode_info', $form_modes);
       \Drupal::cache()->set("entity_form_mode_info:$langcode", $form_modes, Cache::PERMANENT, array('entity_types' => TRUE));
     }
   }
@@ -141,7 +141,7 @@ function entity_get_view_modes($entity_type = NULL) {
         list($view_mode_entity_type, $view_mode_name) = explode('.', $view_mode->id(), 2);
         $view_modes[$view_mode_entity_type][$view_mode_name] = (array) $view_mode;
       }
-      drupal_alter('entity_view_mode_info', $view_modes);
+      \Drupal::moduleHandler()->alter('entity_view_mode_info', $view_modes);
       \Drupal::cache()->set("entity_view_mode_info:$langcode", $view_modes, Cache::PERMANENT, array('entity_types' => TRUE));
     }
   }
diff --git a/core/includes/file.inc b/core/includes/file.inc
index 83e6dc9df218860b475818ad00dd50a77bc47e55..abf5a9bab5d8bdd483cd699a4c2ad278d7ece7e4 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -448,7 +448,7 @@ function file_stream_wrapper_get_instance_by_scheme($scheme) {
 function file_create_url($uri) {
   // Allow the URI to be altered, e.g. to serve a file from a CDN or static
   // file server.
-  drupal_alter('file_url', $uri);
+  \Drupal::moduleHandler()->alter('file_url', $uri);
 
   $scheme = file_uri_scheme($uri);
 
diff --git a/core/includes/file.mimetypes.inc b/core/includes/file.mimetypes.inc
index 5a16158718d9985619815613df621c35e4c1d09e..b6bd404ea9a297337ad1a9af85ab33c78a17992c 100644
--- a/core/includes/file.mimetypes.inc
+++ b/core/includes/file.mimetypes.inc
@@ -20,7 +20,7 @@ function file_mimetype_mapping() {
   if (!isset($mapping)) {
     $mapping = file_default_mimetype_mapping();
     // Allow modules to alter the default mapping.
-    drupal_alter('file_mimetype_mapping', $mapping);
+    \Drupal::moduleHandler()->alter('file_mimetype_mapping', $mapping);
   }
   return $mapping;
 }
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 96eb0d005e931a4546975c6d9c962c63fec089c4..b5a22a474a4ee5c4b077a45af02bbd438e107a82 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -3257,7 +3257,7 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = NU
     // The batch is now completely built. Allow other modules to make changes
     // to the batch so that it is easier to reuse batch processes in other
     // environments.
-    drupal_alter('batch', $batch);
+    \Drupal::moduleHandler()->alter('batch', $batch);
 
     // Assign an arbitrary id: don't rely on a serial column in the 'batch'
     // table, since non-progressive batches skip database storage completely.
diff --git a/core/includes/mail.inc b/core/includes/mail.inc
index 0209bd501f74af9ab934531b37b0716ce83f0eae..6ddff9789a44d2bfcf99f902c2994a3baa2e9014 100644
--- a/core/includes/mail.inc
+++ b/core/includes/mail.inc
@@ -162,7 +162,7 @@ function drupal_mail($module, $key, $to, $langcode, $params = array(), $reply =
   }
 
   // Invoke hook_mail_alter() to allow all modules to alter the resulting e-mail.
-  drupal_alter('mail', $message);
+  \Drupal::moduleHandler()->alter('mail', $message);
 
   // Retrieve the responsible implementation for this message.
   $system = drupal_mail_system($module, $key);
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index c4916411e5f8497ed73e18309726a0a1dbacb88e..f77bc238342d0bebdfddaa7bcbeba024baa857b3 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -485,7 +485,7 @@ function menu_get_item($path = NULL, $router_item = NULL) {
     if ($router_item) {
       // Allow modules to alter the router item before it is translated and
       // checked for access.
-      drupal_alter('menu_get_item', $router_item, $path, $original_map);
+      \Drupal::moduleHandler()->alter('menu_get_item', $router_item, $path, $original_map);
 
       $map = _menu_translate($router_item, $original_map);
       $router_item['original_map'] = $original_map;
@@ -903,7 +903,7 @@ function _menu_link_translate(&$item) {
   // options array. For performance reasons we only invoke this hook if the link
   // has the 'alter' flag set in the options array.
   if (!empty($item['options']['alter'])) {
-    drupal_alter('translated_menu_link', $item, $map);
+    \Drupal::moduleHandler()->alter('translated_menu_link', $item, $map);
   }
 }
 
@@ -2451,7 +2451,7 @@ function menu_router_build($save = FALSE) {
     }
   }
   // Alter the menu as defined in modules, keys are like user/%user.
-  drupal_alter('menu', $callbacks);
+  \Drupal::moduleHandler()->alter('menu', $callbacks);
   \Drupal::configFactory()->setOverrideState($old_state);
   foreach ($callbacks as $path => $router_item) {
     // If the menu item is a default local task and incorrectly references a
diff --git a/core/includes/module.inc b/core/includes/module.inc
index 4c6060445fb7bf75fdaea471e83c5c5f88642ec0..97a69a0871b0a33055f8bea48f38cd9bd857d433 100644
--- a/core/includes/module.inc
+++ b/core/includes/module.inc
@@ -116,8 +116,9 @@ function system_list_reset() {
 
   // Clear the library info cache.
   // Libraries may be provided by all extension types, and may be altered by any
-  // other extensions (types) due to the nature of drupal_alter() and the fact
-  // that profiles are recorded and handled as modules.
+  // other extensions (types) due to the nature of
+  // \Drupal\Core\Extension\ModuleHandler::alter() and the fact that profiles
+  // are recorded and handled as modules.
   Cache::invalidateTags(array('extension' => TRUE));
 
   // Remove last known theme data state.
diff --git a/core/includes/path.inc b/core/includes/path.inc
index 533dcd9a7b679445caf0485fdacb96da5f85eb11..48cf44e72d90e8581a57e45958668a1260fe3be9 100644
--- a/core/includes/path.inc
+++ b/core/includes/path.inc
@@ -160,7 +160,7 @@ function path_get_admin_paths() {
   $patterns = &drupal_static(__FUNCTION__);
   if (!isset($patterns)) {
     $paths = \Drupal::moduleHandler()->invokeAll('admin_paths');
-    drupal_alter('admin_paths', $paths);
+    \Drupal::moduleHandler()->alter('admin_paths', $paths);
     // Combine all admin paths into one array, and likewise for non-admin paths,
     // for easier handling.
     $patterns = array();
diff --git a/core/includes/schema.inc b/core/includes/schema.inc
index c9ee6aee53a79e74d300b75972d2ef964f5cb274..47e7836efed5302710b0c25f2b3c325aaa1214a9 100644
--- a/core/includes/schema.inc
+++ b/core/includes/schema.inc
@@ -86,7 +86,7 @@ function drupal_get_complete_schema($rebuild = FALSE) {
         _drupal_schema_initialize($current, $module);
         $schema = array_merge($schema, $current);
       }
-      drupal_alter('schema', $schema);
+      \Drupal::moduleHandler()->alter('schema', $schema);
 
       if ($rebuild) {
         Cache::deleteTags(array('schema' => TRUE));
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index e91ecf2ddfb43bd518aa3472c482c843372ce6f6..2e7d41e4e6496b6ab3826ee64f36f6ef8e69d479 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2031,7 +2031,7 @@ function _template_preprocess_default_variables() {
   }
 
   // Give modules a chance to alter the default template variables.
-  drupal_alter('template_preprocess_default_variables', $variables);
+  \Drupal::moduleHandler()->alter('template_preprocess_default_variables', $variables);
 
   return $variables;
 }
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index 3d53ea49fd779cac7f4a124ae395cad82e89a25a..ad505a8511c18161dbbc33986f7e05d74b0da2c3 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -75,9 +75,10 @@ function _drupal_maintenance_theme() {
 
   $themes = list_themes();
 
-  // list_themes() triggers a drupal_alter() in maintenance mode, but we can't
-  // let themes alter the .info.yml data until we know a theme's base themes. So
-  // don't set global $theme until after list_themes() builds its cache.
+  // list_themes() triggers a \Drupal\Core\Extension\ModuleHandler::alter() in
+  // maintenance mode, but we can't let themes alter the .info.yml data until
+  // we know a theme's base themes. So don't set global $theme until after
+  // list_themes() builds its cache.
   $theme = $custom_theme;
 
   // Store the identifier for retrieving theme settings with.
diff --git a/core/lib/Drupal/Core/Ajax/AjaxResponse.php b/core/lib/Drupal/Core/Ajax/AjaxResponse.php
index 85cebb96927def58589f3574fb337880927e7b3f..6678e7ac04690d441325249145de59a4b26889a4 100644
--- a/core/lib/Drupal/Core/Ajax/AjaxResponse.php
+++ b/core/lib/Drupal/Core/Ajax/AjaxResponse.php
@@ -106,7 +106,7 @@ protected function ajaxRender(Request $request) {
       else {
         $function = '_drupal_add_' . $type;
         $items[$type] = $function();
-        drupal_alter($type, $items[$type]);
+        \Drupal::moduleHandler()->alter($type, $items[$type]);
         // @todo Inline CSS and JS items are indexed numerically. These can't be
         //   reliably diffed with array_diff_key(), since the number can change
         //   due to factors unrelated to the inline content, so for now, we
@@ -166,7 +166,7 @@ protected function ajaxRender(Request $request) {
     }
 
     $commands = $this->commands;
-    drupal_alter('ajax_render', $commands);
+    \Drupal::moduleHandler()->alter('ajax_render', $commands);
 
     return $commands;
   }
diff --git a/core/lib/Drupal/Core/Database/Query/Select.php b/core/lib/Drupal/Core/Database/Query/Select.php
index 1f5072b2974332448573ade69c785929618506cc..2498ed042318d395246fd681f5d6fd96ef2ec6f1 100644
--- a/core/lib/Drupal/Core/Database/Query/Select.php
+++ b/core/lib/Drupal/Core/Database/Query/Select.php
@@ -391,7 +391,7 @@ public function preExecute(SelectInterface $query = NULL) {
       foreach ($this->alterTags as $tag => $value) {
         $hooks[] = 'query_' . $tag;
       }
-      drupal_alter($hooks, $query);
+      \Drupal::moduleHandler()->alter($hooks, $query);
     }
 
     $this->prepared = TRUE;
diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
index 751f021714736a9b8b9f961d7ed67ffdca1162ba..3ac64415177b51a0a8ba51195c91c0c4086a4f1a 100644
--- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
+++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
@@ -209,7 +209,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
 
       // Allow modules to change the view mode.
       $entity_view_mode = $view_mode;
-      drupal_alter('entity_view_mode', $entity_view_mode, $entity, $context);
+      $this->moduleHandler->alter('entity_view_mode', $entity_view_mode, $entity, $context);
       // Store entities for rendering by view_mode.
       $view_modes[$entity_view_mode][$entity->id()] = $entity;
     }
@@ -248,7 +248,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
       $build[$key]['#weight'] = $weight++;
 
       // Allow modules to modify the render array.
-      drupal_alter(array($view_hook, 'entity_view'), $build[$key], $entity, $display);
+      $this->moduleHandler->alter(array($view_hook, 'entity_view'), $build[$key], $entity, $display);
     }
 
     return $build;
diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php
index 58e5d25eb875124546253bbac76af2f65a347b70..2b9b168b900d39d4340203fbcea444bcbc9ad01c 100644
--- a/core/lib/Drupal/Core/Field/WidgetBase.php
+++ b/core/lib/Drupal/Core/Field/WidgetBase.php
@@ -261,7 +261,7 @@ protected function formSingleElement(FieldItemListInterface $items, $delta, arra
         'delta' => $delta,
         'default' => !empty($entity->field_ui_default_value),
       );
-      drupal_alter(array('field_widget_form', 'field_widget_' . $this->getPluginId() . '_form'), $element, $form_state, $context);
+      \Drupal::moduleHandler()->alter(array('field_widget_form', 'field_widget_' . $this->getPluginId() . '_form'), $element, $form_state, $context);
     }
 
     return $element;
diff --git a/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php b/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php
index 6af4708379f73934c283fc28b387a78b6e2131f4..675b20c72c80f9e57b3c596c1213428a716b48e8 100644
--- a/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php
+++ b/core/lib/Drupal/Core/Transliteration/PHPTransliteration.php
@@ -27,7 +27,7 @@ protected function readLanguageOverrides($langcode) {
     parent::readLanguageOverrides($langcode);
 
     // Let modules alter the language-specific overrides.
-    drupal_alter('transliteration_overrides', $this->languageOverrides[$langcode], $langcode);
+    \Drupal::moduleHandler()->alter('transliteration_overrides', $this->languageOverrides[$langcode], $langcode);
   }
 
 }
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
index 3b5e6cbc093e86b8e8b9ab46dce55046f65c6fc9..5decf40774d6f4fbb0952ffcb0c480cdddf64c2c 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
@@ -405,7 +405,7 @@ public function buildContentsCssJSSetting(EditorEntity $editor) {
       drupal_get_path('module', 'ckeditor') . '/css/ckeditor-iframe.css',
       drupal_get_path('module', 'system') . '/css/system.module.css',
     );
-    drupal_alter('ckeditor_css', $css, $editor);
+    $this->moduleHandler->alter('ckeditor_css', $css, $editor);
     $css = array_merge($css, _ckeditor_theme_css());
     $css = array_map('file_create_url', $css);
 
diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module
index d39343eba6a3f22bb05a17f216b393728397906b..3513f5618a571101f532d3d401b5bc158044c7b4 100644
--- a/core/modules/contextual/contextual.module
+++ b/core/modules/contextual/contextual.module
@@ -222,7 +222,7 @@ function contextual_pre_render_links($element) {
   $element['#links'] = $links;
 
   // Allow modules to alter the renderable contextual links element.
-  drupal_alter('contextual_links_view', $element, $items);
+  \Drupal::moduleHandler()->alter('contextual_links_view', $element, $items);
 
   // If there are no links, tell drupal_render() to abort rendering.
   if (empty($element['#links'])) {
diff --git a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php
index 080b09de9b9937de528d5917f738185ff4ffb2c9..7f3ee11d15577821f0560f0521ee8e7b485c07cf 100644
--- a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php
+++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php
@@ -73,7 +73,7 @@ public function __construct(array $values, $entity_type) {
     // Initialize settings, merging module-provided defaults.
     $default_settings = $plugin->getDefaultSettings();
     $default_settings += \Drupal::moduleHandler()->invokeAll('editor_default_settings', array($this->editor));
-    drupal_alter('editor_default_settings', $default_settings, $this->editor);
+    \Drupal::moduleHandler()->alter('editor_default_settings', $default_settings, $this->editor);
     $this->settings += $default_settings;
   }
 
diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
index eaa74b519f7ea15ffdf151a057bb2eb078158d2c..19b4013ec1265973353b2508be77b965d0506597 100644
--- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
+++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php
@@ -88,7 +88,7 @@ public function getAttachments(array $format_ids) {
     }
 
     // Allow other modules to alter all JavaScript settings.
-    drupal_alter('editor_js_settings', $settings);
+    $this->moduleHandler->alter('editor_js_settings', $settings);
 
     if (empty($attachments['library']) && empty($settings)) {
       return array();
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
index f7b74e4dddcf4fc73c9b42aa4781b57576f49584..9062361e0050f53f816d562a9a47cce1e97eda63 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php
@@ -309,7 +309,7 @@ protected function reAlterQuery(AlterableInterface $query, $tag, $base_table) {
 
     $query->alterTags = array($tag => TRUE);
     $query->alterMetaData['base_table'] = $base_table;
-    drupal_alter(array('query', 'query_' . $tag), $query);
+    \Drupal::moduleHandler()->alter(array('query', 'query_' . $tag), $query);
 
     // Restore the tags and metadata.
     $query->alterTags = $old_tags;
diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc
index c8b3a69da1cd364ffc513aa65cdecf1b020ef325..885134b3c64dbd09c4c57c692f08b4a2a0e1d6bf 100644
--- a/core/modules/field/field.views.inc
+++ b/core/modules/field/field.views.inc
@@ -42,8 +42,8 @@ function field_views_data() {
  *
  * Field modules can implement hook_field_views_data_views_data_alter() to
  * alter the views data on a per field basis. This is weirdly named so as
- * not to conflict with the drupal_alter('field_views_data') in
- * field_views_data.
+ * not to conflict with the \Drupal::moduleHandler()->alter('field_views_data')
+ * in field_views_data.
  */
 function field_views_data_alter(&$data) {
   foreach (field_info_fields() as $field) {
diff --git a/core/modules/field/lib/Drupal/field/FieldInfo.php b/core/modules/field/lib/Drupal/field/FieldInfo.php
index 9b33354f96e341ac91b9d11207ffd164bd2b9085..f68ceedb8d954d6bfdd25dfef3b7ac1eeb20e2e7 100644
--- a/core/modules/field/lib/Drupal/field/FieldInfo.php
+++ b/core/modules/field/lib/Drupal/field/FieldInfo.php
@@ -537,7 +537,7 @@ public function getBundleExtraFields($entity_type, $bundle) {
     // shape of the hook, we have no other way than collecting extra fields on
     // all bundles.
     $extra = $this->moduleHandler->invokeAll('field_extra_fields');
-    drupal_alter('field_extra_fields', $extra);
+    $this->moduleHandler->alter('field_extra_fields', $extra);
     $info = isset($extra[$entity_type][$bundle]) ? $extra[$entity_type][$bundle] : array();
     $info += array('form' => array(), 'display' => array());
 
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
index de4ddd9417f899e48cce5f6d34aeed56001a34d2..a4aea5be769b6fa518b8999c7312c61f47e1367d 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
@@ -7,8 +7,12 @@
 
 namespace Drupal\field_ui;
 
+use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Core\Field\FieldDefinitionInterface;
 use Drupal\Core\Entity\Display\EntityDisplayInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Field\FieldTypePluginManager;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -21,6 +25,30 @@ class DisplayOverview extends DisplayOverviewBase {
    */
   protected $displayContext = 'view';
 
+  /**
+   * Stores the module manager.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * Constructs a new class instance.
+   *
+   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   *   The entity manager.
+   * @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
+   *   The field type manager.
+   * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
+   *   The widget or formatter plugin manager.
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler class to use for invoking hooks.
+   */
+  public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager, ModuleHandlerInterface $module_handler) {
+    parent::__construct($entity_manager, $field_type_manager, $plugin_manager);
+    $this->moduleHandler = $module_handler;
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -28,7 +56,8 @@ public static function create(ContainerInterface $container) {
     return new static(
       $container->get('entity.manager'),
       $container->get('plugin.manager.field.field_type'),
-      $container->get('plugin.manager.field.formatter')
+      $container->get('plugin.manager.field.formatter'),
+      $container->get('module_handler')
     );
   }
 
@@ -204,7 +233,7 @@ protected function alterSettingsForm(array &$settings_form, $plugin, FieldDefini
       'view_mode' => $this->mode,
       'form' => $form,
     );
-    drupal_alter('field_formatter_settings_form', $settings_form, $form_state, $context);
+    $this->moduleHandler->alter('field_formatter_settings_form', $settings_form, $form_state, $context);
   }
 
   /**
@@ -216,7 +245,7 @@ protected function alterSettingsSummary(array &$summary, $plugin, FieldDefinitio
       'field_definition' => $field_definition,
       'view_mode' => $this->mode,
     );
-    drupal_alter('field_formatter_settings_summary', $summary, $context);
+    $this->moduleHandler->alter('field_formatter_settings_summary', $summary, $context);
   }
 
 }
diff --git a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php
index 0b5298170dbe453dadc244dc0fa608f83d9a35eb..1b7fc9e68a2d27433eaeec5a38b4845dd6dfa586 100644
--- a/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php
+++ b/core/modules/field_ui/lib/Drupal/field_ui/FormDisplayOverview.php
@@ -7,8 +7,12 @@
 
 namespace Drupal\field_ui;
 
+use Drupal\Component\Plugin\PluginManagerBase;
 use Drupal\Core\Entity\Display\EntityDisplayInterface;
+use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Field\FieldTypePluginManager;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -21,6 +25,30 @@ class FormDisplayOverview extends DisplayOverviewBase {
    */
   protected $displayContext = 'form';
 
+  /**
+   * Stores the module manager.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * Constructs a new class instance.
+   *
+   * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
+   *   The entity manager.
+   * @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
+   *   The field type manager.
+   * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
+   *   The widget or formatter plugin manager.
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler to use for invoking hooks.
+   */
+  public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManager $field_type_manager, PluginManagerBase $plugin_manager, ModuleHandlerInterface $module_handler) {
+    parent::__construct($entity_manager, $field_type_manager, $plugin_manager);
+    $this->moduleHandler = $module_handler;
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -28,7 +56,8 @@ public static function create(ContainerInterface $container) {
     return new static(
       $container->get('entity.manager'),
       $container->get('plugin.manager.field.field_type'),
-      $container->get('plugin.manager.field.widget')
+      $container->get('plugin.manager.field.widget'),
+      $container->get('module_handler')
     );
   }
 
@@ -156,7 +185,7 @@ protected function alterSettingsForm(array &$settings_form, $plugin, FieldDefini
       'form_mode' => $this->mode,
       'form' => $form,
     );
-    drupal_alter('field_widget_settings_form', $settings_form, $form_state, $context);
+    $this->moduleHandler->alter('field_widget_settings_form', $settings_form, $form_state, $context);
   }
 
   /**
@@ -168,7 +197,7 @@ protected function alterSettingsSummary(array &$summary, $plugin, FieldDefinitio
       'field_definition' => $field_definition,
       'form_mode' => $this->mode,
     );
-    drupal_alter('field_widget_settings_summary', $summary, $context);
+    $this->moduleHandler->alter('field_widget_settings_summary', $summary, $context);
   }
 
 }
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 4d350e7fb3aaa0e1559e40abf37c748e8a0733ca..ed7592fd9963a1ef6f00e7ebf5657b32686cfd1d 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') {
           'field' => $field,
           'file' => $file,
         );
-        drupal_alter('file_download_access', $grants, $context);
+        \Drupal::moduleHandler()->alter('file_download_access', $grants, $context);
 
         if (in_array(TRUE, $grants)) {
           // If TRUE is returned, access is granted and no further checks are
diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc
index 48ba081155b3d31df499ed974bb13446b7283d80..6386dd6513ef31aeb62ae2ad0a7cdf47c06688a8 100644
--- a/core/modules/locale/locale.compare.inc
+++ b/core/modules/locale/locale.compare.inc
@@ -144,7 +144,7 @@ function locale_translation_project_list() {
     $project_info->processInfoList($projects, $theme_data, 'theme', TRUE, $additional_whitelist);
 
     // Allow other modules to alter projects before fetching and comparing.
-    drupal_alter('locale_translation_projects', $projects);
+    \Drupal::moduleHandler()->alter('locale_translation_projects', $projects);
   }
   return $projects;
 }
diff --git a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php
index 0cd54af5812ef4305030f6ea6db22cb0612b6230..78b402b352076296509b342c47da477cdb7d1f92 100644
--- a/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php
+++ b/core/modules/node/lib/Drupal/node/Tests/NodeAccessRecordsTest.php
@@ -79,7 +79,7 @@ function testNodeAccessRecords() {
     foreach ($operations as $op) {
       $grants = node_test_node_grants($op, $web_user);
       $altered_grants = $grants;
-      drupal_alter('node_grants', $altered_grants, $web_user, $op);
+      \Drupal::moduleHandler()->alter('node_grants', $altered_grants, $web_user, $op);
       $this->assertNotEqual($grants, $altered_grants, format_string('Altered the %op grant for a user.', array('%op' => $op)));
     }
 
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index b22d36e149733056f864a5cd2f109b6581468622..28f2dc99851f98ca36c8af18c8c10cfd4978f7ad 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -1547,7 +1547,7 @@ function node_access_grants($op, $account = NULL) {
   // Fetch node access grants from other modules.
   $grants = \Drupal::moduleHandler()->invokeAll('node_grants', array($account, $op));
   // Allow modules to alter the assigned grants.
-  drupal_alter('node_grants', $grants, $account, $op);
+  \Drupal::moduleHandler()->alter('node_grants', $grants, $account, $op);
 
   return array_merge(array('all' => array(0)), $grants);
 }
diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module
index 06a96a13da679814b104710e30a608b20887e8b6..99ca6014795e28bee24f4a079d83705c53b5196a 100644
--- a/core/modules/simpletest/simpletest.module
+++ b/core/modules/simpletest/simpletest.module
@@ -531,7 +531,7 @@ function simpletest_test_get_all($module = NULL) {
       }
 
       // Allow modules extending core tests to disable originals.
-      drupal_alter('simpletest', $groups);
+      \Drupal::moduleHandler()->alter('simpletest', $groups);
       \Drupal::cache()->set($cid, $groups);
     }
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php
index 3f6b30cd12e06c1ff0f312ac8c1df02ff28311aa..e02c590da90d4dfa0b14998ce66e82834cb6054b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/AlterTest.php
@@ -10,7 +10,7 @@
 use Drupal\simpletest\WebTestBase;
 
 /**
- * Tests alteration of arguments passed to drupal_alter().
+ * Tests alteration of arguments passed to \Drupal::moduleHandler->alter().
  */
 class AlterTest extends WebTestBase {
 
@@ -24,7 +24,7 @@ class AlterTest extends WebTestBase {
   public static function getInfo() {
     return array(
       'name' => 'Alter hook functionality',
-      'description' => 'Tests alteration of arguments passed to drupal_alter().',
+      'description' => 'Tests alteration of arguments passed to \Drupal::moduleHandler->alter().',
       'group' => 'Common',
     );
   }
@@ -46,13 +46,13 @@ function testDrupalAlter() {
     // Verify alteration of a single argument.
     $array_copy = $array;
     $array_expected = array('foo' => 'Drupal theme');
-    drupal_alter('drupal_alter', $array_copy);
+    \Drupal::moduleHandler()->alter('drupal_alter', $array_copy);
     $this->assertEqual($array_copy, $array_expected, 'Single array was altered.');
 
     $entity_copy = clone $entity;
     $entity_expected = clone $entity;
     $entity_expected->foo = 'Drupal theme';
-    drupal_alter('drupal_alter', $entity_copy);
+    \Drupal::moduleHandler()->alter('drupal_alter', $entity_copy);
     $this->assertEqual($entity_copy, $entity_expected, 'Single object was altered.');
 
     // Verify alteration of multiple arguments.
@@ -63,17 +63,17 @@ function testDrupalAlter() {
     $entity_expected->foo = 'Drupal theme';
     $array2_copy = $array;
     $array2_expected = array('foo' => 'Drupal theme');
-    drupal_alter('drupal_alter', $array_copy, $entity_copy, $array2_copy);
-    $this->assertEqual($array_copy, $array_expected, 'First argument to drupal_alter() was altered.');
-    $this->assertEqual($entity_copy, $entity_expected, 'Second argument to drupal_alter() was altered.');
-    $this->assertEqual($array2_copy, $array2_expected, 'Third argument to drupal_alter() was altered.');
+    \Drupal::moduleHandler()->alter('drupal_alter', $array_copy, $entity_copy, $array2_copy);
+    $this->assertEqual($array_copy, $array_expected, 'First argument to \Drupal::moduleHandler->alter() was altered.');
+    $this->assertEqual($entity_copy, $entity_expected, 'Second argument to \Drupal::moduleHandler->alter() was altered.');
+    $this->assertEqual($array2_copy, $array2_expected, 'Third argument to \Drupal::moduleHandler->alter() was altered.');
 
-    // Verify alteration order when passing an array of types to drupal_alter().
+    // Verify alteration order when passing an array of types to \Drupal::moduleHandler->alter().
     // common_test_module_implements_alter() places 'block' implementation after
     // other modules.
     $array_copy = $array;
     $array_expected = array('foo' => 'Drupal block theme');
-    drupal_alter(array('drupal_alter', 'drupal_alter_foo'), $array_copy);
+    \Drupal::moduleHandler()->alter(array('drupal_alter', 'drupal_alter_foo'), $array_copy);
     $this->assertEqual($array_copy, $array_expected, 'hook_TYPE_alter() implementations ran in correct order.');
   }
 }
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index 5ac280a2c5c0b35b2c3e13fccc0e49e78e8120b6..41e2fb9a02f7e6973d82e1d5785bdeea63e4c2ad 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -1032,13 +1032,13 @@ function hook_mail_alter(&$message) {
  * A module may implement this hook in order to reorder the implementing
  * modules, which are otherwise ordered by the module's system weight.
  *
- * Note that hooks invoked using drupal_alter() can have multiple variations
- * (such as hook_form_alter() and hook_form_FORM_ID_alter()). drupal_alter()
- * will call all such variants defined by a single module in turn. For the
- * purposes of hook_module_implements_alter(), these variants are treated as
- * a single hook. Thus, to ensure that your implementation of
- * hook_form_FORM_ID_alter() is called at the right time, you will have to
- * change the order of hook_form_alter() implementation in
+ * Note that hooks invoked using \Drupal::moduleHandler->alter() can have
+ * multiple variations(such as hook_form_alter() and hook_form_FORM_ID_alter()).
+ * \Drupal::moduleHandler->alter() will call all such variants defined by a
+ * single module in turn. For the purposes of hook_module_implements_alter(),
+ * these variants are treated as a single hook. Thus, to ensure that your
+ * implementation of hook_form_FORM_ID_alter() is called at the right time,
+ * you will have to change the order of hook_form_alter() implementation in
  * hook_module_implements_alter().
  *
  * @param $implementations
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 5cc32727dda8a5afbae1e0f6017cfb601b5a4d04..f844046f6603875f245eb024fd94d2ca8a64ed34 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -1576,7 +1576,7 @@ function _system_rebuild_module_data() {
     // Invoke hook_system_info_alter() to give installed modules a chance to
     // modify the data in the .info.yml files if necessary.
     $type = 'module';
-    drupal_alter('system_info', $modules[$key]->info, $modules[$key], $type);
+    \Drupal::moduleHandler()->alter('system_info', $modules[$key]->info, $modules[$key], $type);
   }
 
   // It is possible that a module was marked as required by
diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module
index 44a84ef6e2bd4f25e17ee1faba54a6518d017544..c156c07f53208ea2800804647d71aa59d7c8137f 100644
--- a/core/modules/system/tests/modules/common_test/common_test.module
+++ b/core/modules/system/tests/modules/common_test/common_test.module
@@ -81,7 +81,8 @@ function bartik_drupal_alter_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
 /**
  * Implements hook_TYPE_alter() on behalf of block module.
  *
- * This is for verifying that drupal_alter(array(TYPE1, TYPE2), ...) allows
+ * This is to verify that
+ * \Drupal::moduleHandler()->alter(array(TYPE1, TYPE2), ...) allows
  * hook_module_implements_alter() to affect the order in which module
  * implementations are executed.
  */
@@ -95,10 +96,11 @@ function block_drupal_alter_foo_alter(&$data, &$arg2 = NULL, &$arg3 = NULL) {
  * @see block_drupal_alter_foo_alter()
  */
 function common_test_module_implements_alter(&$implementations, $hook) {
-  // For drupal_alter(array('drupal_alter', 'drupal_alter_foo'), ...), make the
-  // block module implementations run after all the other modules. Note that
-  // when drupal_alter() is called with an array of types, the first type is
-  // considered primary and controls the module order.
+  // For
+  // \Drupal::moduleHandler()->alter(array('drupal_alter', 'drupal_alter_foo'), ...),
+  // make the block module implementations run after all the other modules. Note
+  // that when \Drupal::moduleHandler->alter() is called with an array of types,
+  // the first type is considered primary and controls the module order.
   if ($hook == 'drupal_alter_alter' && isset($implementations['block'])) {
     $group = $implementations['block'];
     unset($implementations['block']);
diff --git a/core/modules/system/tests/themes/test_theme/test_theme.theme b/core/modules/system/tests/themes/test_theme/test_theme.theme
index 13cb2b9bc9080f28ec8cf2dbf35159e8797a23df..013ef7d130f34c6033ec536b9221e15813e415bb 100644
--- a/core/modules/system/tests/themes/test_theme/test_theme.theme
+++ b/core/modules/system/tests/themes/test_theme/test_theme.theme
@@ -24,7 +24,7 @@ function test_theme_theme_test__suggestion($variables) {
  *
  * The confusing function name here is due to this being an implementation of
  * the alter hook invoked when the 'theme_test' module calls
- * drupal_alter('theme_test_alter').
+ * \Drupal::moduleHandler->alter('theme_test_alter').
  */
 function test_theme_theme_test_alter_alter(&$data) {
   $data = 'test_theme_theme_test_alter_alter was invoked';
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index e0aa546d95b79b26a4c014a4803c63e15c3790ae..72179865d9cbdaecd4dde7817b8555fb45ccd8db 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -194,7 +194,7 @@ function ($object) {
   // Get toolbar items from all modules that implement hook_toolbar().
   $items = \Drupal::moduleHandler()->invokeAll('toolbar');
   // Allow for altering of hook_toolbar().
-  drupal_alter('toolbar', $items);
+  \Drupal::moduleHandler()->alter('toolbar', $items);
   // Sort the children.
   uasort($items, 'element_sort');
 
diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc
index 528672f3f4eeee355dcec3853444e773d74bcdb7..da6d63b06255f9cd91f72b7f6d89a09977ba0616 100644
--- a/core/modules/update/update.compare.inc
+++ b/core/modules/update/update.compare.inc
@@ -153,7 +153,7 @@ function update_calculate_project_data($available) {
   // Give other modules a chance to alter the status (for example, to allow a
   // contrib module to provide fine-grained settings to ignore specific
   // projects or releases).
-  drupal_alter('update_status', $projects);
+  \Drupal::moduleHandler()->alter('update_status', $projects);
 
   // Store the site's update status for at most 1 hour.
   \Drupal::keyValueExpirable('update')->setWithExpire('update_project_data', $projects, 3600);
diff --git a/core/modules/xmlrpc/xmlrpc.server.inc b/core/modules/xmlrpc/xmlrpc.server.inc
index 3e1d2a9ffaaae85db940fcdc143c2f93a319427d..d86ae6a5f0e2ec888c127f757e2b40f99221482b 100644
--- a/core/modules/xmlrpc/xmlrpc.server.inc
+++ b/core/modules/xmlrpc/xmlrpc.server.inc
@@ -65,7 +65,7 @@ function xmlrpc_server($callbacks) {
   // with those defined by modules implementing the _xmlrpc hook.
   // Built-in methods are overridable.
   $callbacks = array_merge($defaults, (array) $callbacks);
-  drupal_alter('xmlrpc', $callbacks);
+  \Drupal::moduleHandler()->alter('xmlrpc', $callbacks);
   foreach ($callbacks as $key => $callback) {
     // we could check for is_array($callback)
     if (is_int($key)) {