OSDN Git Service

8b97c5111bc4b06971bb3270faa26d3eb63626de
[nucleus-jp/nucleus-next.git] / nucleus / upgrades / upgrade3.4.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2009 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12 /**
13  * @license http://nucleuscms.org/license.txt GNU General Public License
14  * @copyright Copyright (C) 2002-2009 The Nucleus Group
15  * @version $Id: upgrade3.4.php 1714 2012-03-31 06:32:09Z sakamocchi $
16  */
17
18 function upgrade_do340() {
19
20         if (upgrade_checkinstall(340))
21                 return 'already installed';
22         
23         // Give user warning if they are running old version of PHP
24         if (phpversion() < '5') {
25                 echo 'WARNING: You are running NucleusCMS on a older version of PHP. PHP4 support will be depreciated in the next release, please consider upgrade to PHP5!';
26         }
27
28         // lengthen tpartname column of nucleus_template
29         $query = "      ALTER TABLE " . sql_table('template') . "
30                                         MODIFY tpartname varchar(64) NOT NULL default '' ;";
31
32         upgrade_query('Altering ' . sql_table('template') . ' table', $query);
33         
34         // lengthen tdname column of nucleus_template_desc
35         $query = "      ALTER TABLE " . sql_table('template_desc') . "
36                                         MODIFY tdname varchar(64) NOT NULL default '' ;";
37
38         upgrade_query('Altering ' . sql_table('template_desc') . ' table', $query);
39         
40         // create DebugVars setting
41         if (!upgrade_checkIfCVExists('DebugVars')) {
42                 $query = 'INSERT INTO '.sql_table('config')." VALUES ('DebugVars',0)";
43                 upgrade_query('Creating DebugVars config value',$query);        
44         }
45         
46         // create DefaultListSize setting
47         if (!upgrade_checkIfCVExists('DefaultListSize')) {
48                 $query = 'INSERT INTO '.sql_table('config')." VALUES ('DefaultListSize',10)";
49                 upgrade_query('Creating DefaultListSize config value',$query);  
50         }
51         
52         // changing the member table
53         if (!upgrade_checkIfColumnExists('member', 'mautosave')) {
54                 $query = ' ALTER TABLE ' . sql_table('member') . ' ADD mautosave TINYINT(2) DEFAULT 1';
55                 upgrade_query('Adding a new row for the autosave member option', $query);
56         }
57
58         // 3.3 -> 3.4
59         // update database version
60         update_version('340');
61         
62 }
63
64 ?>