Projet

Général

Profil

Paste
Statistiques
| Branche: | Révision:

ryxeo-glpi-git / install / update_07_071.php @ b67d8923

Historique | Voir | Annoter | Télécharger (22,6 ko)

1
<?php
2

    
3

    
4
/*
5
 * @version $Id: update_07_071.php 7763 2009-01-06 18:44:50Z moyo $
6
 -------------------------------------------------------------------------
7
 GLPI - Gestionnaire Libre de Parc Informatique
8
 Copyright (C) 2003-2009 by the INDEPNET Development Team.
9

10
 http://indepnet.net/   http://glpi-project.org
11
 -------------------------------------------------------------------------
12

13
 LICENSE
14

15
 This file is part of GLPI.
16

17
 GLPI is free software; you can redistribute it and/or modify
18
 it under the terms of the GNU General Public License as published by
19
 the Free Software Foundation; either version 2 of the License, or
20
 (at your option) any later version.
21

22
 GLPI is distributed in the hope that it will be useful,
23
 but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 GNU General Public License for more details.
26

27
 You should have received a copy of the GNU General Public License
28
 along with GLPI; if not, write to the Free Software
29
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30
 --------------------------------------------------------------------------
31
 */
32

    
33
// ----------------------------------------------------------------------
34
// Original Author of file:
35
// Purpose of file:
36
// ----------------------------------------------------------------------
37

    
38
/// Update from 0.7 to 0.71
39
function update07to071() {
40
        global $DB, $CFG_GLPI, $LANG, $LINK_ID_TABLE;
41

    
42
        if (!FieldExists("glpi_profiles", "rule_dictionnary_software")) {
43
                $query = "ALTER TABLE `glpi_profiles` ADD `rule_dictionnary_software` VARCHAR( 1 ) NULL DEFAULT NULL;";
44
                $DB->query($query) or die("0.71 add rule_dictionnary_software in glpi_profiles if not present for compatibility " . $LANG["update"][90] . $DB->error());
45
                
46
                $query="UPDATE glpi_profiles SET rule_dictionnary_software=rule_softwarecategories";
47
                $DB->query($query) or die("0.71 update value of rule_dictionnary_software right " . $LANG["update"][90] . $DB->error());
48
        }
49

    
50
        if (!FieldExists("glpi_profiles", "rule_dictionnary_dropdown")) {
51
                $query = "ALTER TABLE `glpi_profiles` ADD `rule_dictionnary_dropdown` VARCHAR( 1 ) NULL DEFAULT NULL;";
52
                $DB->query($query) or die("0.71 add rule_dictionnary_dropdown in glpi_profiles " . $LANG["update"][90] . $DB->error());
53

    
54
                $query="UPDATE glpi_profiles SET rule_dictionnary_dropdown=rule_dictionnary_software";
55
                $DB->query($query) or die("0.71 update value of rule_dictionnary_dropdown" . $LANG["update"][90] . $DB->error());
56
        }
57

    
58

    
59
        $cache_tables = array("glpi_rule_cache_manufacturer",
60
                                                        "glpi_rule_cache_model_computer",
61
                                                        "glpi_rule_cache_model_monitor",
62
                                                        "glpi_rule_cache_model_printer",
63
                                                        "glpi_rule_cache_model_peripheral",
64
                                                        "glpi_rule_cache_model_phone",
65
                                                        "glpi_rule_cache_model_networking",
66
                                                        "glpi_rule_cache_type_computer",
67
                                                        "glpi_rule_cache_type_monitor",
68
                                                        "glpi_rule_cache_type_printer",
69
                                                        "glpi_rule_cache_type_peripheral",
70
                                                        "glpi_rule_cache_type_phone",
71
                                                        "glpi_rule_cache_type_networking",
72
                                                        "glpi_rule_cache_software",
73
                                                        "glpi_rule_cache_os",
74
                                                        "glpi_rule_cache_os_sp",
75
                                                        "glpi_rule_cache_os_version"                                                        
76
                                                        );
77

    
78
        foreach ($cache_tables as $cache_table)
79
        {
80

    
81
                if (!TableExists($cache_table)) {
82
                        $query = "CREATE TABLE `".$cache_table."` (
83
                        `ID` INT( 11 ) NOT NULL auto_increment ,
84
                        `old_value` VARCHAR( 255 ) NULL default NULL ,
85
                        `rule_id` INT( 11 ) NOT NULL DEFAULT '0',
86
                        `new_value` VARCHAR( 255 ) NULL default NULL ,
87
                        PRIMARY KEY ( `ID` ),
88
                        KEY `rule_id` (`rule_id`),
89
                        KEY `old_value` (`old_value`)
90
                        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
91
                        $DB->query($query) or die("0.71 add table ".$cache_table." " . $LANG["update"][90] . $DB->error());
92
                }
93
                
94
        }
95
        
96
        //Add the field version espacially for the software's cache
97
        if (!FieldExists("glpi_rule_cache_software", "version")) {
98
                $query = "ALTER TABLE `glpi_rule_cache_software` ADD `version` VARCHAR( 255 ) DEFAULT NULL ;";
99
                $DB->query($query) or die("0.71 add version in glpi_rule_cache_software if not present " . $LANG["update"][90] . $DB->error());
100
        }
101
        if (!FieldExists("glpi_rule_cache_software", "manufacturer")) {
102
                $query = "ALTER TABLE `glpi_rule_cache_software` ADD `manufacturer` VARCHAR( 255 ) NOT NULL AFTER `old_value` ;";
103
                $DB->query($query) or die("0.71 add manufacturer in glpi_rule_cache_software if not present " . $LANG["update"][90] . $DB->error());
104
        }
105
        if (!FieldExists("glpi_rule_cache_software", "new_manufacturer")) {
106
                $query = "ALTER TABLE `glpi_rule_cache_software` ADD `new_manufacturer` VARCHAR( 255 ) NOT NULL AFTER `version` ;";
107
                $DB->query($query) or die("0.71 add new_manufacturer in glpi_rule_cache_software if not present " . $LANG["update"][90] . $DB->error());
108
        }
109

    
110
        $model_cache_tables = array("glpi_rule_cache_model_computer",
111
                                                        "glpi_rule_cache_model_monitor",
112
                                                        "glpi_rule_cache_model_printer",
113
                                                        "glpi_rule_cache_model_peripheral",
114
                                                        "glpi_rule_cache_model_phone",
115
                                                        "glpi_rule_cache_model_networking",
116
                                                        );
117

    
118
        foreach ($model_cache_tables as $model_cache_table)
119
        {
120
                if (!FieldExists($model_cache_table, "manufacturer")) {
121
                        $query = "ALTER TABLE `".$model_cache_table."` ADD `manufacturer` VARCHAR( 255 ) DEFAULT NULL ;";
122
                        $DB->query($query) or die("0.71 add manufacturer in ".$model_cache_table." if not present " . $LANG["update"][90] . $DB->error());
123
                }
124
        }        
125

    
126
        if (!FieldExists("glpi_rules_descriptions", "active")) {
127
                $query = "ALTER TABLE `glpi_rules_descriptions` ADD `active` INT( 1 ) NOT NULL DEFAULT '1';";
128
                $DB->query($query) or die("0.71 add active in glpi_rules_descriptions if not present " . $LANG["update"][90] . $DB->error());
129
        }
130

    
131
        if (!TableExists("glpi_auth_ldap_replicate")) {
132
        $query="CREATE TABLE IF NOT EXISTS `glpi_auth_ldap_replicate` (
133
          `ID` int(11) NOT NULL auto_increment,
134
          `server_id` int(11) NOT NULL default '0',
135
          `ldap_host` varchar(255) NULL default NULL,
136
          `ldap_port` int(11) NOT NULL default '389',
137
          `name` varchar(255) NULL default NULL,
138
          PRIMARY KEY  (`ID`)
139
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
140
                $DB->query($query) or die("0.71 add table glpi_auth_ldap_replicate " . $LANG["update"][90] . $DB->error());
141
        }        
142

    
143
        if (!FieldExists("glpi_config","dbreplicate_notify_desynchronization")) {
144
                $query = "ALTER TABLE `glpi_config` ADD `dbreplicate_notify_desynchronization` SMALLINT NOT NULL DEFAULT '0',
145
                                ADD `dbreplicate_email` VARCHAR( 255 ) NULL ,
146
                                ADD `dbreplicate_maxdelay` INT NOT NULL DEFAULT '3600';";
147

    
148
                $DB->query($query) or die("0.71 alter config add config for dbreplicate notif " . $LANG["update"][90] . $DB->error());
149
        }
150

    
151
         if (FieldExists("glpi_reminder", "author")) {
152
                 $query = "ALTER TABLE `glpi_reminder` CHANGE `author` `FK_users` INT( 11 ) NOT NULL DEFAULT '0';";
153
                 $DB->query($query) or die("0.71 rename author in glpi_reminder" . $LANG["update"][90] . $DB->error());
154

    
155
                if (isIndex("glpi_reminder", "author")) {
156
                        $query = "ALTER TABLE `glpi_reminder` DROP INDEX `author`";
157
                        $DB->query($query) or die("0.7 drop index author on glpi_reminder " . $LANG["update"][90] . $DB->error());
158
                }
159

    
160
                 $query = " ALTER TABLE `glpi_reminder` ADD INDEX `FK_users` ( `FK_users` ) ";
161
                 $DB->query($query) or die("0.71 ad index FK_users in glpi_reminder" . $LANG["update"][90] . $DB->error());
162
         }                  
163

    
164
         if (!FieldExists("glpi_reminder", "recursive")) {
165
                 $query = "ALTER TABLE `glpi_reminder` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `type`;";
166
                 $DB->query($query) or die("0.71 add recursive in glpi_reminder" . $LANG["update"][90] . $DB->error());
167
                 $query = "ALTER TABLE `glpi_reminder` ADD INDEX `recursive` ( `recursive` ); ";
168
                 $DB->query($query) or die("0.71 add recursive index in glpi_reminder" . $LANG["update"][90] . $DB->error());
169
         }                  
170

    
171
         if (!FieldExists("glpi_reminder", "private")) {
172
                 $query = "ALTER TABLE `glpi_reminder` ADD `private` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `type`;";
173
                 $DB->query($query) or die("0.71 add private in glpi_reminder" . $LANG["update"][90] . $DB->error());
174
                $query = "UPDATE `glpi_reminder` SET private = '0' WHERE type='public' ";
175
                $DB->query($query) or die("0.71 update private field in glpi_reminder" . $LANG["update"][90] . $DB->error());
176
                 $query = "ALTER TABLE `glpi_reminder` ADD INDEX `private` ( `private` ); ";
177
                 $DB->query($query) or die("0.71 add private index in glpi_reminder" . $LANG["update"][90] . $DB->error());
178
                // Drop type
179
                $query = "ALTER TABLE `glpi_reminder` DROP `type`;";
180
                $DB->query($query) or die("0.71 drop type in glpi_reminder" . $LANG["update"][90] . $DB->error());
181
         }                  
182

    
183
        if (FieldExists("glpi_reminder", "title")) {
184
                $query = "ALTER TABLE `glpi_reminder` CHANGE `title` `name` VARCHAR( 255 ) NULL DEFAULT NULL  ";
185
                $DB->query($query) or die("0.71 alter title to namein glpi_reminder" . $LANG["update"][90] . $DB->error());
186
        }
187

    
188
        if (!isIndex("glpi_ocs_link", "last_ocs_update")) {
189
                $query = "ALTER TABLE `glpi_ocs_link` ADD INDEX `last_ocs_update` ( `ocs_server_id` , `last_ocs_update` )";
190
                $DB->query($query) or die("0.7 alter ocs_link add index on last_ocs_update " . $LANG["update"][90] . $DB->error());
191
        }
192
         
193
         if (!FieldExists("glpi_contacts", "recursive")) {
194
                 $query = "ALTER TABLE `glpi_contacts` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
195
                 $DB->query($query) or die("0.71 add recursive in glpi_contacts" . $LANG["update"][90] . $DB->error());
196
         }                  
197
         if (!FieldExists("glpi_contracts", "recursive")) {
198
                 $query = "ALTER TABLE `glpi_contracts` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
199
                 $DB->query($query) or die("0.71 add recursive in glpi_contracts" . $LANG["update"][90] . $DB->error());
200
         }                  
201
         if (!FieldExists("glpi_enterprises", "recursive")) {
202
                 $query = "ALTER TABLE `glpi_enterprises` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
203
                 $DB->query($query) or die("0.71 add recursive in glpi_enterprises" . $LANG["update"][90] . $DB->error());
204
         }                  
205
         if (!FieldExists("glpi_docs", "recursive")) {
206
                 $query = "ALTER TABLE `glpi_docs` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
207
                 $DB->query($query) or die("0.71 add recursive in glpi_docs" . $LANG["update"][90] . $DB->error());
208
         }                  
209
         if (!FieldExists("glpi_monitors", "flags_pivot")) {
210
                 $query = "ALTER TABLE `glpi_monitors` ADD `flags_pivot` SMALLINT( 6 ) NOT NULL DEFAULT 0 AFTER `flags_dvi`;";
211
                 $DB->query($query) or die("0.71 add flags_pivot in glpi_monitors" . $LANG["update"][90] . $DB->error());
212
         }                  
213

    
214
         if (!FieldExists("glpi_kbitems", "FK_entities")) {
215
                 $query = "ALTER TABLE `glpi_kbitems` ADD `FK_entities` INT(11) NOT NULL DEFAULT 0 AFTER `ID`;";
216
                 $DB->query($query) or die("0.71 add FK_entities in glpi_kbitems" . $LANG["update"][90] . $DB->error());
217
         }                  
218
         if (!FieldExists("glpi_kbitems", "recursive")) {
219
                 // Default 1 for migration. All articles become "global" (root + recursive)
220
                 $query = "ALTER TABLE `glpi_kbitems` ADD `recursive` TINYINT(1) NOT NULL DEFAULT 1 AFTER `FK_entities`;";
221
                 $DB->query($query) or die("0.71 add recursive in glpi_kbitems" . $LANG["update"][90] . $DB->error());
222
         }                  
223
        if (!isIndex("glpi_kbitems", "FK_entities")) {
224
                $query = "ALTER TABLE `glpi_kbitems` ADD INDEX `FK_entities` (`FK_entities`)";
225
                $DB->query($query) or die("0.7 alter ocs_link add index on last_ocs_update " . $LANG["update"][90] . $DB->error());
226
        }
227

    
228
         if (!FieldExists("glpi_config", "category_on_software_delete")) {
229
                 $query = "ALTER TABLE `glpi_config` ADD `category_on_software_delete` INT( 11 ) NOT NULL DEFAULT '0';";
230
                 $DB->query($query) or die("0.71 add category_on_software_delete in glpi_config" . $LANG["update"][90] . $DB->error());
231
                
232
                //Create a software category for softwares to be deleted by the dictionnary
233
                 $result = $DB->query("SELECT ID FROM glpi_dropdown_software_category WHERE name='".$LANG["rulesengine"][94]."'");
234
                 if (!$DB->numrows($result))
235
                 {
236
                         $DB->query("INSERT INTO glpi_dropdown_software_category SET name='".$LANG["rulesengine"][94]."'");
237
                         $result = $DB->query("SELECT ID FROM glpi_dropdown_software_category WHERE name='".$LANG["rulesengine"][94]."'");
238
                 }
239
                 $cat_id = $DB->result($result,0,"ID");
240

    
241
                $DB->query("UPDATE glpi_config SET category_on_software_delete=".$cat_id);
242
         }                  
243

    
244
        $query="DELETE FROM glpi_display WHERE num='121'";
245
        $DB->query($query) or die("0.71 clean glpi_display for end_warranty infocoms " . $DB->error());
246

    
247
        // Delete helpdesk injector user
248
        $query="DELETE FROM glpi_users WHERE ID='1'";
249
        $DB->query($query) or die("0.71 delete helpdesk injector user " . $DB->error());
250
        // Delete helpdesk injector user
251
        $query="DELETE FROM glpi_users_profiles WHERE FK_users='1'";
252
        $DB->query($query) or die("0.71 delete helpdesk injector user profile " . $DB->error());
253
        // change default device type for tracking
254
        if (FieldExists("glpi_tracking", "device_type")) {
255
                $query=" ALTER TABLE `glpi_tracking` CHANGE `device_type` `device_type` INT( 11 ) NOT NULL DEFAULT '0' ";
256
                $DB->query($query) or die("0.71 alter device_type from glpi_tracking " . $DB->error());                
257
        }
258

    
259
        // Change ldap condition field bigger
260
        if (FieldExists("glpi_auth_ldap", "ldap_condition")) {
261
         
262
                $query="ALTER TABLE `glpi_auth_ldap` CHANGE `ldap_condition` `ldap_condition` TEXT NULL DEFAULT NULL   ";
263
                $DB->query($query) or die("0.71 alter change ldap_condition field to be bigger " . $DB->error());                
264
        }
265

    
266
        // Add date_mod to glpi_tracking
267
        if (!FieldExists("glpi_tracking", "date_mod")) {
268
                $query="ALTER TABLE `glpi_tracking` ADD `date_mod` DATETIME NULL DEFAULT NULL AFTER `closedate` ;";
269
                $DB->query($query) or die("0.71 alter glpi_tracking add date_mod" . $DB->error());                
270
                $query="UPDATE `glpi_tracking` SET `date_mod` = date;";
271
                $DB->query($query) or die("0.71 alter glpi_tracking update date_mod value to creation date" . $DB->error());                
272

    
273
        }
274

    
275
        // Add number format
276
        if (!FieldExists("glpi_config", "numberformat")) {
277
                $query="ALTER TABLE `glpi_config` ADD `numberformat` SMALLINT NOT NULL DEFAULT '0' AFTER `dateformat` ;";
278
                $DB->query($query) or die("0.71 alter config add numberformat" . $DB->error());                
279
        }
280
        // Add group supervisor
281
        if (!FieldExists("glpi_groups", "FK_users")) {
282
                $query="ALTER TABLE `glpi_groups` ADD `FK_users` INT NOT NULL DEFAULT '0' AFTER `comments` ;";
283
                $DB->query($query) or die("0.71 alter groups add FK_users supervisor" . $DB->error());                
284
        }
285

    
286
        // Add group supervisor
287
        if (!FieldExists("glpi_entities_data", "admin_email")) {
288
                $query="ALTER TABLE `glpi_entities_data` ADD `admin_email` VARCHAR( 255 ) NULL AFTER `email` ;";
289
                $DB->query($query) or die("0.71 alter entities_data add admin_email " . $DB->error());                
290
        }
291

    
292
        // Add cas ldap server link
293
        if (!FieldExists("glpi_config", "extra_ldap_server")) {
294
                $query="ALTER TABLE `glpi_config` ADD `extra_ldap_server` INT NOT NULL DEFAULT '1' AFTER `cas_logout` ;";
295
                $DB->query($query) or die("0.71 alter config add extra_ldap_server" . $DB->error());                
296
        }
297

    
298
        // Add x509 email field definition
299
        if (!FieldExists("glpi_config", "x509_email_field")) {
300
                $query="ALTER TABLE `glpi_config` ADD `x509_email_field` VARCHAR( 255 ) NULL;";
301
                $DB->query($query) or die("0.71 alter config add x509_email_field" . $DB->error());                
302
        }
303

    
304
        // Add x509 email field definition
305
        if (!FieldExists("glpi_config", "existing_auth_server_field")) {
306
                $query="ALTER TABLE `glpi_config` ADD `existing_auth_server_field` VARCHAR( 255 ) NULL  AFTER `extra_ldap_server`;";
307
                $DB->query($query) or die("0.71 alter config add existing_auth_server_field" . $DB->error());                
308
        }
309

    
310
        // update cas auth field from 0 -> 5
311
        $query="UPDATE `glpi_users` SET `auth_method`=5 WHERE `auth_method`=0;";
312
        $DB->query($query) or die("0.71 update auth method for CAS " . $DB->error());                
313
        
314
        if (!TableExists("glpi_bookmark")){
315
                 $query="CREATE TABLE IF NOT EXISTS `glpi_bookmark` (
316
                        `ID` int(11) NOT NULL auto_increment,
317
                        `name` varchar(255) default NULL,
318
                        `type` int(11) NOT NULL default '0',
319
                        `device_type` int(11) NOT NULL default '0',
320
                        `FK_users` int(11) NOT NULL default '0',
321
                        `private` smallint(6) NOT NULL default '1',
322
                        `FK_entities` int(11) NOT NULL default '-1',
323
                        `recursive` smallint(6) NOT NULL default '0',
324
                        `path` varchar(255) default NULL,
325
                        `query` text,
326
                        PRIMARY KEY  (`ID`),
327
                        KEY `FK_users` (`FK_users`),
328
                        KEY `private` (`private`),
329
                        KEY `device_type` (`device_type`),
330
                        KEY `recursive` (`recursive`),
331
                        KEY `FK_entities` (`FK_entities`),
332
                        KEY `type` (`type`)
333
                        ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
334
                $DB->query($query) or die("0.71 add table glpi_bookmark " . $DB->error());                
335
        }
336

    
337

    
338
        if (!FieldExists("glpi_profiles", "show_group_planning")) {
339
                $query = "ALTER TABLE `glpi_profiles` ADD `show_group_planning` CHAR( 1 ) NULL AFTER `show_planning` ;";
340
                $DB->query($query) or die("0.71 add show_group_planning in glpi_profiles " . $LANG["update"][90] . $DB->error());
341
                
342
                $query="UPDATE glpi_profiles SET show_group_planning=show_all_planning";
343
                $DB->query($query) or die("0.71 update value of show_group_planning right " . $LANG["update"][90] . $DB->error());
344
        }
345

    
346
        if (!FieldExists("glpi_users", "FK_profiles")) {
347
                $query = "ALTER TABLE `glpi_users` ADD `FK_profiles` INT NOT NULL DEFAULT '0';";
348
                $DB->query($query) or die("0.71 add default profile to user " . $LANG["update"][90] . $DB->error());
349
        }
350
        if (!FieldExists("glpi_users", "FK_entities")) {
351
                $query = "ALTER TABLE `glpi_users` ADD `FK_entities` INT NOT NULL DEFAULT '0';";
352
                $DB->query($query) or die("0.71 add default entity to user " . $LANG["update"][90] . $DB->error());
353
        }
354
        if (!FieldExists("glpi_auth_ldap", "ldap_opt_deref")) {
355
                $query = "ALTER TABLE `glpi_auth_ldap` ADD `ldap_opt_deref` INT (1) NOT NULL DEFAULT '0';";
356
                $DB->query($query) or die("0.71 add ldap_opt_deref to glpi_auth_ldap " . $LANG["update"][90] . $DB->error());
357
        }
358

    
359
        //ticket opening restrictions
360
        if (!FieldExists("glpi_config", "ticket_title_mandatory")) {
361
                $query = "ALTER TABLE `glpi_config` ADD `ticket_title_mandatory` INT (1) NOT NULL DEFAULT '0';";
362
                $DB->query($query) or die("0.71 add ticket_title_mandatory to glpi_config " . $LANG["update"][90] . $DB->error());
363
        }
364
        if (!FieldExists("glpi_config", "ticket_content_mandatory")) {
365
                $query = "ALTER TABLE `glpi_config` ADD `ticket_content_mandatory` INT (1) NOT NULL DEFAULT '1';";
366
                $DB->query($query) or die("0.71 add ticket_content_mandatory to glpi_config " . $LANG["update"][90] . $DB->error());
367
        }
368
        if (!FieldExists("glpi_config", "ticket_category_mandatory")) {
369
                $query = "ALTER TABLE `glpi_config` ADD `ticket_category_mandatory` INT (1) NOT NULL DEFAULT '0';";
370
                $DB->query($query) or die("0.71 add ticket_category_mandatory to glpi_config " . $LANG["update"][90] . $DB->error());
371
        }
372

    
373

    
374
        // Add alerts on licenses
375
        if (!FieldExists("glpi_config", "licenses_alert")) {
376
                $query = "ALTER TABLE `glpi_config` ADD `licenses_alert` SMALLINT NOT NULL DEFAULT '0' AFTER `infocom_alerts` ;";
377
                $DB->query($query) or die("0.71 add licenses_alert to glpi_config " . $LANG["update"][90] . $DB->error());
378
        }
379

    
380
        if (!FieldExists("glpi_config", "autoclean_link_contact")) {
381
                $query = "ALTER TABLE `glpi_config` ADD `autoclean_link_contact` smallint(6) NOT NULL DEFAULT '0' AFTER `autoupdate_link_location` ," .
382
                                "ADD `autoclean_link_user` smallint(6) NOT NULL DEFAULT '0' AFTER `autoclean_link_contact` ," .
383
                                "ADD `autoclean_link_group` smallint(6) NOT NULL DEFAULT '0' AFTER `autoclean_link_user` ," .
384
                                "ADD `autoclean_link_location` smallint(6) NOT NULL DEFAULT '0' AFTER `autoclean_link_group` ;";
385
                $DB->query($query) or die("0.71 add autoclean_link_* to glpi_config " . $LANG["update"][90] . $DB->error());
386
        }
387
        if (!FieldExists("glpi_config", "autoupdate_link_state")) {
388
                $query = "ALTER TABLE `glpi_config` ADD `autoupdate_link_state` smallint(6) NOT NULL DEFAULT '0' AFTER `autoupdate_link_location` ," .
389
                                "ADD `autoclean_link_state` smallint(6) NOT NULL DEFAULT '0' AFTER `autoclean_link_location`;";
390
                $DB->query($query) or die("0.71 add autoclean_link_state to glpi_config " . $LANG["update"][90] . $DB->error());
391
                
392
                $query = "UPDATE glpi_ocs_config SET deconnection_behavior = '' WHERE deconnection_behavior != 'trash' AND deconnection_behavior != 'delete';";
393
                $DB->query($query);
394
        }
395

    
396
        if (!FieldExists("glpi_profiles", "bookmark_public")) {
397
                $query = "ALTER TABLE `glpi_profiles` ADD `bookmark_public` CHAR( 1 ) AFTER `reminder_public` ;";
398
                $DB->query($query) or die("0.71 add bookmark_public to glpi_profiles " . $LANG["update"][90] . $DB->error());
399
                $query = "UPDATE `glpi_profiles` SET `bookmark_public` = `reminder_public` ;";
400
                $DB->query($query) or die("0.71 init bookmark_public value in glpi_profiles " . $LANG["update"][90] . $DB->error());
401
        }        
402

    
403
        if (!FieldExists("glpi_config", "admin_reply")) {
404
                $query = "ALTER TABLE `glpi_config` ADD `admin_reply` VARCHAR( 255 ) NULL AFTER `admin_email` ;";
405
                $DB->query($query) or die("0.71 add admin_reply to glpi_config " . $LANG["update"][90] . $DB->error());
406
        }        
407

    
408
        if (!FieldExists("glpi_config", "mailgate_filesize_max")) {
409
                $query = "ALTER TABLE `glpi_config` ADD `mailgate_filesize_max` int(11) NOT NULL DEFAULT ".(2*1024*1024)." AFTER `ticket_category_mandatory` ;";
410
                $DB->query($query) or die("0.71 add mailgate_filesize_max to glpi_config " . $LANG["update"][90] . $DB->error());
411
        }        
412

    
413
        if (!FieldExists("glpi_entities_data", "admin_reply")) {
414
                $query = "ALTER TABLE `glpi_entities_data` ADD `admin_reply` VARCHAR( 255 ) NULL AFTER `admin_email` ;";
415
                $DB->query($query) or die("0.71 add admin_reply to glpi_entities_data " . $LANG["update"][90] . $DB->error());
416
        }        
417

    
418
        if (!isIndex("glpi_kbitems", "fulltext")) {
419
                        $query = "ALTER TABLE `glpi_kbitems` ADD FULLTEXT `fulltext` (`question`,`answer`);";
420
                        $DB->query($query) or die("0.71 add fulltext index  glpi_kbitems " . $LANG["update"][90] . $DB->error());
421
        }
422
        if (!FieldExists("glpi_profiles", "user_auth_method")) {
423
                $query = "ALTER TABLE `glpi_profiles` ADD `user_auth_method` CHAR( 1 ) NULL DEFAULT NULL AFTER `user`;";
424
                $DB->query($query) or die("0.71 add user_auth_method to glpi_profiles " . $LANG["update"][90] . $DB->error());
425

    
426
                $query = "UPDATE `glpi_profiles` SET `user_auth_method` = `user`;";
427
                $DB->query($query) or die("0.71 init user_auth_method value in glpi_profiles " . $LANG["update"][90] . $DB->error());
428
        }
429
        if (isIndex("glpi_printers", "id")) {
430
                        $query = "ALTER TABLE `glpi_printers` DROP INDEX `id`;";
431
                        $DB->query($query) or die("0.71 drop id index in glpi_printers " . $LANG["update"][90] . $DB->error());
432
        }
433
        if (isIndex("glpi_users", "name_2")) {
434
                        $query = "ALTER TABLE `glpi_users` DROP INDEX `name_2`;";
435
                        $DB->query($query) or die("0.71 drop name_2 index in glpi_users " . $LANG["update"][90] . $DB->error());
436
        }
437
        
438
        if (!FieldExists("glpi_rules_descriptions","comments"))
439
        {
440
                        $query="ALTER TABLE `glpi_rules_descriptions` ADD `comments` TEXT NULL DEFAULT NULL;";
441
                        $DB->query($query) or die("0.71 add comments to glpi_rules_descriptions " . $LANG["update"][90] . $DB->error());                        
442
        }
443
} // fin 0.71 #####################################################################################
444
?>
Redmine Appliance - Powered by TurnKey Linux