From c9c27dce134f2c2c9e37e38d6f318c946381756a Mon Sep 17 00:00:00 2001 From: seek3r Date: Sat, 30 Sep 2000 02:40:33 +0000 Subject: [PATCH] added support for new versioning system --- setup/index.php | 116 ++++++++++++++++++++++-------- setup/upgradetables_mysql.inc.php | 12 ++++ 2 files changed, 97 insertions(+), 31 deletions(-) diff --git a/setup/index.php b/setup/index.php index 750ed690b4..e00a41f9a8 100644 --- a/setup/index.php +++ b/setup/index.php @@ -44,6 +44,12 @@ // $db->Halt_On_Error = "report"; $db->Halt_On_Error = "no"; + if (!isset($oldversion)){ + $db->query("select app_version from applications where app_name='admin'"); + $db->next_record(); + $oldversion = $db->f("app_version"); + } + switch($msg){ case "1": return "You have been successfully logged out"; @@ -55,6 +61,36 @@ /* Database setup */ switch($action){ + case "regularversion": + echo "phpGroupWare Setup\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " "; + echo " \n"; + echo "
 Analysis
You appear to be running version $oldversion of phpGroupWare.
\n"; + echo " We will automaticly update your tables/records to $newversion, but we highly recommend backing up your tables incase the script causes damage to your data.\n"; + echo " These automated scripts can easily destroy your data. Please backup before going any further!
"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + echo "\n"; + + break; case "prebetaversion": echo "phpGroupWare Setup\n"; echo "\n"; @@ -65,7 +101,7 @@ echo " \n"; echo " You appear to be running a pre-beta version of phpGroupWare
\n"; echo " We are providing an automated upgrade system, but we highly recommend backing up your tables incase the script causes damage to your data.
\n"; - echo " These automated scripts can easily destroy your data. Please backup before gonig any further!\n"; + echo " These automated scripts can easily destroy your data. Please backup before going any further!\n"; echo " \n"; echo "\n"; ?> @@ -142,8 +178,8 @@ $db->Halt_On_Error = "report"; include ("upgradetables_".$phpgw_info["server"]["db_type"].".inc.php"); // include ("default_records.inc.php"); - include ("lang_records.inc.php"); $db->Halt_On_Error = "no"; + include ("lang_records.inc.php"); echo "\n"; echo " \n"; echo " \n"; @@ -155,10 +191,8 @@ echo "
 Status
\n"; break; default: - $db->query("select * from config"); - if ($db->num_rows() == 0){ - $db->query("select * from accounts"); - if ($db->num_rows() == 0){ + if (isset($oldversion)){ + if ($newversion == $oldversion){ echo "phpGroupWare Setup\n"; echo "\n"; echo "\n"; @@ -166,38 +200,58 @@ echo " \n"; echo " \n"; echo " \n"; - echo " \n"; - echo " \n"; - $db->Halt_On_Error = "report"; - include ("createtables_".$phpgw_info["server"]["db_type"].".inc.php"); - include ("default_records.inc.php"); - include ("lang_records.inc.php"); - $db->Halt_On_Error = "no"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; echo " \n"; echo "
 Analysis
You appear to be running a new install of phpGroupWare, so the tables will be created for you.
 Status
If you did not recieve any errors, your tables have been created.
\n"; + echo "
Your database is to date with version $oldversion.
\n"; echo " Click here to configure the environment.
\n"; }else{ - Header("Location: $PHP_SELF?action=prebetaversion"); + Header("Location: $PHP_SELF?action=regularversion"); } }else{ - echo "phpGroupWare Setup\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
 Analysis
Your database seems to be current.
\n"; - echo " Click here to configure the environment.
\n"; + $db->query("select * from config"); + if ($db->num_rows() == 0){ + $db->query("select * from accounts"); + if ($db->num_rows() == 0){ + echo "phpGroupWare Setup\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + $db->Halt_On_Error = "report"; + include ("createtables_".$phpgw_info["server"]["db_type"].".inc.php"); + include ("default_records.inc.php"); + include ("lang_records.inc.php"); + $db->Halt_On_Error = "no"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
 Analysis
You appear to be running a new install of phpGroupWare, so the tables will be created for you.
 Status
If you did not recieve any errors, your tables have been created.
\n"; + echo " Click here to configure the environment.
\n"; + }else{ + Header("Location: $PHP_SELF?action=prebetaversion"); + } + }else{ + echo "phpGroupWare Setup\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
 Analysis
Your database seems to be current.
\n"; + echo " Click here to configure the environment.
\n"; + } } - } + } echo ""; //db->disconnect(); diff --git a/setup/upgradetables_mysql.inc.php b/setup/upgradetables_mysql.inc.php index 30a33a3070..a7a2779206 100644 --- a/setup/upgradetables_mysql.inc.php +++ b/setup/upgradetables_mysql.inc.php @@ -13,6 +13,7 @@ function v7122000to8032000(){ global $currentver, $db; + $didupgrade = True; if ($currentver == "7122000"){ echo " \n"; // echo " Upgrade from 7122000 to 8032000 is completed.\n"; @@ -23,6 +24,7 @@ } function v8032000to8072000(){ global $currentver, $db; + $didupgrade = True; if ($currentver == "8032000"){ echo " \n"; // echo " Upgrade from 8032000 to 8072000 is completed.\n"; @@ -34,6 +36,7 @@ function v8072000to8212000(){ global $currentver, $db; + $didupgrade = True; if ($currentver == "8072000"){ $sql = "CREATE TABLE applications (" @@ -68,6 +71,7 @@ } function v8212000to9052000(){ global $currentver, $db; + $didupgrade = True; if ($currentver == "8212000"){ $db->query("alter table chat_channel change name name varchar(10) not null"); $db->query("alter table chat_messages change channel channel char(20) not null"); @@ -85,6 +89,7 @@ } function v9052000to9072000(){ global $currentver, $db; + $didupgrade = True; if ($currentver == "9052000"){ echo " \n"; // echo " Upgrade from 9052000 to 9072000 is completed.\n"; @@ -95,6 +100,7 @@ } function v9072000to0_9_1(){ global $currentver, $newversion, $db; + $didupgrade = True; if ($currentver == "9072000"){ $db->query("alter table accounts change con account_id int(11) DEFAULT '0' NOT NULL auto_increment"); @@ -192,5 +198,11 @@ v9072000to0_9_1(); $db->query("update applications set app_version='$newversion' where (app_name='admin' or app_name='filemanager' or app_name='addressbook' or app_name='todo' or app_name='calendar' or app_name='email' or app_name='nntp' or app_name='cron_apps')"); + if (!$didupgrade == True){ + echo " \n"; + echo " No table changes were needed. The script only updated your version setting.\n"; + echo " \n"; + } + echo "\n"; ?> \ No newline at end of file