Fix selection of migration script

This commit is contained in:
Laurent Destailleur 2022-01-26 19:12:02 +01:00
parent 60fff852ab
commit 2e525a719d

View File

@ -307,8 +307,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$filelist = array();
$i = 0;
$ok = 0;
$from = '^'.$newversionfrom;
$to = $newversionto.'\.sql$';
$from = '^'.preg_quote($newversionfrom, '/');
$to = preg_quote($newversionto.'.sql', '/').'$';
// Get files list
$filesindir = array();
@ -326,9 +326,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
// Define which file to run
foreach ($filesindir as $file) {
if (preg_match('/'.$from.'/i', $file)) {
if (preg_match('/'.$from.'\-/i', $file)) {
$filelist[] = $file;
} elseif (preg_match('/'.$to.'/i', $file)) { // First test may be false if we migrate from x.y.* to x.y.*
} elseif (preg_match('/\-'.$to.'/i', $file)) { // First test may be false if we migrate from x.y.* to x.y.*
$filelist[] = $file;
}
}