Skip to content

Commit

Permalink
GLPI 10.0 (2022 version) is not using PDO
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed May 5, 2022
1 parent cbf2d6c commit d1472bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions inc/container.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,13 @@ static function install(Migration $migration, $version) {
}

// Fix containers names that were generated prior to Fields 1.9.2.
$glpi_version = preg_replace('/^((\d+\.?)+).*$/', '$1', GLPI_VERSION);
$bad_named_containers = $DB->request(
[
'FROM' => self::getTable(),
'WHERE' => [
'name' => [
'REGEXP',
// Regex will be escaped by PDO in GLPI 10+, but has to be escaped for GLPI < 10
version_compare($glpi_version, '10.0', '>=') ? '\d+' : $DB->escape('\d+')
$DB->escape('\d+')
],
],
]
Expand Down
4 changes: 1 addition & 3 deletions inc/toolbox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,13 @@ private function replaceIntByLetters($str) {
public function fixFieldsNames(Migration $migration, $condition) {
global $DB;

$glpi_version = preg_replace('/^((\d+\.?)+).*$/', '$1', GLPI_VERSION);
$bad_named_fields = $DB->request(
[
'FROM' => PluginFieldsField::getTable(),
'WHERE' => [
'name' => [
'REGEXP',
// Regex will be escaped by PDO in GLPI 10+, but has to be escaped for GLPI < 10
version_compare($glpi_version, '10.0', '>=') ? '[0-9]+' : $DB->escape('[0-9]+')
$DB->escape('[0-9]+')
],
$condition,
],
Expand Down

0 comments on commit d1472bc

Please sign in to comment.