diff --git a/lib/classes/base.php b/lib/classes/base.php index 9dbdf0bdff..5b6adb304e 100644 --- a/lib/classes/base.php +++ b/lib/classes/base.php @@ -806,7 +806,10 @@ abstract class base implements cache_cacheableInterface $upgrader->add_steps_complete(1) ->add_steps(count($list_patches)) ->set_current_message(sprintf(_('Applying patches on %s'), $this->get_dbname())); - ksort($list_patches); + + uasort($list_patches, function (\patchInterface $patch1, \patchInterface $patch2) { + return version::lt($patch1->get_release(), $patch2->get_release()) ? -1 : 1; + }); $success = true;