Skip to content

Commit 15952c2

Browse files
committed
Check GenericObject version
1 parent 95b9117 commit 15952c2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

inc/container.class.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
* -------------------------------------------------------------------------
2929
*/
3030

31-
use Glpi\Toolbox\Sanitizer;
32-
3331
class PluginFieldsContainer extends CommonDBTM
3432
{
3533
use Glpi\Features\Clonable;
@@ -150,8 +148,19 @@ public static function installBaseData(Migration $migration, $version)
150148
}
151149

152150
// Get itemtypes from PluginGenericobject
153-
$migration_genericobject_itemtype = [];
154151
if ($DB->tableExists('glpi_plugin_genericobject_types')) {
152+
// Check GenericObject version
153+
$genericobject_info = Plugin::getInfo('genericobject');
154+
if (
155+
isset($genericobject_info['version']) &&
156+
version_compare($genericobject_info['version'], '2.14.14', '>=')
157+
) {
158+
throw new \RuntimeException(
159+
'GenericObject plugin cannot be migrated. Please update it to the latest version.',
160+
);
161+
}
162+
163+
$migration_genericobject_itemtype = [];
155164
$result = $DB->request(['FROM' => 'glpi_plugin_genericobject_types']);
156165
foreach ($result as $type) {
157166
$migration_genericobject_itemtype[$type['itemtype']] = [

0 commit comments

Comments
 (0)