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)

This commit is contained in:
james 2005-11-25 15:16:47 +00:00
parent 860175ae79
commit 122194d296

View File

@ -100,7 +100,30 @@ mysql_select_db($DBNAME);
}
else
{
echo "<b>ERROR: Couldnt find db/db.full.$dbcodeversion.sql</b><br />";
echo "<b>WARNING: Couldnt find db/db.full.$dbcodeversion.sql</b><br />";
echo "Trying to find an older version... <br />";
for($x=$dbcodeversion;$x>0;$x--)
{
if(file_exists("db/db.full.$x.sql"))
{
echo "<b>db/db.full.$x.sql found</b><br />";
echo "Setting up database tables... ";
system("mysql -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$x.sql");
echo "<b>Done! installed database version $x</b><br />\n";
echo "<b>NOTE: YOU WILL NEED TO RUN THE db_update.php SCRIPT TO MANUALLY UPDATE THE DATABASE FROM $x to $dbcodeversion</b><br />";
//now update the db version in the database
mysql_query("UPDATE config SET val='$x' WHERE var='DBVERSION' AND year='0'");
echo "<br />";
echo "<b>Done!</b><br />";
echo "<a href=\"install3.php\">Proceed to installation step 3</a><br />";
break;
}
}
}
//only if this file was created will we go ahead with the rest