diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index 95dd5a8..d02485a 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -1092,8 +1092,8 @@ public function getName($module) { /** * {@inheritdoc} */ - public function invalidCore($core) { - return substr(\Drupal::CORE_COMPATIBILITY, 0, 1) != substr($core, 0, 1) || version_compare(\Drupal::VERSION, $core, '<'); + public function isCoreCompatible($core) { + return substr(\Drupal::CORE_COMPATIBILITY, 0, 1) == substr($core, 0, 1) && !version_compare(\Drupal::VERSION, $core, '<'); } /** diff --git a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php index 15b07a5..6cd03f2 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php @@ -360,12 +360,12 @@ public function getName($theme); /** * Check a module's core compatibility * - * @param $core + * @param string $core * The value of the core key in a module .info.yml file. * * @return bool - * TRUE if invalid or incompatible, FALSE otherwise. + * FALSE if invalid or incompatible, TRUE otherwise. */ - public function invalidCore($core); + public function isCoreCompatible($core); } diff --git a/core/modules/system/src/Controller/SystemController.php b/core/modules/system/src/Controller/SystemController.php index 22bade6..d21674f 100644 --- a/core/modules/system/src/Controller/SystemController.php +++ b/core/modules/system/src/Controller/SystemController.php @@ -230,7 +230,7 @@ public function themesPage() { // Ensure this theme is compatible with this version of core. // Require the 'content' region to make sure the main page // content has a common place in all themes. - $theme->incompatible_core = !isset($theme->info['core']) || ($theme->info['core'] != \DRUPAL::CORE_COMPATIBILITY) || !isset($theme->info['regions']['content']); + $theme->incompatible_core = !isset($theme->info['core']) || !$this->moduleHandler()->isCoreCompatible($theme->info['core']) || !isset($theme->info['regions']['content']); $theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0; // Confirmed that the base theme is available. $theme->incompatible_base = isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']]); diff --git a/core/modules/system/src/Form/ModulesListForm.php b/core/modules/system/src/Form/ModulesListForm.php index 2830a40..c458f92 100644 --- a/core/modules/system/src/Form/ModulesListForm.php +++ b/core/modules/system/src/Form/ModulesListForm.php @@ -336,7 +336,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) { $reasons = array(); // Check the core compatibility. - if ($this->moduleHandler->invalidCore($module->info['core'])) { + if (!$this->moduleHandler->isCoreCompatible($module->info['core'])) { $compatible = FALSE; $reasons[] = $this->t('This version is not compatible with Drupal !core_version and should be replaced.', array( '!core_version' => \Drupal::VERSION, @@ -381,7 +381,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) { } // Disable the checkbox if the dependency is incompatible with this // version of Drupal core. - elseif ($this->moduleHandler->invalidCore($modules[$dependency]->info['core'])) { + elseif (!$this->moduleHandler->isCoreCompatible($modules[$dependency]->info['core'])) { $row['#requires'][$dependency] = $this->t('@module (incompatible with this version of Drupal core)', array( '@module' => $name, )); diff --git a/core/modules/system/tests/modules/system_test/system_test.module.orig b/core/modules/system/tests/modules/system_test/system_test.module.orig deleted file mode 100644 index 8024680..0000000 --- a/core/modules/system/tests/modules/system_test/system_test.module.orig +++ /dev/null @@ -1,192 +0,0 @@ -get('system_test.verbose_module_hooks')) { - foreach ($modules as $module) { - drupal_set_message(t('hook_modules_installed fired for @module', array('@module' => $module))); - } - } -} - -/** - * Implements hook_modules_uninstalled(). - */ -function system_test_modules_uninstalled($modules) { - if (\Drupal::state()->get('system_test.verbose_module_hooks')) { - foreach ($modules as $module) { - drupal_set_message(t('hook_modules_uninstalled fired for @module', array('@module' => $module))); - } - } -} - -/** - * Implements hook_system_info_alter(). - */ -function system_test_system_info_alter(&$info, Extension $file, $type) { - // We need a static otherwise the last test will fail to alter common_test. - static $test; - if (($dependencies = \Drupal::state()->get('system_test.dependencies')) || $test) { - if ($file->getName() == 'module_test') { - $info['hidden'] = FALSE; - $info['dependencies'][] = array_shift($dependencies); - \Drupal::state()->set('system_test.dependencies', $dependencies); - $test = TRUE; - } - if ($file->getName() == 'common_test') { - $info['hidden'] = FALSE; - $info['version'] = '8.x-2.4-beta3'; - } - } - - // Make the system_dependencies_test visible by default. - if ($file->getName() == 'system_dependencies_test') { - $info['hidden'] = FALSE; - } - if (in_array($file->getName(), array( - 'system_incompatible_module_version_dependencies_test', - 'system_incompatible_core_version_dependencies_test', - 'system_incompatible_module_version_test', - 'system_incompatible_core_version_test', - ))) { - $info['hidden'] = FALSE; - } - if ($file->getName() == 'requirements1_test' || $file->getName() == 'requirements2_test') { - $info['hidden'] = FALSE; - } - if ($file->getName() == 'system_test') { - $info['hidden'] = \Drupal::state()->get('system_test.module_hidden', TRUE); - } -} - -/** - * Try to acquire a named lock and report the outcome. - * - * @deprecated \Drupal\system_test\Controller\SystemTestController::lockAcquire() - */ -function system_test_lock_acquire() { - if (\Drupal::lock()->acquire('system_test_lock_acquire')) { - \Drupal::lock()->release('system_test_lock_acquire'); - return ['#markup' => 'TRUE: Lock successfully acquired in system_test_lock_acquire()']; - } - else { - return ['#markup' => 'FALSE: Lock not acquired in system_test_lock_acquire()']; - } -} - -/** - * Try to acquire a specific lock, and then exit. - * - * @deprecated \Drupal\system_test\Controller\SystemTestController::lockExit() - */ -function system_test_lock_exit() { - if (\Drupal::lock()->acquire('system_test_lock_exit', 900)) { - echo 'TRUE: Lock successfully acquired in system_test_lock_exit()'; - // The shut-down function should release the lock. - exit(); - } - else { - return ['#markup' => 'FALSE: Lock not acquired in system_test_lock_exit()']; - } -} - -/** - * Implements hook_page_attachments(). - */ -function system_test_page_attachments(array &$page) { - $menu_item['path'] = current_path(); - $main_content_display = &drupal_static('system_main_content_added', FALSE); - - if ($menu_item['path'] == 'system-test/main-content-fallback') { - // Get the main content, to e.g. dynamically attach an asset. - drupal_set_page_content(); - // Indicate we don't want to override the main content. - $main_content_display = FALSE; - } - elseif ($menu_item['path'] == 'system-test/main-content-handling') { - // Set the main content. - drupal_set_page_content('