2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2004-2009 Blue Static
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 2 of the License.
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
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 \*=====================================================================*/
22 define('STOP_MARK', 5);
23 define('ACTIVE_SITE', 'upgrade11.php');
25 require_once('./global.php');
26 require_once('./includes/functions_datastore.php');
30 // ###################################################################
32 if ($input->in
['mark'] == 0)
35 <h1
>Welcome to Bugdar
</h1
>
37 <p
>This upgrade will move you from Bugdar
1.1.5 to Bugdar
1.2.0 Beta
1.</p
>
39 <p
>To begin the process
, please click the button below
.</p
>
43 // ###################################################################
45 if ($input->in
['mark'] == 1)
48 <h1
>Minor Database Table Changes
</h1
>
50 <p
>There are a few minor changes made to Bugdar
's database schema that need to be propagated.</p>
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";
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";
59 $db->query("ALTER TABLE " . TABLE_PREFIX . "product CHANGE componentmother parentid INT UNSIGNED NULL");
60 echo "Renaming product.componentmother to product.parentid<br />\n";
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";
65 $db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD authid VARCHAR(255) NULL");
66 echo "Adding user.authid for the Authentication API<br />\n";
68 echo "... done<br />\n";
71 // ###################################################################
73 if ($input->in['mark
'] == 2)
76 <h1>Search Table Changes</h1>
78 <p>To support saved searches, a few major modifications need to be performed on the search table.</p>
81 $db->query("ALTER TABLE " . TABLE_PREFIX . "search DROP PRIMARY KEY");
82 echo "Dropping current primary key<br />\n";
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";
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";
90 $db->query("DELETE FROM " . TABLE_PREFIX . "search");
91 echo "Clearing out all the old searches<br />\n";
93 echo "... done<br />\n";
96 // ###################################################################
98 if ($input->in['mark
'] == 3)
101 <h1>Custom Field Updates</h1>
103 <p>A change was made to the storage of custom bug field data. The data is being migrated to a different database table, but no data will be lost. This may take a few minutes. Do <em>not</em> go onto the next step if you receive any errors here.</p>
105 // gets all the fields
106 $fields = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugfield");
107 foreach ($fields as $field)
109 // create the database field
110 $db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD custom$field[fieldid] MEDIUMTEXT NULL");
112 echo "Migrating custom$field[fieldid]";
114 // update all the data
115 $data = $db->query("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill");
116 foreach ($data as $custom)
119 $db->query("UPDATE " . TABLE_PREFIX . "bug SET custom$field[fieldid] = '" . $db->escape_string($custom["field
$field[fieldid
]"]) . "' WHERE bugid = $custom[bugid]");
124 echo ".... all done<br />\n";
127 // ###################################################################
129 if ($input->in['mark
'] == 4)
132 <h1>Database Table Changes</h1>
134 <p>A few new features require new database tables, so we're adding those now
.</p
>
137 $db->query("DROP TABLE " . TABLE_PREFIX
. "bugvaluefill");
138 echo "Dropping the old storage system for custom field data<br />";
141 CREATE TABLE " . TABLE_PREFIX
. "passwordreset
143 activatorid VARCHAR(250) NOT NULL,
145 dateline INT NOT NULL,
146 PRIMARY KEY (activatorid)
149 echo "Creating passwordreset table to create a 'lost password' functionality<br />\n";
152 CREATE TABLE " . TABLE_PREFIX
. "adminsession
154 sessionid VARCHAR(250) NOT NULL,
155 userid INT UNSIGNED NOT NULL,
156 dateline INT UNSIGNED NOT NULL,
157 PRIMARY KEY (sessionid)
160 echo "Creating adminsession table to greatly improve the admin control panel security<br />\n";
163 CREATE TABLE " . TABLE_PREFIX
. "template
165 filename VARCHAR(255) NOT NULL,
166 template TEXT NOT NULL,
167 timestamp INT(10) UNSIGNED NOT NULL,
168 PRIMARY KEY (filename)
171 echo "Creating template table to cache templates in the database to greatly inprove speed<br />\n";
173 echo "... done<br />\n";
176 // ###################################################################
178 if ($input->in
['mark'] == 5)
181 <h1
>Version Number Change
</h1
>
183 <p
>This step finishes the upgrade by inreasing your version number
.</p
>
187 $db->query("UPDATE " . TABLE_PREFIX
. "setting SET value = '1.2.0 Beta 1' WHERE varname = 'trackerversion'");
188 $db->query("REPLACE INTO " . TABLE_PREFIX
. "setting (varname, value) VALUES ('authmethod', 'default')");
189 $db->query("REPLACE INTO " . TABLE_PREFIX
. "setting (varname, value) VALUES ('columnoptions', '" . $db->escape_string('a:12:{s:5:"bugid";s:1:"1";s:7:"summary";s:1:"2";s:8:"reporter";s:1:"2";s:7:"product";s:1:"3";s:9:"component";s:1:"0";s:7:"version";s:1:"3";s:6:"status";s:1:"4";s:10:"resolution";s:1:"4";s:8:"priority";s:1:"5";s:8:"severity";s:1:"5";s:8:"lastpost";s:1:"6";s:5:"votes";s:1:"0";}') . "')");
190 $db->query("REPLACE INTO " . TABLE_PREFIX
. "fieldhelp (keystring, title, body) VALUES ('columnorder', 'Custom Column Ordering', 'You can change the ordering and display of columns on the bug list using these settings. Any column with a position value of "0" will not be displayed in the list. Columns are positioned in the grid with the lowest numbered column starting at the far-left. If columns share a position number, they will be placed in the same column position.')");
202 // ###################################################################