From ae3af1d860eab121707fc875929734e0d43db979 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 3 Aug 2020 12:21:37 +0200 Subject: [PATCH] MDL-69475 install: Version, env. and minimal changes before branching - Also bump travis to get builds against 310_STABLE. - And backup release to match 3.10 Note this doesn't aim to be a complete change-set, but just the minimum to switch to 3-digit $branches and keep installation, checks and tests running and passing. --- .travis.yml | 2 +- backup/backup.class.php | 2 +- lib/environmentlib.php | 15 +++++++++++---- lib/tests/setuplib_test.php | 2 +- version.php | 4 ++-- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d751251ccc2..746c6c68701 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,7 +212,7 @@ before_script: # We need the official upstream for comparison git remote add upstream https://github.com/moodle/moodle.git; - git fetch upstream master; + git fetch upstream MOODLE_310_STABLE; export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`"; export GIT_COMMIT="$TRAVIS_COMMIT"; export UPSTREAM_FETCH_HEAD=`git rev-parse FETCH_HEAD` diff --git a/backup/backup.class.php b/backup/backup.class.php index 54fca21ce78..3a57d0475eb 100644 --- a/backup/backup.class.php +++ b/backup/backup.class.php @@ -160,7 +160,7 @@ abstract class backup implements checksumable { /** * Usually same than major release zero version, mainly for informative/historic purposes. */ - const RELEASE = '4.0'; + const RELEASE = '3.10'; /** * Cipher to be used in backup and restore operations. diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 64a3a4ffed9..df11fa907b9 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -368,7 +368,7 @@ function get_latest_version_available($version, $env_select) { return false; } /// First we look for exact version - if (in_array($version, $versions)) { + if (in_array($version, $versions, true)) { return $version; } else { $found_version = false; @@ -416,7 +416,7 @@ function get_environment_for_version($version, $env_select) { } /// If the version requested is available - if (!in_array($version, $versions)) { + if (!in_array($version, $versions, true)) { return false; } @@ -808,8 +808,15 @@ function environment_check_moodle($version, $env_select) { $release = get_config('', 'release'); $current_version = normalize_version($release); if (strpos($release, 'dev') !== false) { - // when final version is required, dev is NOT enough! - $current_version = $current_version - 0.1; + // When final version is required, dev is NOT enough so, at all effects + // it's like we are running the previous version. + $versionarr = explode('.', $current_version); + if (isset($versionarr[1]) and $versionarr[1] > 0) { + $versionarr[1]--; + $current_version = implode('.', $versionarr); + } else { + $current_version = $current_version - 0.1; + } } /// And finally compare them, saving results diff --git a/lib/tests/setuplib_test.php b/lib/tests/setuplib_test.php index 1e6c3b37c76..3e00f6bc148 100644 --- a/lib/tests/setuplib_test.php +++ b/lib/tests/setuplib_test.php @@ -43,7 +43,7 @@ class core_setuplib_testcase extends advanced_testcase { } else { $docroot = $CFG->docroot; } - $this->assertRegExp('~^' . preg_quote($docroot, '') . '/\d{2}/' . current_language() . '/course/editing$~', + $this->assertRegExp('~^' . preg_quote($docroot, '') . '/\d{2,3}/' . current_language() . '/course/editing$~', get_docs_url('course/editing')); } diff --git a/version.php b/version.php index 6c761f6a13a..3e57c1c7964 100644 --- a/version.php +++ b/version.php @@ -32,6 +32,6 @@ defined('MOODLE_INTERNAL') || die(); $version = 2020081400.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. -$release = '4.0dev (Build: 20200814)'; // Human-friendly version name -$branch = '40'; // This version's branch. +$release = '3.10dev (Build: 20200814)';// Human-friendly version name +$branch = '310'; // This version's branch. $maturity = MATURITY_ALPHA; // This version's maturity level.