From f584be98226f779cf54ae145584722307681d56c Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Thu, 29 May 2014 14:41:26 +0100
Subject: [PATCH] Issue #2209293 by sun, xjm: Remove core compatibility check
 in ExtensionDiscovery; obsolete with Migrate in core.

---
 core/lib/Drupal/Core/Extension/ExtensionDiscovery.php | 11 -----------
 .../system/src/Tests/Common/SystemListingTest.php     |  7 -------
 .../drupal_system_listing_incompatible_test.info.yml  |  6 ------
 .../drupal_system_listing_incompatible_test.info.yml  |  6 ------
 4 files changed, 30 deletions(-)
 delete mode 100644 core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml
 delete mode 100644 core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml

diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
index c0f4a194b8ac..0457458ebf17 100644
--- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
+++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
@@ -275,18 +275,7 @@ protected function process(array $all_files) {
     $files = array();
     // Duplicate files found in later search directories take precedence over
     // earlier ones; they replace the extension in the existing $files array.
-    // The exception to this is if the later extension is not compatible with
-    // the current version of Drupal core, which may occur during upgrades when
-    // e.g. new modules were introduced in core while older contrib modules with
-    // the same name still exist in a later search path.
     foreach ($all_files as $file) {
-      if (isset($files[$file->getName()])) {
-        // Skip the extension if it is incompatible with Drupal core.
-        $info = $this->getInfoParser()->parse($file->getPathname());
-        if (!isset($info['core']) || $info['core'] != \Drupal::CORE_COMPATIBILITY) {
-          continue;
-        }
-      }
       $files[$file->getName()] = $file;
     }
     return $files;
diff --git a/core/modules/system/src/Tests/Common/SystemListingTest.php b/core/modules/system/src/Tests/Common/SystemListingTest.php
index 7962e497e8f3..4aac4ce8a2a8 100644
--- a/core/modules/system/src/Tests/Common/SystemListingTest.php
+++ b/core/modules/system/src/Tests/Common/SystemListingTest.php
@@ -29,13 +29,6 @@ function testDirectoryPrecedence() {
     // Define the module files we will search for, and the directory precedence
     // we expect.
     $expected_directories = array(
-      // When the copy of the module in the profile directory is incompatible
-      // with Drupal core, the copy in the core modules directory takes
-      // precedence.
-      'drupal_system_listing_incompatible_test' => array(
-        'core/modules/system/tests/modules',
-        'core/profiles/testing/modules',
-      ),
       // When both copies of the module are compatible with Drupal core, the
       // copy in the profile directory takes precedence.
       'drupal_system_listing_compatible_test' => array(
diff --git a/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml b/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml
deleted file mode 100644
index a04828b4bef5..000000000000
--- a/core/modules/system/tests/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: 'Drupal system listing incompatible test'
-type: module
-description: 'Support module for testing the drupal_system_listing function.'
-package: Testing
-version: VERSION
-core: 8.x
diff --git a/core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml b/core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml
deleted file mode 100644
index 17bda6cfd015..000000000000
--- a/core/profiles/testing/modules/drupal_system_listing_incompatible_test/drupal_system_listing_incompatible_test.info.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: 'Drupal system listing incompatible test'
-type: module
-description: 'Support module for testing the drupal_system_listing function.'
-package: Testing
-version: VERSION
-core: 6.x
-- 
GitLab