in['mark'] == 0) { ?>

Welcome to Bugdar

This upgrade will take from Bugdar 1.0.1 to Bugdar 1.1.0 Beta 1.

The following steps will make changes to your database schema so that you can run Bugdar 1.1.0 Beta 1. Please note that this upgrade requires the clearing of any stored searches; we apologize for this inconvenience.

To begin the process, please click the button below.

in['mark'] == 1) { ?>

Major Table Changes

Major table additions and deletions are being performed on your database.

query(" CREATE TABLE " . TABLE_PREFIX . "useremail ( userid int unsigned not null, relation int unsigned not null, mask int unsigned not null ) "); echo "Adding the useremail table to store email preferences
\n"; $db->query("DROP TABLE " . TABLE_PREFIX . "dependency"); echo "Dropping the unused dependency table (this was never used and was from a 1.0.0 pre-release version, so data has been lost)
\n"; } // ################################################################### if ($input->in['mark'] == 2) { ?>

User Table Changes

Changes are now being done on the user table.

query("ALTER TABLE " . TABLE_PREFIX . "user ADD usedst BOOL NOT NULL"); echo "Adding user.usedst, a daylight savings time option
\n"; $db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD hidestatuses mediumtext NOT NULL"); echo "Adding user.hidestatuses to allow users to opt to not display certain statuses
\n"; $db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD defaultsortkey varchar(50) NULL"); $db->query("ALTER TABLE " . TABLE_PREFIX . "user ADD defaultsortas varchar(10) NULL"); echo "Adding user.defaultsortkey and user.defaultsortas for bug list sorting options
\n"; } // ################################################################### if ($input->in['mark'] == 3) { ?>

Minor Table Changes

Minor, miscellaneous modifications are now being performed on database tables.

query("DELETE FROM " . TABLE_PREFIX . "search"); echo "Clearing the search table because new features make changes to the way data is stored in this table
\n"; $db->query("ALTER TABLE " . TABLE_PREFIX . "search ADD resultcount INT(10) NULL"); echo "Adding search.resultcount as an internal counter for search features
\n"; $db->query("ALTER TABLE " . TABLE_PREFIX . "bug CHANGE productid product INT(10) UNSIGNED NOT NULL DEFAULT '0'"); echo "Renaming bug.productid to bug.product
\n"; $db->query("ALTER TABLE " . TABLE_PREFIX . "bug CHANGE componentid component INT(10) UNSIGNED NOT NULL DEFAULT '0'"); echo "Renaming bug.componentid to bug.component
\n"; $db->query("ALTER TABLE " . TABLE_PREFIX . "bug CHANGE versionid version INT(10) UNSIGNED NOT NULL DEFAULT '0'"); echo "Renaming bug.versionid to bug.version
\n"; } // ################################################################### if ($input->in['mark'] == 4) { ?>

Caching User Data in Bug Table

To decrease load times and complex queries, user information is now stored in the bug table. This step will add additional fields for this data and then will populate those same fields.

query("ALTER TABLE " . TABLE_PREFIX . "bug ADD username varchar(255) NOT NULL"); $db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD lastpostbyname varchar(255) NOT NULL"); $db->query("ALTER TABLE " . TABLE_PREFIX . "bug ADD hiddenlastpostbyname varchar(255) NOT NULL"); echo "Adding bug.username, bug.lastpostbyname, and bug.hiddenlastpostbyname to store cached user name data
\n"; echo "Caching bug data"; $userlist = array(); $users = $db->query("SELECT userid, displayname FROM " . TABLE_PREFIX . "user"); foreach ($users as $user) { $userlist["$user[userid]"] = $user['displayname']; } $bugs = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug"); foreach ($bugs as $bug) { $db->query(" UPDATE " . TABLE_PREFIX . "bug SET username = '" . $db->escape_string($userlist["$bug[userid]"]) . "', lastpostbyname = '" . $db->escape_string($userlist["$bug[lastpostby]"]) . "', hiddenlastpostbyname = '" . $db->escape_string($userlist["$bug[hiddenlastpostby]"]) . "' WHERE bugid = $bug[bugid] "); echo "."; } echo " done
\n"; } // ################################################################### if ($input->in['mark'] == 5) { ?>

Updating Old History Items

In Bugdar 1.1.0, the bug history feature has been improved significantly. To bring old history messages up to date, processing has to be done. Please wait while historical records are updated.

query("SELECT * FROM " . TABLE_PREFIX . "history"); foreach ($history as $log) { $matches = array(); if (preg_match('#custom_field([0-9]+?)#i', $log['field'], $matches)) { $db->query("UPDATE " . TABLE_PREFIX . "history SET field = 'custom.field{$matches[1]}' WHERE historyid = $log[historyid]"); } else if (preg_match('#comment ([0-9]+?) (hidden|text)#i', $log['field'], $matches)) { $db->query("UPDATE " . TABLE_PREFIX . "history SET field = 'comment.{$matches[2]}', commentid = {$matches[1]} WHERE historyid = $log[historyid]"); } else if ($log['attachmentid'] != 0) { $db->query("UPDATE " . TABLE_PREFIX . "history SET field = 'attachment.{$log['field']}' WHERE historyid = $log[historyid]"); } else if (!preg_match('#^(comment|attachment)?\.#', $log['field'])) { foreach (array('original', 'changed') AS $array) { if (preg_match('# \(id: ([0-9]+?)\)$#i', $log["$array"], $matches)) { $db->query("UPDATE " . TABLE_PREFIX . "history SET $array = {$matches[1]} WHERE historyid = $log[historyid]"); } else if (preg_match('#user ?id:? ([0-9]+?)#i', $log["$array"], $matches)) { $db->query("UPDATE " . TABLE_PREFIX . "history SET $array = {$matches[1]} WHERE historyid = $log[historyid]"); } $db->query("UPDATE " . TABLE_PREFIX . "history SET field = '.{$log['field']}' WHERE historyid = $log[historyid]"); } } echo "."; } echo " done
\n"; } // ################################################################### if ($input->in['mark'] == 6) { ?>

Adding User Email Options

In Bugdar 1.1.0, users can receive email notifications on various bug events. We are now setting the default email settings for all users.

query("SELECT userid FROM " . TABLE_PREFIX . "user"); foreach ($users as $user) { $db->query(" INSERT INTO " . TABLE_PREFIX . "useremail (userid, mask, relation) VALUES ($user[userid], 32, 0), ($user[userid], 320, 1), ($user[userid], 1984, 2), ($user[userid], 64, 4), ($user[userid], 64, 8), ($user[userid], 256, 16 ) "); echo "."; } echo " done
\n"; } // ################################################################### if ($input->in['mark'] == 7) { ?>

Version Number Change

This step finishes the upgrade by inreasing your version number and then updating other settings.

query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0 Beta 1' WHERE varname = 'trackerversion'"); $db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('syndicateditems', '" . $settings['general']['syndicateditems'][1] . "')"); $db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('hidestatuses', '" . $settings['display']['hidestatuses'][1] . "')"); $db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('defaultsortkey', '" . $settings['display']['defaultsortkey'][1] . "')"); $db->query("INSERT INTO " . TABLE_PREFIX . "setting (varname, value) VALUES ('defaultsortas', '" . $settings['display']['defaultsortas'][1] . "')"); build_settings(); ?> ... done.