Skip to content

Commit a74d109

Browse files
committed
Compatibility check was not properly checking version gap
1 parent fe00913 commit a74d109

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

classes/local/plugin/addon.php

-9
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ final public function get_release() {
4747
return $localxp ? $localxp->release : '-';
4848
}
4949

50-
/**
51-
* Get the version difference.
52-
*
53-
* @return int
54-
*/
55-
public function get_version_diff() {
56-
return 0;
57-
}
58-
5950
/**
6051
* Whether the plugin is activated.
6152
*

classes/local/setting/compatibility_check_setting.php

+15-14
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,23 @@ protected function get_html_content() {
5959

6060
$blockxp = $pluginman->get_plugin_info('block_xp');
6161
$localxp = $pluginman->get_plugin_info('local_xp');
62+
$recentishlocalxp = 2023100800; // v1.15.0.
6263
$humanbranch = moodle_major_version() ?: 'v?';
6364

65+
if ($localxp && $localxp->versiondb < $recentishlocalxp) {
66+
$messages[] = [
67+
'title' => get_string('outofsyncexcessive', 'block_xp'),
68+
'message' => get_string('outofsyncexcessiveinfo', 'block_xp'),
69+
'url' => 'https://docs.levelup.plus/xp/docs/requirements-compatibility#out-of-sync',
70+
];
71+
} else if ($addon->is_out_of_sync()) {
72+
$messages[] = [
73+
'title' => get_string('outofsync', 'block_xp'),
74+
'message' => get_string('outofsyncinfo', 'block_xp'),
75+
'url' => 'https://docs.levelup.plus/xp/docs/requirements-compatibility#out-of-sync',
76+
];
77+
}
78+
6479
if ($CFG->branch >= 39) {
6580
if (!empty($blockxp->pluginsupported) && ($CFG->branch < $blockxp->pluginsupported[0]
6681
|| $CFG->branch > $blockxp->pluginsupported[1])) {
@@ -82,20 +97,6 @@ protected function get_html_content() {
8297
}
8398
}
8499

85-
if ($addon->get_version_diff() > 270) {
86-
$messages[] = [
87-
'title' => get_string('outofsyncexcessive', 'block_xp'),
88-
'message' => get_string('outofsyncexcessiveinfo', 'block_xp'),
89-
'url' => 'https://docs.levelup.plus/xp/docs/requirements-compatibility#out-of-sync',
90-
];
91-
} else if ($addon->is_out_of_sync()) {
92-
$messages[] = [
93-
'title' => get_string('outofsync', 'block_xp'),
94-
'message' => get_string('outofsyncinfo', 'block_xp'),
95-
'url' => 'https://docs.levelup.plus/xp/docs/requirements-compatibility#out-of-sync',
96-
];
97-
}
98-
99100
return di::get('renderer')->render_from_template('block_xp/admin-compatibility-check', [
100101
'haswarnings' => !empty($messages),
101102
'warnings' => $messages,

0 commit comments

Comments
 (0)