OSDN Git Service

FIX:アップグレードスクリプトがNucleus3.6上で動作するように修正
[nucleus-jp/nucleus-next.git] / nucleus / upgrades / upgrade3.3.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: upgrade3.3.php 1809 2012-05-01 14:48:30Z sakamocchi $
16  */
17
18 function upgrade_do330() {
19
20         if (upgrade_checkinstall(330))
21                 return 'already installed';
22
23         if (!upgrade_checkIfColumnExists('comment','cemail')) {
24                 $query = "      ALTER TABLE " . sql_table('comment') . "
25                                         ADD cemail VARCHAR( 100 ) AFTER cmail ;";
26
27                 upgrade_query('Altering ' . sql_table('comment') . ' table', $query);
28         }
29
30         if (!upgrade_checkIfColumnExists('blog','breqemail')) {
31                 $query = "      ALTER TABLE " . sql_table('blog') . "
32                                         ADD breqemail TINYINT( 2 ) DEFAULT '0' NOT NULL ;";
33
34                 upgrade_query('Altering ' . sql_table('blog') . ' table', $query);
35         }
36
37         // check cmail column to separate to URL and cemail
38         mysql_query(
39                 'UPDATE ' . sql_table('comment') . ' ' . 
40                 "SET cemail = cmail, cmail = '' " .
41                 "WHERE cmail LIKE '%@%'"
42         );
43
44         if (!upgrade_checkIfColumnExists('item','iposted')) {
45                 $query = "      ALTER TABLE " . sql_table('item') . "
46                                 ADD iposted TINYINT(2) DEFAULT 1 NOT NULL ;";
47
48                 upgrade_query('Altering ' . sql_table('item') . ' table', $query);
49         }
50
51         if (!upgrade_checkIfColumnExists('blog','bfuturepost')) {
52                 $query = "      ALTER TABLE " . sql_table('blog') . "
53                                 ADD bfuturepost TINYINT(2) DEFAULT 0 NOT NULL ;";
54
55                 upgrade_query('Altering ' . sql_table('blog') . ' table', $query);
56         }
57
58         // 3.2 -> 3.3
59         // update database version
60         update_version('330');
61
62         // check to see if user turn on Weblogs.com ping, if so, suggest to install the plugin
63         $query = "SELECT bsendping FROM " . sql_table('blog') . " WHERE bsendping='1'"; 
64         $res = mysql_query($query);
65         if (mysql_num_rows($res) > 0) {
66                 echo "<li>Note: The weblogs.com ping function is improved and moved into a plugin. To activate this function in v3.3, please go to plugin menu and install NP_Ping plugin. Also, NP_Ping is replacing NP_PingPong. If you have NP_PingPing installed, please also remove it.</li>";
67         }
68 }
69
70 ?>