diff options
author | Robin Appelman <robin@icewind.nl> | 2025-04-02 14:29:08 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-04-02 12:52:25 +0000 |
commit | 494bd7549b8ed6ac902269424ada5f736a6e0346 (patch) | |
tree | 532f9d3cfa81a47338c565a29c26a4507f1c3257 | |
parent | abcf1e40583fda2a7f116b4839c638dc35f8ffa7 (diff) | |
download | nextcloud-server-backport/51866/stable29.tar.gz nextcloud-server-backport/51866/stable29.zip |
fix: use proper migration sorting when checking if a migration needs to be executedbackport/51866/stable29
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | lib/private/DB/MigrationService.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index daa2d9940c7..398b92987a8 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -221,9 +221,9 @@ class MigrationService { if ($versionA !== $versionB) { return ($versionA < $versionB) ? -1 : 1; } - return ($matchA[2] < $matchB[2]) ? -1 : 1; + return strnatcmp($matchA[2], $matchB[2]); } - return (basename($a) < basename($b)) ? -1 : 1; + return strnatcmp(basename($a), basename($b)); } /** @@ -272,7 +272,7 @@ class MigrationService { $toBeExecuted = []; foreach ($availableMigrations as $v) { - if ($to !== 'latest' && $v > $to) { + if ($to !== 'latest' && ($this->sortMigrations($v, $to) > 0)) { continue; } if ($this->shallBeExecuted($v, $knownMigrations)) { |