OSDN Git Service

191719ad474926fbff2fa444b97f3b7d58ba7862
[nucleus-jp/nucleus-next.git] / nucleus / upgrades / upgrade3.2.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2009 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.2.php 1809 2012-05-01 14:48:30Z sakamocchi $
16  */
17
18 function upgrade_do320() {
19
20         if (upgrade_checkinstall(320))
21                 return 'already installed';
22
23         // create nucleus_activation table
24         if (!upgrade_checkIfTableExists('tickets')) {
25                 $query = 'CREATE TABLE ' . sql_table('activation') . ' ('
26                            . ' vkey varchar(40) NOT NULL default \'\','
27                            . ' vtime datetime NOT NULL default \'0000-00-00 00:00:00\','
28                            . ' vmember int(11) NOT NULL default \'0\','
29                            . ' vtype varchar(15) NOT NULL default \'\','
30                            . ' vextra varchar(128) NOT NULL default \'\','
31                            . ' PRIMARY KEY  (vkey) '
32                            . ' )';
33                 upgrade_query('Creating account activation table', $query);    
34         }
35         
36         // create CookiePrefix setting
37         if (!upgrade_checkIfCVExists('CookiePrefix')) {
38                 $query = 'INSERT INTO '.sql_table('config')." VALUES ('CookiePrefix','')";
39                 upgrade_query('Creating CookiePrefix config value',$query);     
40         }
41
42         // create nucleus_tickets table
43         if (!upgrade_checkIfTableExists('tickets')) {
44                 $query = 'CREATE TABLE ' . sql_table('tickets') . ' ('
45                            . ' ticket varchar(40) NOT NULL default \'\','
46                            . ' ctime datetime NOT NULL default \'0000-00-00 00:00:00\','
47                            . ' member int(11) NOT NULL default \'0\', '
48                            . ' PRIMARY KEY  (ticket, member) '
49                            . ' )';
50                 upgrade_query('Creating ticket table', $query);    
51         }
52         
53         // 3.1 -> 3.2
54         // update database version  
55         update_version('320');
56         
57         // nothing!
58 }
59
60 ?>