From 122194d29681bd4620cd5ed7127c5284d63fc703 Mon Sep 17 00:00:00 2001 From: james Date: Fri, 25 Nov 2005 15:16:47 +0000 Subject: [PATCH] Change installer to look for an older version of the "full" database if the newest (required) version cannot be found. The user will then need to manually update from whatever version is installed to the newest (using db_update.php) --- install2.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/install2.php b/install2.php index b444074..565ae64 100644 --- a/install2.php +++ b/install2.php @@ -100,7 +100,30 @@ mysql_select_db($DBNAME); } else { - echo "ERROR: Couldnt find db/db.full.$dbcodeversion.sql
"; + echo "WARNING: Couldnt find db/db.full.$dbcodeversion.sql
"; + echo "Trying to find an older version...
"; + + for($x=$dbcodeversion;$x>0;$x--) + { + if(file_exists("db/db.full.$x.sql")) + { + echo "db/db.full.$x.sql found
"; + echo "Setting up database tables... "; + + system("mysql -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME Done! installed database version $x
\n"; + echo "NOTE: YOU WILL NEED TO RUN THE db_update.php SCRIPT TO MANUALLY UPDATE THE DATABASE FROM $x to $dbcodeversion
"; + + //now update the db version in the database + mysql_query("UPDATE config SET val='$x' WHERE var='DBVERSION' AND year='0'"); + + echo "
"; + echo "Done!
"; + echo "Proceed to installation step 3
"; + break; + } + } } //only if this file was created will we go ahead with the rest