diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php index 04fac02..e836531 100644 --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -77,6 +77,16 @@ class Drupal { /** + * The current system version. + */ + const VERSION = '8.0-dev'; + + /** + * Core API compatibility. + */ + const CORE_COMPATIBILITY = '8.x'; + + /** * The currently active container object. * * @var \Symfony\Component\DependencyInjection\ContainerInterface diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index b9e5724..3ac1d89 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -464,7 +464,7 @@ protected function parseDependency($dependency) { // supports. Also, op is optional and defaults to equals. $p_op = '(?!=|==|=|<|<=|>|>=|<>)?'; // Core version is always optional: 8.x-2.x and 2.x is treated the same. - $p_core = '(?:' . preg_quote(DRUPAL_CORE_COMPATIBILITY) . '-)?'; + $p_core = '(?:' . preg_quote(\Drupal::CORE_COMPATIBILITY) . '-)?'; $p_major = '(?\d+)'; // By setting the minor version to x, branches can be matched. $p_minor = '(?(?:\d+|x)(?:-[A-Za-z]+\d+)?)'; diff --git a/core/lib/Drupal/Core/SystemListingInfo.php b/core/lib/Drupal/Core/SystemListingInfo.php index 3c34a5e..714365b 100644 --- a/core/lib/Drupal/Core/SystemListingInfo.php +++ b/core/lib/Drupal/Core/SystemListingInfo.php @@ -61,7 +61,7 @@ protected function process(array $files, array $files_to_add) { // If the module or theme is incompatible with Drupal core, remove it // from the array for the current search directory, so it is not // overwritten when merged with the $files array. - if (isset($info['core']) && $info['core'] != DRUPAL_CORE_COMPATIBILITY) { + if (isset($info['core']) && $info['core'] != \Drupal::CORE_COMPATIBILITY) { unset($files_to_add[$file_key]); } } diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php index 32d8db7..ffe1253 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php @@ -222,10 +222,10 @@ protected function buildRow(array $modules, $module, $distribution) { $status = ''; // Check the core compatibility. - if ($module->info['core'] != DRUPAL_CORE_COMPATIBILITY) { + if ($module->info['core'] != \Drupal::CORE_COMPATIBILITY) { $compatible = FALSE; $status .= $this->t('This version is not compatible with Drupal !core_version and should be replaced.', array( - '!core_version' => DRUPAL_CORE_COMPATIBILITY, + '!core_version' => \Drupal::CORE_COMPATIBILITY, )); } @@ -259,7 +259,7 @@ protected function buildRow(array $modules, $module, $distribution) { $name = $modules[$dependency]->info['name']; // Disable the module's checkbox if it is incompatible with the // dependency's version. - if ($incompatible_version = drupal_check_incompatibility($version, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $modules[$dependency]->info['version']))) { + if ($incompatible_version = drupal_check_incompatibility($version, str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $modules[$dependency]->info['version']))) { $row['#requires'][$dependency] = $this->t('@module (incompatible with version @version)', array( '@module' => $name . $incompatible_version, '@version' => $modules[$dependency]->info['version'], @@ -268,7 +268,7 @@ protected function buildRow(array $modules, $module, $distribution) { } // Disable the checkbox if the dependency is incompatible with this // version of Drupal core. - elseif ($modules[$dependency]->info['core'] != DRUPAL_CORE_COMPATIBILITY) { + elseif ($modules[$dependency]->info['core'] != \Drupal::CORE_COMPATIBILITY) { $row['#requires'][$dependency] = $this->t('@module (incompatible with this version of Drupal core)', array( '@module' => $name, )); diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateCoreUnitTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreUnitTest.php index ac26bd7..c682f99 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateCoreUnitTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateCoreUnitTest.php @@ -45,20 +45,20 @@ function testUpdateBuildFetchUrl() { $project['info']['project status url'] = 'http://www.example.com'; $project['includes'] = array('module1' => 'Module 1', 'module2' => 'Module 2'); $site_key = ''; - $expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY; + $expected = 'http://www.example.com/' . $project['name'] . '/' . \Drupal::CORE_COMPATIBILITY; $url = _update_build_fetch_url($project, $site_key); $this->assertEqual($url, $expected, "'$url' when no site_key provided should be '$expected'."); //For disabled projects it shouldn't add the site key either. $site_key = 'site_key'; $project['project_type'] = 'disabled'; - $expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY; + $expected = 'http://www.example.com/' . $project['name'] . '/' . \Drupal::CORE_COMPATIBILITY; $url = _update_build_fetch_url($project, $site_key); $this->assertEqual($url, $expected, "'$url' should be '$expected' for disabled projects."); //for enabled projects, adding the site key $project['project_type'] = ''; - $expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY; + $expected = 'http://www.example.com/' . $project['name'] . '/' . \Drupal::CORE_COMPATIBILITY; $expected .= '?site_key=site_key'; $expected .= '&list=' . rawurlencode('module1,module2'); $url = _update_build_fetch_url($project, $site_key); @@ -67,7 +67,7 @@ function testUpdateBuildFetchUrl() { // http://drupal.org/node/1481156 test incorrect logic when URL contains // a question mark. $project['info']['project status url'] = 'http://www.example.com/?project='; - $expected = 'http://www.example.com/?project=/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY; + $expected = 'http://www.example.com/?project=/' . $project['name'] . '/' . \Drupal::CORE_COMPATIBILITY; $expected .= '&site_key=site_key'; $expected .= '&list=' . rawurlencode('module1,module2'); $url = _update_build_fetch_url($project, $site_key); diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php index e98ae01..82f93c4 100644 --- a/core/modules/views/lib/Drupal/views/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Entity/View.php @@ -79,7 +79,7 @@ class View extends ConfigEntityBase implements ViewStorageInterface { * * @var int */ - protected $core = DRUPAL_CORE_COMPATIBILITY; + protected $core = \Drupal::CORE_COMPATIBILITY; /** * Stores all display handlers of this view. diff --git a/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php index 94a2cf7..e94586f 100644 --- a/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php +++ b/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php @@ -12,9 +12,6 @@ use Drupal\block\Plugin\views\display\Block; // @todo Remove this once the constant got converted. -if (!defined('DRUPAL_CORE_COMPATIBILITY')) { - define('DRUPAL_CORE_COMPATIBILITY', '8.x'); -} if (!defined('BLOCK_LABEL_VISIBLE')) { define('BLOCK_LABEL_VISIBLE', 'visible'); } diff --git a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php index 9b52116..172d6ef 100644 --- a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php +++ b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php @@ -13,10 +13,6 @@ use Drupal\views_ui\ViewUI; use Symfony\Component\DependencyInjection\Container; -if (!defined('DRUPAL_CORE_COMPATIBILITY')) { - define('DRUPAL_CORE_COMPATIBILITY', '8.x'); -} - /** * Tests the ViewUI class. *