r1450: Adding upgrade11.php as the upgrade script from 1.1.5 to 1.2.0b1
[bugdar.git] / install / upgrade11.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 define('STOP_MARK', 4);
23 define('ACTIVE_SITE', 'upgrade11.php');
24
25 require_once('./global.php');
26 require_once('./includes/functions_datastore.php');
27
28 page_start();
29
30 // ###################################################################
31
32 if ($bugsys->in['mark'] == 0)
33 {
34 ?>
35 <h1>Welcome to Bugdar</h1>
36
37 <p>This upgrade will move you from Bugdar 1.1.5 to Bugdar 1.2.0 Beta 1.</p>
38
39 <p>To begin the process, please click the button below.</p>
40 <?php
41 }
42
43 // ###################################################################
44
45 if ($bugsys->in['mark'] == 1)
46 {
47 ?>
48 <h1>Minor Database Table Changes</h1>
49
50 <p>There are a few minor changes made to Bugdar's database schema that need to be propagated.</p>
51 <?php
52
53 $db->query("ALTER TABLE " . TABLE_PREFIX . "comment ADD parselinks BOOL NULL");
54 echo "Adding comment.parselinks to add an option to parse links in comments<br />\n";
55
56 $db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD columnoptions TEXT NULL");
57 echo "Adding user.columnoptions to allow for custom column sorting<br />\n";
58
59 $db->query("ALTER TABLE " . TABLE_PREFIX . "product CHANGE componentmother parentid INT UNSIGNED NULL");
60 echo "Renaming product.componentmother to product.parentid<br />\n";
61
62 $db->query("ALTER TABLE " . TABLE_PREFIX . "version ADD obsolete BOOL NULL");
63 echo "Adding version.obsolete so products cannot be filed against certain versions<br />\n";
64
65 $db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD authid VARCHAR(255) NULL");
66 echo "Adding user.authid for the Authentication API<br />\n";
67
68 echo "... done<br />\n";
69 }
70
71 // ###################################################################
72
73 if ($bugsys->in['mark'] == 2)
74 {
75 ?>
76 <h1>Search Table Changes</h1>
77
78 <p>To support saved searches, a few major modifications need to be performed on the search table.</p>
79 <?php
80
81 $db->query("ALTER TABLE " . TABLE_PREFIX . "search DROP PRIMARY KEY");
82 echo "Dropping current primary key<br />\n";
83
84 $db->query("ALTER TABLE " . TABLE_PREFIX . "search ADD searchid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY");
85 echo "Adding search.searchid as a new primary key<br />\n";
86
87 $db->query("ALTER TABLE " . TABLE_PREFIX . "search ADD name VARCHAR(250) NULL");
88 echo "Adding search.name to allow naming of searches<br />\n";
89
90 echo "... done<br />\n";
91 }
92
93 // ###################################################################
94
95 if ($bugsys->in['mark'] == 3)
96 {
97 ?>
98 <h1>Database Table Additions</h1>
99
100 <p>A few new features require new database tables, so we're adding those now.</p>
101 <?php
102
103 $db->query("
104 CREATE TABLE " . TABLE_PREFIX . "passwordreset
105 (
106 activatorid VARCHAR(250) NOT NULL,
107 userid INT NOT NULL,
108 dateline INT NOT NULL,
109 PRIMARY KEY (activatorid)
110 )
111 ");
112 echo "Creating passwordreset table to create a 'lost password' functionality<br />\n";
113
114 $db->query("
115 CREATE TABLE " . TABLE_PREFIX . "adminsession
116 (
117 sessionid VARCHAR(250) NOT NULL,
118 userid INT UNSIGNED NOT NULL,
119 dateline INT UNSIGNED NOT NULL,
120 PRIMARY KEY (sessionid)
121 )
122 ");
123 echo "Creating adminsession table to greatly improve the admin control panel security<br />\n";
124
125 $db->query("
126 CREATE TABLE " . TABLE_PREFIX . "template
127 (
128 filename VARCHAR(255) NOT NULL,
129 template TEXT NOT NULL,
130 timestamp INT(10) UNSIGNED NOT NULL,
131 PRIMARY KEY (filename)
132 )
133 ");
134 echo "Creating template table to cache templates in the database to greatly inprove speed<br />\n";
135
136 echo "... done<br />\n";
137 }
138
139 // ###################################################################
140
141 if ($bugsys->in['mark'] == 4)
142 {
143 ?>
144 <h1>Version Number Change</h1>
145
146 <p>This step finishes the upgrade by inreasing your version number.</p>
147
148 <?php
149
150 require_once('./includes/settings.php');
151
152 $db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.2.0 Beta 1' WHERE varname = 'trackerversion'");
153
154 build_settings();
155
156 ?>
157
158 ... done.
159
160 <?php
161 }
162
163 // ###################################################################
164
165 page_end();
166
167 /*=====================================================================*\
168 || ###################################################################
169 || # $HeadURL$
170 || # $Id$
171 || ###################################################################
172 \*=====================================================================*/
173 ?>