forked from glpi-project/glpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_0712_0713.php
72 lines (62 loc) · 2.77 KB
/
update_0712_0713.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2018 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GLPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
/// Update from 0.71.2 to 0.71.3
function update0712to0713() {
global $DB, $CFG_GLPI;
if (!$DB->fieldExists("glpi_rule_cache_software", "ignore_ocs_import", false)) {
$query = "ALTER TABLE `glpi_rule_cache_software`
ADD `ignore_ocs_import` VARCHAR( 255 ) NULL ";
$DB->queryOrDie($query, "0.71.3 add ignore_ocs_import field in dictionary cache");
}
// Update to longtext for fields which may be very long
if ($DB->fieldExists("glpi_kbitems", "answer", false)) {
if (isIndex("glpi_kbitems", "fulltext")) { // to avoid pb in altering column answer
$query = "ALTER TABLE `glpi_kbitems`
DROP INDEX `fulltext`";
$DB->queryOrDie($query, "0.71.3 alter kbitem drop index Fulltext");
}
// field question : only to change latin1 to utf-8 if not done in update 0.68.3 to 0.71
// before creating index fulltext based on 2 fields (perhaps both are not in same encoding)
$query = "ALTER TABLE `glpi_kbitems`
CHANGE `question` `question` TEXT,
CHANGE `answer` `answer` LONGTEXT NULL DEFAULT NULL ";
$DB->queryOrDie($query, "0.71.3 alter kbitem answer field to longtext");
$query = "ALTER TABLE `glpi_kbitems`
ADD FULLTEXT `fulltext` (`question`,`answer`)";
$DB->queryOrDie($query, "0.71.3 alter kbitem re-add index Fulltext");
}
if ($DB->fieldExists("glpi_tracking", "contents", false)) {
$query = "ALTER TABLE `glpi_tracking`
CHANGE `contents` `contents` LONGTEXT NULL DEFAULT NULL ";
$DB->queryOrDie($query, "0.71.3 alter tracking contents field to longtext");
}
}