Skip to content

Commit 1a97159

Browse files
committed
Fix old script & forgotten file
1 parent 3254103 commit 1a97159

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

install/sql/update-3.2.2.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Activity\\Holidaycount' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginActivityHolidaycount';
2+
UPDATE `glpi_displaypreferences` SET `itemtype` = 'GlpiPlugin\\Activity\\Activity' WHERE `glpi_displaypreferences`.`itemtype` = 'PluginActivityActivity';

install/update_251_300.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,11 @@
3535
ini_set("max_execution_time", 0);
3636
chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
3737

38-
if (!defined('GLPI_ROOT')) {
39-
define('GLPI_ROOT', realpath('..'));
40-
}
41-
42-
include_once (GLPI_ROOT."/inc/autoload.function.php");
43-
include_once (GLPI_ROOT."/inc/db.function.php");
44-
include_once (GLPI_ROOT."/inc/based_config.php");
45-
include_once (GLPI_CONFIG_DIR."/config_db.php");
46-
include_once (GLPI_ROOT."/inc/define.php");
38+
//chdir(dirname($_SERVER["argv"][0]));
4739

48-
$GLPI = new GLPI();
49-
$GLPI->initLogger();
50-
Config::detectRootDoc();
40+
define("GLPI_DIR_ROOT", realpath(dirname($_SERVER["SCRIPT_FILENAME"]) . "/../../.."));
41+
require_once GLPI_DIR_ROOT . '/vendor/autoload.php';
42+
$kernel = new \Glpi\Kernel\Kernel($options['env'] ?? null);
5143

5244
if (is_writable(GLPI_SESSION_DIR)) {
5345
Session::setPath();
@@ -58,6 +50,8 @@
5850
$_SESSION['glpi_use_mode'] = 0;
5951
Session::loadLanguage();
6052

53+
global $DB;
54+
6155
if (!$DB->connected) {
6256
die("No DB connection\r\n");
6357
}
@@ -76,7 +70,7 @@ function update251to300() {
7670
$cats = $dbu->getAllDataFromTable('glpi_plugin_activity_activitytypes');
7771

7872
foreach ($cats as $cat) {
79-
$migrate_cat_activities_query = 'INSERT INTO `glpi_planningeventcategories` (`name`, `comment`, `old_id`)
73+
$migrate_cat_activities_query = 'INSERT INTO `glpi_planningeventcategories` (`name`, `comment`, `old_id`)
8074
VALUES("' . $cat['completename'] . '","' . addslashes($cat['comment']) . '","' . $cat['id'] . '")';
8175

8276
$DB->doQuery($migrate_cat_activities_query);
@@ -120,7 +114,7 @@ function update251to300() {
120114
} else {
121115
$name = $new_cat['name'];
122116
}
123-
$query = "UPDATE `glpi_planningexternalevents`
117+
$query = "UPDATE `glpi_planningexternalevents`
124118
SET `planningeventcategories_id`='" . $new_cat['id'] . "'
125119
WHERE `planningeventcategories_id`= " . $new_cat['old_id'] . ";";
126120
$DB->doQuery($query);
@@ -138,7 +132,7 @@ function update251to300() {
138132

139133
foreach ($new_events as $new_event) {
140134

141-
$query = "UPDATE `glpi_plugin_activity_planningexternalevents`
135+
$query = "UPDATE `glpi_plugin_activity_planningexternalevents`
142136
SET `planningexternalevents_id`='" . $new_event['id'] . "'
143137
WHERE `planningexternalevents_id`= " . $new_event['old_id'] . ";";
144138
$DB->doQuery($query);

0 commit comments

Comments
 (0)