From d2c8f7063729e5947b78c68bbccdaf9e975d79c4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 13 Mar 2006 05:41:53 +0000 Subject: [PATCH] r756: Adding upgrade system --- install/global.php | 7 +++++ install/upgrade.php | 74 ++++++++++++++++++++++++++++++++++++++++++++ install/upgrade1.php | 67 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 install/upgrade.php create mode 100644 install/upgrade1.php diff --git a/install/global.php b/install/global.php index 24a2823..f0b5158 100644 --- a/install/global.php +++ b/install/global.php @@ -62,6 +62,13 @@ $bugsys->datastore = array(); // ################################################################### +$bugsys->versions = array( + '1.0.0' => 1, + '1.0.1' => -1 +); + +// ################################################################### + $bugsys->in['mark'] = intval($bugsys->in['mark']); // ################################################################### diff --git a/install/upgrade.php b/install/upgrade.php new file mode 100644 index 0000000..cec5c4a --- /dev/null +++ b/install/upgrade.php @@ -0,0 +1,74 @@ +in['next'])) +{ + $db->showerrors = false; + + $version = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "setting WHERE varname = 'trackerversion'"); + $version = $version['value']; + + if (!$version) + { + die('You have done something to your database and this script cannot determine Edoc\'s version... or you have no upgrade to perform...'); + } + + if ($bugsys->versions["$version"] == -1) + { + page_start(); + + echo "

Bugdar Upgrade System

\n\n"; + + echo "

Your Bugdar installation is up-to-date!

\n\n"; + + page_end(false); + } + else + { + header("Location: upgrade.php?next=$version"); + } + + $db->showerrors = true; +} + +// ################################################################### + +else +{ + if ($bugsys->versions[ $bugsys->in['next'] ] == -1) + { + die('Bugdar is up-to-date already'); + } + + header("Location: upgrade" . $bugsys->versions[ $bugsys->in['next'] ] . ".php"); +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file diff --git a/install/upgrade1.php b/install/upgrade1.php new file mode 100644 index 0000000..2bce3d1 --- /dev/null +++ b/install/upgrade1.php @@ -0,0 +1,67 @@ +in['mark'] == 0) +{ +?> +

Welcome to Bugdar

+ +

This upgrade will take from Bugdar 1.0.0 to Bugdar 1.0.1.

+ +

The following steps do not make any major changes except for increasing your version number, as this is a mostly file-based upgrade.

+ +

To begin the process, please click the button below.

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

Version Number Change

+ +

This step finishes the upgrade by inreasing your version number.

+ +query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.0.1' WHERE varname = 'trackerversion'"); + + build_settings(); + +?> + +... done. + + \ No newline at end of file -- 2.22.5