diff --git a/core/includes/common.inc b/core/includes/common.inc index e96ea9b..3e48fb3 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -5192,7 +5192,7 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) foreach (array_intersect_key($files_to_add, $files) as $file_key => $file) { // If it has no info file, then we just behave liberally and accept the // new resource on the list for merging. - if (file_exists($info_file = dirname($file->uri) . '/' . $file->name . '.yml')) { + if (file_exists($info_file = dirname($file->uri) . '/' . $file->name . '.info.yml')) { // Get the .info file for the module or theme this file belongs to. $info = drupal_parse_info_file($info_file); @@ -6544,37 +6544,32 @@ function drupal_array_nested_key_exists(array $array, array $parents) { * * Info files are NOT for placing arbitrary theme and module-specific settings. * Use variable_get() and variable_set() for that. Info files are formatted as - * YAML. If a key called "version" is set to "VERSION" in any info file, the PHP - * constant of the same name will be substituted into the resulting data. + * YAML. If the 'version' key is set to 'VERSION' in any info file, then the + * value will be substituted with the current version of Drupal core. * - * Information stored in a module .info file: + * Information stored in a module .info.yml file: * - name: The real name of the module for display purposes. * - description: A brief description of the module. + * - core: The version of Drupal core the module is compatible with. * - dependencies: An array of shortnames of other modules this module requires. * - package: The name of the package of modules this module belongs to. * - * See forum.info for an example of a module .info file. - * - * Information stored in a theme .info file: + * Information stored in a theme .info.yml file: * - name: The real name of the theme for display purposes. * - description: Brief description. - * - screenshot: Path to screenshot relative to the theme's .info file. + * - screenshot: Path to screenshot relative to the theme's .info.yml file. * - engine: Theme engine; typically phptemplate. - * - base: Name of a base theme, if applicable + * - base theme: Name of a base theme, if applicable * - regions: Listed regions * - features: Features available * - stylesheets: Theme stylesheets * - scripts: Theme scripts * - * See bartik.info for an example of a theme .info file. - * - * @param $filename + * @param string $filename * The file we are parsing. Accepts file with relative or absolute path. * - * @return + * @return array * The info array. - * - * @see http://yaml.org/ */ function drupal_parse_info_file($filename) { $info = &drupal_static(__FUNCTION__, array()); @@ -6586,7 +6581,7 @@ function drupal_parse_info_file($filename) { else { $data = file_get_contents($filename); $info[$filename] = Yaml::parse($filename); - if (isset($info[$filename]['version']) && $info[$filename]['version'] == 'VERSION') { + if (isset($info[$filename]['version']) && $info[$filename]['version'] === 'VERSION') { $info[$filename]['version'] = VERSION; } } diff --git a/core/includes/install.inc b/core/includes/install.inc index f7cbcb0..fed5974 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -907,7 +907,7 @@ function install_profile_info($profile, $langcode = 'en') { 'hidden' => FALSE, 'php' => DRUPAL_MINIMUM_PHP, ); - $profile_file = drupal_get_path('profile', $profile) . "/$profile.yml"; + $profile_file = drupal_get_path('profile', $profile) . "/$profile.info.yml"; $info = drupal_parse_info_file($profile_file); $info += $defaults; $info['dependencies'] = array_unique(array_merge( diff --git a/core/includes/module.inc b/core/includes/module.inc index ca3cb5d..dbac1a7 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -999,7 +999,7 @@ function module_invoke_all($hook) { * Returns an array of modules required by core. */ function drupal_required_modules() { - $files = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.yml$/', 'modules', 'name', 0); + $files = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info.yml$/', 'modules', 'name', 0); $required = array(); // An installation profile is required and one must always be loaded. diff --git a/core/lib/Drupal/Core/Updater/Updater.php b/core/lib/Drupal/Core/Updater/Updater.php index 1fe2fcd..cdd4e4e 100644 --- a/core/lib/Drupal/Core/Updater/Updater.php +++ b/core/lib/Drupal/Core/Updater/Updater.php @@ -94,7 +94,7 @@ public static function getUpdaterFromDirectory($directory) { * Path to the info file. */ public static function findInfoFile($directory) { - $info_files = file_scan_directory($directory, '/.*\.yml$/'); + $info_files = file_scan_directory($directory, '/.*\.info.yml$/'); if (!$info_files) { return FALSE; } diff --git a/core/modules/system/lib/Drupal/system/Tests/System/InfoFileParserUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/System/InfoFileParserUnitTest.php deleted file mode 100644 index dfa47d8..0000000 --- a/core/modules/system/lib/Drupal/system/Tests/System/InfoFileParserUnitTest.php +++ /dev/null @@ -1,84 +0,0 @@ - 'Info file format parser', - 'description' => 'Tests proper parsing of a .info file formatted string.', - 'group' => 'System', - ); - } - - /** - * Test drupal_parse_info_format(). - */ - function testDrupalParseInfoFormat() { - $config = " -simple: Value -quoted: ' Value' -array: - - Value1 - - Value2 -array_assoc: - a: Value1 - b: Value2 -array_deep: - - [[Value]] -array_deep_assoc: - a: - b: - c: Value -array_space: - 'a b': Value"; - - $expected = array( - 'simple' => 'Value', - 'quoted' => ' Value', - 'array' => array( - 0 => 'Value1', - 1 => 'Value2', - ), - 'array_assoc' => array( - 'a' => 'Value1', - 'b' => 'Value2', - ), - 'array_deep' => array( - 0 => array( - 0 => array( - 0 => 'Value', - ), - ), - ), - 'array_deep_assoc' => array( - 'a' => array( - 'b' => array( - 'c' => 'Value', - ), - ), - ), - 'array_space' => array( - 'a b' => 'Value', - ), - ); - - $parsed = Yaml::parse($config); - - $this->assertEqual($parsed['simple'], $expected['simple'], t('Set a simple value.')); - $this->assertEqual($parsed['quoted'], $expected['quoted'], t('Set a simple value in quotes.')); - $this->assertEqual($parsed['array'], $expected['array'], t('Set a simple array.')); - $this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], t('Set an associative array.')); - $this->assertEqual($parsed['array_deep'], $expected['array_deep'], t('Set a nested array.')); - $this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], t('Set a nested associative array.')); - $this->assertEqual($parsed['array_space'], $expected['array_space'], t('Set an array with a whitespace in the key.')); - $this->assertEqual($parsed, $expected, t('Entire parsed .info string and expected array are identical.')); - } -} diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 74db842..7ea9de5 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1315,7 +1315,7 @@ function system_modules_uninstall_confirm_form($storage) { // Construct the hidden form elements and list items. foreach (array_filter($storage['uninstall']) as $module => $value) { - $info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.yml'); + $info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info.yml'); $uninstall[] = $info['name']; $form['uninstall'][$module] = array('#type' => 'hidden', '#value' => 1, diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index c10a3b5..d824380 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1694,7 +1694,7 @@ function hook_system_theme_info() { * * This hook is invoked in _system_rebuild_module_data() and in * _system_rebuild_theme_data(). A module may implement this hook in order to - * add to or alter the data generated by reading the .yml file with + * add to or alter the data generated by reading the .info.yml file with * drupal_parse_info_file(). * * @param $info diff --git a/core/modules/system/system.module b/core/modules/system/system.module index abe7184..f686086 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2756,11 +2756,11 @@ function _system_rebuild_module_data() { $modules[$key]->filename = $module->uri; // Look for the info file. - $module->info = drupal_parse_info_file(dirname($module->uri) . '/' . $module->name . '.yml'); + $module->info = drupal_parse_info_file(dirname($module->uri) . '/' . $module->name . '.info.yml'); // Add the info file modification time, so it becomes available for // contributed modules to use for ordering module lists. - $module->info['mtime'] = filemtime(dirname($module->uri) . '/' . $module->name . '.yml'); + $module->info['mtime'] = filemtime(dirname($module->uri) . '/' . $module->name . '.info.yml'); // Skip modules that don't provide info. if (empty($module->info)) { @@ -2866,7 +2866,7 @@ function _system_update_bootstrap_status() { */ function _system_rebuild_theme_data() { // Find themes - $themes = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.yml$/', 'themes'); + $themes = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info.yml$/', 'themes'); // Allow modules to add further themes. if ($module_themes = module_invoke_all('system_theme_info')) { foreach ($module_themes as $name => $uri) { diff --git a/core/modules/system/tests/common_test_info.txt b/core/modules/system/tests/common_test_info.txt index caacf80d..ae217b9 100644 --- a/core/modules/system/tests/common_test_info.txt +++ b/core/modules/system/tests/common_test_info.txt @@ -1,10 +1,9 @@ ---- -# Test parsing with a simple string. -simple_string: A simple string +; Test parsing with a simple string. +simple_string = A simple string -# Test that the VERSION constant substitution works -version: VERSION +; Test that constants can be used as values. +simple_constant = WATCHDOG_INFO -# After parsing the .info file, 'double_colon' should hold the literal value. -# Parsing should not throw a fatal error or try to access a class constant. -double_colon: dummyClassName:: +; After parsing the .info file, 'double_colon' should hold the literal value. +; Parsing should not throw a fatal error or try to access a class constant. +double_colon = dummyClassName:: diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc index 64ce974..2bacac4 100644 --- a/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -149,15 +149,15 @@ function update_process_info_list(&$projects, $list, $project_type, $status, $ad continue; } - // If we don't already know it, grab the change time on the .yml file + // If we don't already know it, grab the change time on the .info.yml file // itself. Note: we need to use the ctime, not the mtime (modification // time) since many (all?) tar implementations will go out of their way to // set the mtime on the files it creates to the timestamps recorded in the // tarball. We want to see the last time the file was changed on disk, - // which is left alone by tar and correctly set to the time the .yml file - // was unpacked. + // which is left alone by tar and correctly set to the time the .info.yml + // file was unpacked. if (!isset($file->info['_info_file_ctime'])) { - $info_filename = dirname($file->uri) . '/' . $file->name . '.yml'; + $info_filename = dirname($file->uri) . '/' . $file->name . '.info.yml'; $file->info['_info_file_ctime'] = filectime($info_filename); } @@ -809,13 +809,13 @@ function update_project_cache($cid) { * Filters the project .info data to only save attributes we need. * * @param array $info - * Array of .yml file data as returned by drupal_parse_info_file(). + * Array of .info.yml file data as returned by drupal_parse_info_file(). * @param $additional_whitelist * (optional) Array of additional elements to be collected from the .info * file. Defaults to array(). * * @return - * Array of .yml file data we need for the update manager. + * Array of .info.yml file data we need for the update manager. * * @see update_process_info_list() */ diff --git a/core/modules/update/update.module b/core/modules/update/update.module index b9e0e0b..1f45ce7 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -694,7 +694,7 @@ function update_verify_update_archive($project, $archive_file, $directory) { // functionality). $compatible_project = FALSE; $incompatible = array(); - $files = file_scan_directory("$directory/$project", '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.yml$/', array('key' => 'name', 'min_depth' => 0)); + $files = file_scan_directory("$directory/$project", '/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info.yml$/', array('key' => 'name', 'min_depth' => 0)); foreach ($files as $key => $file) { // Get the .info file for the module or theme this file belongs to. $info = drupal_parse_info_file($file->uri); diff --git a/core/scripts/convert-info-yml.php b/core/scripts/convert-info-yml.php new file mode 100644 index 0000000..a5bfaed --- /dev/null +++ b/core/scripts/convert-info-yml.php @@ -0,0 +1,130 @@ +