Skip to content

Commit 3ed757d

Browse files
committed
GLPI 9.4 compatibility
1 parent 253779e commit 3ed757d

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<version>
3030
<num>{VERSION}</num>
3131
<!-- Add as many compatibility tag you want -->
32+
<compatibility>9.4</compatibility>
3233
<compatibility>9.3</compatibility>
3334
<compatibility>9.2</compatibility>
3435
</version>

setup.php.tpl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function plugin_version_{LNAME}() {
5757
'requirements' => [
5858
'glpi' => [
5959
'min' => '9.2',
60-
'dev' => true
6160
]
6261
]
6362
];
@@ -70,13 +69,11 @@ function plugin_version_{LNAME}() {
7069
* @return boolean
7170
*/
7271
function plugin_{LNAME}_check_prerequisites() {
73-
// Strict version check (could be less strict, or could allow various version)
74-
if (version_compare(GLPI_VERSION, '9.2', 'lt')) {
75-
if (method_exists('Plugin', 'messageIncompatible')) {
76-
echo Plugin::messageIncompatible('core', '9.2');
77-
} else {
78-
echo "This plugin requires GLPI >= 9.2";
79-
}
72+
73+
//Version check is not done by core in GLPI < 9.2 but has to be delegated to core in GLPI >= 9.2.
74+
$version = preg_replace('/^((\d+\.?)+).*$/', '$1', GLPI_VERSION);
75+
if (version_compare($version, '9.2', '<')) {
76+
echo "This plugin requires GLPI >= 9.2";
8077
return false;
8178
}
8279
return true;

0 commit comments

Comments
 (0)