Skip to content

Commit 5d4d0f2

Browse files
committed
Merge branch 'release/2.5.2'
2 parents 02d848c + 9253f01 commit 5d4d0f2

File tree

6 files changed

+55
-78
lines changed

6 files changed

+55
-78
lines changed

composer.json

-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
"prefer-stable": true,
44
"require-dev": {
55
"glpi-project/tools": "^0.1.2"
6-
},
7-
"require": {
8-
"zendframework/zend-loader": "^2.5"
96
}
107
}

composer.lock

+11-53
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

genericobject.xml

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<author>Walid Nouh</author>
2323
</authors>
2424
<versions>
25+
<version>
26+
<num>2.5.2</num>
27+
<compatibility>9.2</compatibility>
28+
</version>
2529
<version>
2630
<num>2.5.1</num>
2731
<compatibility>9.2</compatibility>

inc/autoload.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22

3-
use Zend\Loader\SplAutoloader;
4-
5-
class PluginGenericobjectAutoloader implements SplAutoloader
3+
class PluginGenericobjectAutoloader
64
{
75
protected $paths = [];
86

objects/objectinjection.class.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class %%INJECTIONCLASS%% extends %%CLASSNAME%%
4040
$this->table = getTableForItemType(get_parent_class($this));
4141
}
4242

43-
static function getTable() {
43+
static function getTable($classname = null) {
4444
4545
$parenttype = get_parent_class();
4646
return $parenttype::getTable();

setup.php

+38-18
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535
----------------------------------------------------------------------
3636
*/
3737

38-
define ('PLUGIN_GENERICOBJECT_VERSION', '2.5.1');
38+
define ('PLUGIN_GENERICOBJECT_VERSION', '2.5.2');
39+
40+
// Minimal GLPI version, inclusive
41+
define("PLUGIN_GENERICOBJECT_MIN_GLPI", "9.2");
42+
// Maximum GLPI version, exclusive
43+
define("PLUGIN_GENERICOBJECT_MAX_GLPI", "9.3");
3944

4045
if (!defined("GENERICOBJECT_DIR")) {
4146
define("GENERICOBJECT_DIR", GLPI_ROOT . "/plugins/genericobject");
@@ -89,7 +94,6 @@
8994
}
9095

9196
// Autoload class generated in files/_plugins/genericobject/inc/
92-
include_once( GENERICOBJECT_DIR . "/vendor/autoload.php");
9397
include_once( GENERICOBJECT_DIR . "/inc/autoload.php");
9498
include_once( GENERICOBJECT_DIR . "/inc/functions.php");
9599
if (file_exists(GENERICOBJECT_DIR . "/log_filter.settings.php")) {
@@ -185,18 +189,20 @@ function plugin_post_init_genericobject() {
185189
* @return array
186190
*/
187191
function plugin_version_genericobject() {
188-
return array ('name' => __("Objects management", "genericobject"),
189-
'version' => PLUGIN_GENERICOBJECT_VERSION,
190-
'author' => "<a href=\"mailto:[email protected]\">Teclib'</a> & siprossii",
191-
'homepage' => 'https://github.com/pluginsGLPI/genericobject',
192-
'license' => 'GPLv2+',
193-
'requirements' => [
194-
'glpi' => [
195-
'min' => '9.2',
196-
'dev' => true
197-
]
198-
]
199-
);
192+
return [
193+
'name' => __("Objects management", "genericobject"),
194+
'version' => PLUGIN_GENERICOBJECT_VERSION,
195+
'author' => "<a href=\"mailto:[email protected]\">Teclib'</a> & siprossii",
196+
'homepage' => 'https://github.com/pluginsGLPI/genericobject',
197+
'license' => 'GPLv2+',
198+
'requirements' => [
199+
'glpi' => [
200+
'min' => PLUGIN_GENERICOBJECT_MIN_GLPI,
201+
'max' => PLUGIN_GENERICOBJECT_MAX_GLPI,
202+
'dev' => true, //Required to allow 9.2-dev
203+
]
204+
]
205+
];
200206
}
201207

202208
/**
@@ -206,11 +212,25 @@ function plugin_version_genericobject() {
206212
* @return boolean
207213
*/
208214
function plugin_genericobject_check_prerequisites() {
209-
$version = rtrim(GLPI_VERSION, '-dev');
210-
if (version_compare($version, '9.2', 'lt')) {
211-
echo "This plugin requires GLPI 9.2 or higher";
212-
return false;
215+
216+
//Version check is not done by core in GLPI < 9.2 but has to be delegated to core in GLPI >= 9.2.
217+
if (!method_exists('Plugin', 'checkGlpiVersion')) {
218+
$version = preg_replace('/^((\d+\.?)+).*$/', '$1', GLPI_VERSION);
219+
$matchMinGlpiReq = version_compare($version, PLUGIN_GENERICOBJECT_MIN_GLPI, '>=');
220+
$matchMaxGlpiReq = version_compare($version, PLUGIN_GENERICOBJECT_MAX_GLPI, '<');
221+
222+
if (!$matchMinGlpiReq || !$matchMaxGlpiReq) {
223+
echo vsprintf(
224+
'This plugin requires GLPI >= %1$s and < %2$s.',
225+
[
226+
PLUGIN_GENERICOBJECT_MIN_GLPI,
227+
PLUGIN_GENERICOBJECT_MAX_GLPI,
228+
]
229+
);
230+
return false;
231+
}
213232
}
233+
214234
return true;
215235
}
216236

0 commit comments

Comments
 (0)