forked from science-ation/science-ation
Finish install2 script, now just need to populate the db with installer step 3
This commit is contained in:
parent
850be50973
commit
8a59a293b2
43
install2.php
43
install2.php
@ -56,28 +56,46 @@ mysql_select_db($DBNAME);
|
||||
}
|
||||
echo "<b>version $dbcodeversion</b><br />";
|
||||
|
||||
|
||||
echo "Checking for existing SFIAB database... ";
|
||||
if(file_exists("db/db.db.version.txt"))
|
||||
{
|
||||
$dbdbversion_file=file("db/db.db.version.txt");
|
||||
$dbdbversion=trim($dbdbversion_file[0]);
|
||||
echo "<b>ERROR: found version $dbdbversion</b><br />";
|
||||
if($dbdbversion)
|
||||
{
|
||||
echo "<b>ERROR: found version $dbdbversion</b><br />";
|
||||
|
||||
//lets see if they match
|
||||
if($dbcodeversion == $dbdbversion)
|
||||
echo "Your SFIAB database is already setup with the required version\n";
|
||||
else if($dbcodeversion<$dbdbversion)
|
||||
echo "ERROR: dbcodeversion<dbdbversion ($dbcodeversion<$dbdbversion). This should not happen!";
|
||||
else if($dbcodeversion>$dbdbversion)
|
||||
echo "Your SFIAB database needs to be updated. You should run the update script instead of this installer!\n";
|
||||
exit;
|
||||
//lets see if they match
|
||||
if($dbcodeversion == $dbdbversion)
|
||||
echo "Your SFIAB database is already setup with the required version\n";
|
||||
else if($dbcodeversion<$dbdbversion)
|
||||
echo "ERROR: dbcodeversion<dbdbversion ($dbcodeversion<$dbdbversion). This should not happen!";
|
||||
else if($dbcodeversion>$dbdbversion)
|
||||
echo "Your SFIAB database needs to be updated. You should run the update script instead of this installer!\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<b>Not found (good!)</b><br />";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<b>Not found (good!)</b><br />";
|
||||
}
|
||||
|
||||
echo "Checking if db/db.db.version.txt is writable... ";
|
||||
if(is_writable("db/db.db.version.txt"))
|
||||
{
|
||||
echo "<b>Yes</b><br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<b>ERROR: cannot install. db/db.db.version.txt is not writeable</b><br />";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
echo "Checking for database installer for version $dbcodeversion... ";
|
||||
if(file_exists("db/db.full.$dbcodeversion.sql"))
|
||||
{
|
||||
@ -85,12 +103,15 @@ mysql_select_db($DBNAME);
|
||||
|
||||
echo "Setting up database tables... ";
|
||||
|
||||
system("mysql -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db.update.$ver.sql");
|
||||
system("mysql -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME <db/db.full.$ver.sql");
|
||||
|
||||
echo "<b>Done! installed database version $dbcodeversion</b><br />\n";
|
||||
$fp=fopen("db/db.db.version.txt","w");
|
||||
fputs($fp,$dbcodeversion."\n");
|
||||
fclose($fp);
|
||||
echo "<br />";
|
||||
echo "<b>Done!</b><br />";
|
||||
echo "<a href=\"install3.php\">Proceed to installation step 3</a><br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user