Commit 085a24e0 authored by catch's avatar catch
Browse files

Issue #2067017 by damiankloip: Remove usage of DRUPAL_CORE_COMPATIBILITY/VERSION constants.

parent fb38555e
......@@ -28,16 +28,6 @@
* Functions that need to be loaded on every Drupal request.
*/
/**
* The current system version.
*/
const VERSION = '8.0-dev';
/**
* Core API compatibility.
*/
const DRUPAL_CORE_COMPATIBILITY = '8.x';
/**
* Minimum supported version of PHP.
*/
......
......@@ -354,7 +354,7 @@ function _drupal_default_html_head() {
);
// Show Drupal and the major version number in the META GENERATOR tag.
// Get the major version.
list($version, ) = explode('.', VERSION);
list($version, ) = explode('.', Drupal::VERSION);
$elements['system_meta_generator'] = array(
'#type' => 'html_tag',
'#tag' => 'meta',
......@@ -4614,7 +4614,7 @@ function drupal_parse_info_file($filename) {
$parser = new Parser();
$info[$filename] = $parser->parse(file_get_contents($filename));
if (isset($info[$filename]['version']) && $info[$filename]['version'] === 'VERSION') {
$info[$filename]['version'] = VERSION;
$info[$filename]['version'] = Drupal::VERSION;
}
}
}
......
......@@ -1689,8 +1689,8 @@ function install_check_localization_server($uri) {
* Associative array containing 'core' and 'version' of the release.
*/
function install_get_localization_release() {
if (strpos(VERSION, 'dev')) {
list($version, ) = explode('-', VERSION);
if (strpos(Drupal::VERSION, 'dev')) {
list($version, ) = explode('-', Drupal::VERSION);
list($major, $minor) = explode('.', $version);
// Calculate the major and minor release numbers to fall back to.
......@@ -1704,7 +1704,7 @@ function install_get_localization_release() {
$release = "$major.$minor";
}
else {
$release = VERSION;
$release = Drupal::VERSION;
}
return array(
......
......@@ -72,7 +72,7 @@ function update_check_incompatibility($name, $type = 'module') {
}
if (!isset($file)
|| !isset($file->info['core'])
|| $file->info['core'] != DRUPAL_CORE_COMPATIBILITY
|| $file->info['core'] != Drupal::CORE_COMPATIBILITY
|| version_compare(phpversion(), $file->info['php']) < 0) {
return TRUE;
}
......
......@@ -76,6 +76,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.
*
......
......@@ -464,7 +464,7 @@ public static function parseDependency($dependency) {
// supports. Also, op is optional and defaults to equals.
$p_op = '(?<operation>!=|==|=|<|<=|>|>=|<>)?';
// 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 = '(?<major>\d+)';
// By setting the minor version to x, branches can be matched.
$p_minor = '(?<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
......
......@@ -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]);
}
}
......
......@@ -626,7 +626,7 @@ function block_language_delete($language) {
function block_library_info() {
$libraries['drupal.block'] = array(
'title' => 'Block',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/block.js' => array(),
),
......@@ -637,7 +637,7 @@ function block_library_info() {
);
$libraries['drupal.block.admin'] = array(
'title' => 'Block admin',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/js/block.admin.js' => array(),
),
......
......@@ -1281,7 +1281,7 @@ function book_menu_subtree_data($link) {
function book_library_info() {
$libraries['drupal.book'] = array(
'title' => 'Book',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'book') . '/book.js' => array(),
),
......
......@@ -42,7 +42,7 @@ function ckeditor_library_info() {
);
$libraries['drupal.ckeditor'] = array(
'title' => 'Drupal behavior to enable CKEditor on textareas.',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.js' => array(),
array('data' => $settings, 'type' => 'setting'),
......@@ -58,7 +58,7 @@ function ckeditor_library_info() {
);
$libraries['drupal.ckeditor.admin'] = array(
'title' => 'Drupal behavior for drag-and-drop CKEditor toolbar builder UI.',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.admin.js' => array(),
),
......@@ -81,7 +81,7 @@ function ckeditor_library_info() {
);
$libraries['drupal.ckeditor.drupalimage.admin'] = array(
'title' => 'Only show the "drupalimage" plugin settings when its button is enabled.',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.drupalimage.admin.js' => array(),
),
......@@ -95,7 +95,7 @@ function ckeditor_library_info() {
);
$libraries['drupal.ckeditor.stylescombo.admin'] = array(
'title' => 'Only show the "stylescombo" plugin settings when its button is enabled.',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$module_path . '/js/ckeditor.stylescombo.admin.js' => array(),
),
......
......@@ -740,7 +740,7 @@ function _color_rgb2hsl($rgb) {
function color_library_info() {
$libraries['drupal.color'] = array(
'title' => 'Color',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/color.js' => array(),
),
......@@ -754,7 +754,7 @@ function color_library_info() {
);
$libraries['drupal.color.preview'] = array(
'title' => 'Color preview',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/preview.js' => array(),
),
......
......@@ -1782,7 +1782,7 @@ function comment_file_download_access($field, EntityInterface $entity, File $fil
function comment_library_info() {
$libraries['drupal.comment'] = array(
'title' => 'Comment',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'comment') . '/comment-node-form.js' => array(),
),
......
......@@ -356,7 +356,7 @@ function content_translation_library_info() {
$path = drupal_get_path('module', 'content_translation');
$libraries['drupal.content_translation.admin'] = array(
'title' => 'Content translation UI',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/content_translation.admin.js' => array(),
),
......
......@@ -109,7 +109,7 @@ function contextual_library_info() {
$libraries['drupal.contextual-links'] = array(
'title' => 'Contextual Links',
'website' => 'http://drupal.org/node/473268',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
// Add the JavaScript, with a group and weight such that it will run
// before modules/contextual/js/contextual.toolbar.js.
......@@ -131,7 +131,7 @@ function contextual_library_info() {
);
$libraries['drupal.contextual-toolbar'] = array(
'title' => 'Contextual Links Toolbar Tab',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
// Add the JavaScript, with a group and weight such that it will run
// before modules/overlay/overlay-parent.js.
......
......@@ -79,7 +79,7 @@ function edit_library_info() {
);
$libraries['edit'] = array(
'title' => 'Edit: in-place editing',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
// Core.
$path . '/js/edit.js' => $options,
......@@ -121,7 +121,7 @@ function edit_library_info() {
);
$libraries['edit.editorWidget.form'] = array(
'title' => 'Form in-place editor',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/js/editors/formEditor.js' => $options,
),
......@@ -131,7 +131,7 @@ function edit_library_info() {
);
$libraries['edit.editorWidget.direct'] = array(
'title' => 'Direct in-place editor',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/js/editors/directEditor.js' => $options,
),
......
......@@ -165,7 +165,7 @@ function testUserWithPermission() {
$this->assertIdentical('settings', $ajax_commands[0]['command'], 'The first AJAX command is a settings command.');
// Second command: insert libraries into DOM.
$this->assertIdentical('insert', $ajax_commands[1]['command'], 'The second AJAX command is an append command.');
$command = new AppendCommand('body', '<script src="' . file_create_url('core/modules/edit/js/editors/formEditor.js') . '?v=' . VERSION . '"></script>' . "\n");
$command = new AppendCommand('body', '<script src="' . file_create_url('core/modules/edit/js/editors/formEditor.js') . '?v=' . \Drupal::VERSION . '"></script>' . "\n");
$this->assertIdentical($command->render(), $ajax_commands[1], 'The append command contains the expected data.');
// Retrieving the form for this field should result in a 200 response,
......
......@@ -71,7 +71,7 @@ function editor_library_info() {
$libraries['drupal.editor.admin'] = array(
'title' => 'Text Editor',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/js/editor.admin.js' => array(),
),
......@@ -82,7 +82,7 @@ function editor_library_info() {
);
$libraries['drupal.editor'] = array(
'title' => 'Text Editor',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/js/editor.js' => array(),
),
......@@ -99,7 +99,7 @@ function editor_library_info() {
$libraries['drupal.editor.dialog'] = array(
'title' => 'Text Editor Dialog',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/js/editor.dialog.js' => array('weight' => 2),
),
......@@ -113,7 +113,7 @@ function editor_library_info() {
$libraries['edit.formattedTextEditor.editor'] = array(
'title' => 'Formatted text editor',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/js/editor.formattedTextEditor.js' => array(
'scope' => 'footer',
......
......@@ -349,7 +349,7 @@ function field_ui_form_node_type_form_submit($form, &$form_state) {
function field_ui_library_info() {
$libraries['drupal.field_ui'] = array(
'title' => 'Field UI',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'field_ui') . '/field_ui.js' => array(),
),
......
......@@ -1922,7 +1922,7 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag
function file_library_info() {
$libraries['drupal.file'] = array(
'title' => 'File',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
drupal_get_path('module', 'file') . '/file.js' => array(),
),
......
......@@ -1456,7 +1456,7 @@ function filter_library_info() {
$libraries['drupal.filter.admin'] = array(
'title' => 'Filter',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/filter.admin.js' => array(),
),
......@@ -1472,7 +1472,7 @@ function filter_library_info() {
);
$libraries['drupal.filter.filter_html.admin'] = array(
'title' => 'Automatic "Limit allowed HTML tags" filter setting updating.',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/filter.filter_html.admin.js' => array(),
),
......@@ -1484,7 +1484,7 @@ function filter_library_info() {
);
$libraries['drupal.filter'] = array(
'title' => 'Filter',
'version' => VERSION,
'version' => Drupal::VERSION,
'js' => array(
$path . '/filter.js' => array(),
),
......@@ -1499,7 +1499,7 @@ function filter_library_info() {
);
$libraries['caption'] = array(
'title' => 'Captions for images and alignments',
'version' => VERSION,
'version' => Drupal::VERSION,
'css' => array(
$path . '/css/filter.caption.css',
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment