Skip to content

Commit

Permalink
Add GLPI 9.5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
xacobofg committed Jul 13, 2020
1 parent 4cf19f2 commit 6fd36ae
Showing 1 changed file with 3 additions and 34 deletions.
37 changes: 3 additions & 34 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
@link https://tic.gal
@since 2018
---------------------------------------------------------------------- */
define ('PLUGIN_COSTS_VERSION', '1.2.0');
define ('PLUGIN_COSTS_VERSION', '1.3.0');
// Minimal GLPI version, inclusive
define("PLUGIN_COSTS_MIN_GLPI", "9.3.0");
define("PLUGIN_COSTS_MIN_GLPI", "9.5");
// Maximum GLPI version, exclusive
define("PLUGIN_COSTS_MAX_GLPI", "9.5");
define("PLUGIN_COSTS_MAX_GLPI", "9.6");

global $CFG_GLPI;
if (!defined('PLUGIN_COSTS_NUMBER_STEP')) {
Expand All @@ -49,7 +49,6 @@ function plugin_version_costs() {
'author' => '<a href="https://tic.gal">TICgal</a>',
'homepage' => 'https://tic.gal/en/project/costs-control-plugin-glpi/',
'license' => 'GPLv3+',
'minGlpiVersion' => "9.3",
'requirements' => [
'glpi' => [
'min' => PLUGIN_COSTS_MIN_GLPI,
Expand All @@ -58,36 +57,6 @@ function plugin_version_costs() {
]];
}

/**
* Check plugin's prerequisites before installation
*/
function plugin_costs_check_prerequisites() {
$version = preg_replace('/^((\d+\.?)+).*$/', '$1', GLPI_VERSION);
if (version_compare($version, '9.2', '<')) {
$matchMinGlpiReq = version_compare($version, PLUGIN_COSTS_MIN_GLPI, '>=');
$matchMaxGlpiReq = version_compare($version, PLUGIN_COSTS_MAX_GLPI, '<');
if (!$matchMinGlpiReq || !$matchMaxGlpiReq) {
echo vsprintf(
'This plugin requires GLPI >= %1$s and < %2$s.',
[
PLUGIN_COSTS_MIN_GLPI,
PLUGIN_COSTS_MAX_GLPI,
]
);
return false;
}
}

return true;
}

/**
* Check plugin's config before activation
*/
function plugin_costs_check_config($verbose = false) {
return true;
}

function plugin_init_costs() {
global $PLUGIN_HOOKS;

Expand Down

0 comments on commit 6fd36ae

Please sign in to comment.