3535ini_set ("max_execution_time " , 0 );
3636chdir (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
5244if (is_writable (GLPI_SESSION_DIR )) {
5345 Session::setPath ();
5850$ _SESSION ['glpi_use_mode ' ] = 0 ;
5951Session::loadLanguage ();
6052
53+ global $ DB ;
54+
6155if (!$ 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