OSDN Git Service

f6d20b72a025e89d04a00ba0fe6be00d5b27099e
[nucleus-jp/nucleus-jp-ancient.git] / nucleus / upgrades / upgrade3.4.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2012 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 function upgrade_do340() {
14
15         if (upgrade_checkinstall(340))
16                 return 'インストール済みです';
17         
18         // Give user warning if they are running old version of PHP
19                 if (phpversion() < '5') {
20                                 echo '警告: Nucleusを古いバージョンのPHPで運用しようとしています。次のリリースバージョンからはPHP4のサポートはしないので、はやくPHP5に切り替えましょう!';
21                 }
22
23         // lengthen tpartname column of nucleus_template
24         $query = "  ALTER TABLE `" . sql_table('template') . "`
25                                         MODIFY `tpartname` varchar(64) NOT NULL default '' ;";
26
27         upgrade_query('Altering ' . sql_table('template') . ' table', $query);
28         
29         // lengthen tdname column of nucleus_template_desc
30         $query = "  ALTER TABLE `" . sql_table('template_desc') . "`
31                                         MODIFY `tdname` varchar(64) NOT NULL default '' ;";
32
33         upgrade_query('Altering ' . sql_table('template_desc') . ' table', $query);
34         
35         // create DebugVars setting
36         if (!upgrade_checkIfCVExists('DebugVars')) {
37                 $query = 'INSERT INTO '.sql_table('config')." VALUES ('DebugVars',0)";
38                 upgrade_query('Creating DebugVars config value',$query);        
39         }
40         
41         // create DefaultListSize setting
42         if (!upgrade_checkIfCVExists('DefaultListSize')) {
43                 $query = 'INSERT INTO '.sql_table('config')." VALUES ('DefaultListSize',10)";
44                 upgrade_query('Creating DefaultListSize config value',$query);  
45         }
46         
47         // changing the member table
48         if (!upgrade_checkIfColumnExists('member', 'mautosave')) {
49                 $query = ' ALTER TABLE ' . sql_table('member') . ' ADD mautosave TINYINT(2) DEFAULT 1';
50                 upgrade_query('Adding a new row for the autosave member option', $query);
51         }
52
53                 // 3.31 -> 3.4
54         // update database version
55         update_version('340');
56         
57 }
58
59 ?>