diff --git a/install2.php b/install2.php
index 65eef8dc..a4bb7f9f 100644
--- a/install2.php
+++ b/install2.php
@@ -56,28 +56,46 @@ mysql_select_db($DBNAME);
}
echo "version $dbcodeversion
";
-
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 "ERROR: found version $dbdbversion
";
+ if($dbdbversion)
+ {
+ echo "ERROR: found version $dbdbversion
";
- //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)
- 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)
+ echo "Your SFIAB database needs to be updated. You should run the update script instead of this installer!\n";
+ exit;
+ }
+ else
+ {
+ echo "Not found (good!)
";
+ }
}
else
{
echo "Not found (good!)
";
}
+ echo "Checking if db/db.db.version.txt is writable... ";
+ if(is_writable("db/db.db.version.txt"))
+ {
+ echo "Yes
";
+ }
+ else
+ {
+ echo "ERROR: cannot install. db/db.db.version.txt is not writeable
";
+ 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 Done! installed database version $dbcodeversion
\n";
$fp=fopen("db/db.db.version.txt","w");
fputs($fp,$dbcodeversion."\n");
fclose($fp);
+ echo "
";
+ echo "Done!
";
+ echo "Proceed to installation step 3
";
}
else
{