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(); $filelist = array();
$i = 0; $i = 0;
$ok = 0; $ok = 0;
$from = '^'.$newversionfrom; $from = '^'.preg_quote($newversionfrom, '/');
$to = $newversionto.'\.sql$'; $to = preg_quote($newversionto.'.sql', '/').'$';
// Get files list // Get files list
$filesindir = array(); $filesindir = array();
@ -326,9 +326,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
// Define which file to run // Define which file to run
foreach ($filesindir as $file) { foreach ($filesindir as $file) {
if (preg_match('/'.$from.'/i', $file)) { if (preg_match('/'.$from.'\-/i', $file)) {
$filelist[] = $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; $filelist[] = $file;
} }
} }