MOBILE-3819 core: Increase minimum Moodle version to 3.5
parent
c63ec5d8ae
commit
d944cb1978
|
@ -65,14 +65,10 @@ export class CoreSite {
|
|||
static readonly WS_CACHE_TABLE = 'wscache_2';
|
||||
static readonly CONFIG_TABLE = 'core_site_config';
|
||||
|
||||
static readonly MINIMUM_MOODLE_VERSION = '3.1';
|
||||
static readonly MINIMUM_MOODLE_VERSION = '3.5';
|
||||
|
||||
// Versions of Moodle releases.
|
||||
protected readonly MOODLE_RELEASES = {
|
||||
'3.1': 2016052300,
|
||||
'3.2': 2016120500,
|
||||
'3.3': 2017051503,
|
||||
'3.4': 2017111300,
|
||||
static readonly MOODLE_RELEASES = {
|
||||
'3.5': 2018051700,
|
||||
'3.6': 2018120300,
|
||||
'3.7': 2019052000,
|
||||
|
@ -495,6 +491,13 @@ export class CoreSite {
|
|||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async request<T = unknown>(method: string, data: any, preSets: CoreSiteWSPreSets, retrying?: boolean): Promise<T> {
|
||||
if (this.isLoggedOut()) {
|
||||
// Site is logged out, it cannot call WebServices.
|
||||
CoreEvents.trigger(CoreEvents.SESSION_EXPIRED, {}, this.id);
|
||||
|
||||
throw new CoreError(Translate.instant('core.lostconnection'));
|
||||
}
|
||||
|
||||
const initialToken = this.token || '';
|
||||
data = data || {};
|
||||
|
||||
|
@ -1812,12 +1815,12 @@ export class CoreSite {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (typeof this.MOODLE_RELEASES[data.major] == 'undefined') {
|
||||
if (CoreSite.MOODLE_RELEASES[data.major] === undefined) {
|
||||
// Major version not found. Use the last one.
|
||||
data.major = Object.keys(this.MOODLE_RELEASES).pop()!;
|
||||
data.major = Object.keys(CoreSite.MOODLE_RELEASES).pop()!;
|
||||
}
|
||||
|
||||
return this.MOODLE_RELEASES[data.major] + data.minor;
|
||||
return CoreSite.MOODLE_RELEASES[data.major] + data.minor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1847,7 +1850,7 @@ export class CoreSite {
|
|||
*/
|
||||
protected getNextMajorVersionNumber(version: string): number {
|
||||
const data = this.getMajorAndMinor(version);
|
||||
const releases = Object.keys(this.MOODLE_RELEASES);
|
||||
const releases = Object.keys(CoreSite.MOODLE_RELEASES);
|
||||
|
||||
if (!data) {
|
||||
// Invalid version.
|
||||
|
@ -1858,10 +1861,10 @@ export class CoreSite {
|
|||
|
||||
if (position == -1 || position == releases.length - 1) {
|
||||
// Major version not found or it's the last one. Use the last one.
|
||||
return this.MOODLE_RELEASES[releases[position]];
|
||||
return CoreSite.MOODLE_RELEASES[releases[position]];
|
||||
}
|
||||
|
||||
return this.MOODLE_RELEASES[releases[position + 1]];
|
||||
return CoreSite.MOODLE_RELEASES[releases[position + 1]];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -606,14 +606,11 @@ export class CoreSitesProvider {
|
|||
return CoreSitesProvider.INVALID_VERSION;
|
||||
}
|
||||
|
||||
const version31 = 2016052300;
|
||||
const release31 = CoreSite.MINIMUM_MOODLE_VERSION;
|
||||
|
||||
// Try to validate by version.
|
||||
if (info.version) {
|
||||
const version = parseInt(info.version, 10);
|
||||
if (!isNaN(version)) {
|
||||
if (version >= version31) {
|
||||
if (version >= CoreSite.MOODLE_RELEASES[CoreSite.MINIMUM_MOODLE_VERSION]) {
|
||||
return this.validateWorkplaceVersion(info);
|
||||
}
|
||||
}
|
||||
|
@ -622,7 +619,7 @@ export class CoreSitesProvider {
|
|||
// We couldn't validate by version number. Let's try to validate by release number.
|
||||
const release = this.getReleaseNumber(info.release || '');
|
||||
if (release) {
|
||||
if (release >= release31) {
|
||||
if (release >= CoreSite.MINIMUM_MOODLE_VERSION) {
|
||||
return this.validateWorkplaceVersion(info);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue