From 8606db9e77bcd8157184a40191dbf98b6975ce78 Mon Sep 17 00:00:00 2001 From: Siarhei Karavai Date: Mon, 25 Mar 2019 18:57:06 +0300 Subject: [PATCH] Add support for file names with multiple dots (#4211) Fixes #4210. Credit to @GinoPane --- modules/system/classes/VersionManager.php | 4 ++-- tests/unit/system/classes/VersionManagerTest.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/system/classes/VersionManager.php b/modules/system/classes/VersionManager.php index 482fe40f4..bd18f82da 100644 --- a/modules/system/classes/VersionManager.php +++ b/modules/system/classes/VersionManager.php @@ -530,7 +530,7 @@ class VersionManager protected function extractScriptsAndComments($details) { if (is_array($details)) { - $fileNamePattern = '/^[a-z_\-0-9]*\.php$/i'; + $fileNamePattern = '/^[a-z_\-0-9\.]*\.php$/i'; $comments = array_values(array_filter($details, function ($detail) use ($fileNamePattern) { return !preg_match($fileNamePattern, $detail); @@ -545,5 +545,5 @@ class VersionManager } return array($comments, $scripts); -} + } } diff --git a/tests/unit/system/classes/VersionManagerTest.php b/tests/unit/system/classes/VersionManagerTest.php index 6311d1619..7cf87a338 100644 --- a/tests/unit/system/classes/VersionManagerTest.php +++ b/tests/unit/system/classes/VersionManagerTest.php @@ -170,6 +170,22 @@ class VersionManagerTest extends TestCase 'scripts_can_go_first.php', 'scripts_can_go_anywhere.php' ] + ], + [ + [ + 'file.name.with.dots.php', + 'The first update comment', + '1.0.2.scripts_can_go_anywhere.php', + 'The second update comment', + ], + [ + 'The first update comment', + 'The second update comment' + ], + [ + 'file.name.with.dots.php', + '1.0.2.scripts_can_go_anywhere.php' + ] ] ]; }