Commit 76a8ca15 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1871219: Allow manual help link deal with latest branch still being in rc state



Change-Id: I80342f979c4bc7ba83a0cb0a3b993be37029398d
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent a747728c
......@@ -4468,9 +4468,9 @@ function cron_clean_internal_activity_notifications() {
}
/**
* Cronjob to check Launchpad for the latest Mahara version
* Cronjob to check Mahara.org for the latest Mahara version
*/
function cron_check_for_updates() {
function cron_check_for_updates($raw=false) {
$url = 'https://mahara.org/local/versions.php';
$request = array(
......@@ -4489,6 +4489,9 @@ function cron_check_for_updates() {
return;
}
$versions = $data->message->versions;
if ($raw) {
return $versions;
}
// Lets record the needed info locally as the cron only fetches the info once a day
$latestmajorversion = max(array_keys((array)$versions));
......
......@@ -119,16 +119,22 @@ function _get_manual_language() {
function _get_mahara_version() {
$release = get_config("release");
$series = get_config("series");
if (preg_match('/dev$/', $release)) {
list($year, $month) = explode('.', $series);
if ($month == '04') {
$month = '10';
$year = (int)$year - 1;
}
else {
$month = '04';
if (preg_match('/dev$/', $release) || preg_match('/rc/', $release)) {
// We are either on master or a branch in release candidate
// so we need the latest released branch
$versions = cron_check_for_updates(true);
// Need this of PHP older than 7.3
if (!function_exists('array_key_first')) {
function array_key_first(array $arr) {
foreach($arr as $key => $unused) {
return $key;
}
return NULL;
}
}
$series = $year . '.' . $month;
$series = array_key_first((array)$versions);
}
return $series;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment