From 28ea5a0ff4fca7554701f5b2b573fde8c0097884 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 10 Nov 2020 12:14:56 +0100 Subject: [PATCH] The branch is now only the first digits before the first dot in version number. In order to change from versions 2.10.x to 11.x.y, Piwigo needs to only consider 11 as the branch, and not 11.x. Or else it will mess up with minor and major updates. --- include/functions.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/functions.inc.php b/include/functions.inc.php index 1a2fc2f5e..c9124e70e 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -2085,14 +2085,17 @@ function get_privacy_level_options() /** - * return the branch from the version. For example version 2.2.4 is for branch 2.2 + * return the branch from the version. For example version 11.1.2 is on branch 11 * * @param string $version * @return string */ function get_branch_from_version($version) { - return implode('.', array_slice(explode('.', $version), 0, 2)); + // the algorithm is a bit complicated to just retrieve the first digits before + // the first ".". It's because before version 11.0.0, we used to take the 2 first + // digits, ie version 2.2.4 was on branch 2.2 + return implode('.', array_slice(explode('.', $version), 0, 1)); } /**