OSDN Git Service

c0ed1605ee976d7e06114ef0e455b19ac23047bd
[nucleus-jp/nucleus-jp-ancient.git] / nucleus / upgrades / upgrade3.3.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2007 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-2007 The Nucleus Group
15  * $NucleusJP: upgrade3.3.php,v 1.5.2.1 2007/10/24 05:39:16 kimitake Exp $
16  *
17  */
18
19 function upgrade_do33() {
20
21         if (upgrade_checkinstall(33))
22                 return 'already installed';
23
24         if (!upgrade_checkIfColumnExists('comment','cemail')) {
25                 $query = "      ALTER TABLE `" . sql_table('comment') . "`
26                                         ADD `cemail` VARCHAR( 100 ) AFTER `cmail` ;";
27
28                 upgrade_query('Altering ' . sql_table('comment') . ' table', $query);
29         }
30
31         if (!upgrade_checkIfColumnExists('blog','breqemail')) {
32                 $query = "      ALTER TABLE `" . sql_table('blog') . "`
33                                         ADD `breqemail` TINYINT( 2 ) DEFAULT '0' NOT NULL ;";
34
35                 upgrade_query('Altering ' . sql_table('blog') . ' table', $query);
36         }
37
38         // check cmail column to separate to URL and cemail
39         mysql_query(
40                 'UPDATE ' . sql_table('comment') . ' ' . 
41                 "SET cemail = cmail, cmail = '' " .
42                 "WHERE cmail LIKE '%@%'"
43         );
44
45         // 3.2 -> 3.3
46         // update database version
47         update_version('330');
48
49 }
50
51 ?>