Skip to content

Commit 04b8510

Browse files
committed
script for 2022
1 parent 78625db commit 04b8510

3 files changed

Lines changed: 81 additions & 3 deletions

File tree

README

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
********************
2+
***** FRANCAIS *****
3+
********************
4+
5+
Si vous souhaitez utiliser le format de ticket personnalisé 'ymd0001'
6+
la structure de la base de GLPI ne permet pas cette utilisation au-delà du 31.12.2021.
7+
Pour corriger ce problème, vous devez passer le script migrationFor2022.php
8+
9+
10+
********************
11+
***** ENGLISH *****
12+
********************
13+
14+
If you want to use custom ticket format 'ymd0001'
15+
the structure of the GLPI database does not allow this use beyond 31.12.2021.
16+
To correct this problem, you need to pass the migrationFor2022.php script

script/migrationFor2022.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
-------------------------------------------------------------------------
4+
5+
LICENSE
6+
7+
This file is part of Behaviors plugin for GLPI.
8+
9+
Behaviors is free software: you can redistribute it and/or modify
10+
it under the terms of the GNU Affero General Public License as published by
11+
the Free Software Foundation, either version 3 of the License, or
12+
(at your option) any later version.
13+
14+
Behaviors is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU Affero General Public License for more details.
18+
19+
You should have received a copy of the GNU Affero General Public License
20+
along with Behaviors. If not, see <http://www.gnu.org/licenses/>.
21+
22+
@package behaviors
23+
@author Nelly Mahu-Lasson
24+
@copyright Copyright (c) 2022 Behaviors plugin team
25+
@license AGPL License 3.0 or (at your option) any later version
26+
http://www.gnu.org/licenses/agpl-3.0-standalone.html
27+
@link https://forge.glpi-project.org/projects/behaviors
28+
@link http://www.glpi-project.org/
29+
@since version 0.83.4
30+
31+
--------------------------------------------------------------------------
32+
*/
33+
if (!defined('GLPI_ROOT')) {
34+
include ('../../../inc/includes.php');
35+
}
36+
37+
38+
// for big database
39+
ini_set("max_execution_time", "0");
40+
ini_set("memory_limit", "-1");
41+
42+
global $DB;
43+
44+
$sql = "SELECT `table_name`
45+
FROM information_schema.tables
46+
WHERE `table_schema` = '".$DB->dbdefault."'
47+
AND `table_name` LIKE 'glpi_%'";
48+
$tables = $DB->request($sql);
49+
50+
foreach ($tables as $table) {
51+
if ($DB->FieldExists($table['table_name'], 'tickets_id')) {
52+
$query = "ALTER TABLE ".$table['table_name'] ." CHANGE `tickets_id` `tickets_id` INT(11) UNSIGNED NOT NULL;";
53+
$DB->queryOrDie($query);
54+
}
55+
if ($DB->FieldExists($table['table_name'], 'items_id')) {
56+
$query = "ALTER TABLE ".$table['table_name'] ." CHANGE `items_id` `items_id` INT(11) UNSIGNED NOT NULL;";
57+
$DB->queryOrDie($query);
58+
}
59+
}
60+
61+
$query = "ALTER TABLE `glpi_tickets` CHANGE `id` `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT;";
62+
$DB->queryOrDie($query);

setup.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* @version $Id$
3+
* @version $Id: setup.php 192 2016-08-12 08:07:12Z yllen $
44
-------------------------------------------------------------------------
55
66
LICENSE
@@ -22,7 +22,7 @@
2222
2323
@package behaviors
2424
@author Remi Collet, Nelly Mahu-Lasson
25-
@copyright Copyright (c) 2010-2018 Behaviors plugin team
25+
@copyright Copyright (c) 2010-2022 Behaviors plugin team
2626
@license AGPL License 3.0 or (at your option) any later version
2727
http://www.gnu.org/licenses/agpl-3.0-standalone.html
2828
@link https://forge.glpi-project.org/projects/behaviors
@@ -108,7 +108,7 @@ function plugin_init_behaviors() {
108108
function plugin_version_behaviors() {
109109

110110
return ['name' => __('Behaviours', 'behaviors'),
111-
'version' => '2.1.4',
111+
'version' => '2.1.5',
112112
'license' => 'AGPLv3+',
113113
'author' => 'Remi Collet, Nelly Mahu-Lasson',
114114
'homepage' => 'https://forge.glpi-project.org/projects/behaviors',

0 commit comments

Comments
 (0)