OSDN Git Service

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