OSDN Git Service

Subversion由来のタグを削除
[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-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_do330() {
14
15     if (upgrade_checkinstall(330))
16         return 'インストール済みです';
17
18     if (!upgrade_checkIfColumnExists('comment','cemail')) {
19         $query = "  ALTER TABLE `" . sql_table('comment') . "`
20                     ADD `cemail` VARCHAR( 100 ) AFTER `cmail` ;";
21
22         upgrade_query('Altering ' . sql_table('comment') . ' table', $query);
23     }
24
25     if (!upgrade_checkIfColumnExists('blog','breqemail')) {
26         $query = "  ALTER TABLE `" . sql_table('blog') . "`
27                     ADD `breqemail` TINYINT( 2 ) DEFAULT '0' NOT NULL ;";
28
29         upgrade_query('Altering ' . sql_table('blog') . ' table', $query);
30     }
31
32     // check cmail column to separate to URL and cemail
33     mysql_query(
34         'UPDATE ' . sql_table('comment') . ' ' . 
35         "SET cemail = cmail, cmail = '' " .
36         "WHERE cmail LIKE '%@%'"
37     );
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53     // 3.2 -> 3.3
54     // update database version
55     update_version('330');
56
57
58
59
60
61
62
63 }
64
65 ?>