diff --git a/install.php b/install.php index d5efc15..e4f2221 100644 --- a/install.php +++ b/install.php @@ -28,16 +28,17 @@ echo "\n"; +

SFIAB Installation - Step 1

SFIAB is already installed"; + echo "
SFIAB Installation Step 1 is already complete.
"; + echo "Proceed to installation step 2
"; echo ""; exit; } ?> -

SFIAB Installation

\n"); fclose($fp); - echo "Done!"; - - //only if this file was created will we go ahead with the rest - //creating all the tables and such.. + echo "Done!
"; + echo "Proceed to installation step 2
"; } else { diff --git a/install2.php b/install2.php new file mode 100644 index 0000000..65eef8d --- /dev/null +++ b/install2.php @@ -0,0 +1,105 @@ + + Copyright (C) 2005 James Grant + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation, version 2. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +echo "\n"; +?> + + +SFIAB Installation + + + +

SFIAB Installation - Step 2

+SFIAB Installation Step 1 is not yet complete."; + echo "Go back to installation step 1
"; + echo ""; + exit; +} + +require_once("data/config.inc.php"); +mysql_connect($DBHOST,$DBUSER,$DBPASS); +mysql_select_db($DBNAME); + + echo "Getting database version requirements for code... "; + + if(file_exists("db/db.code.version.txt")) + { + $dbcodeversion_file=file("db/db.code.version.txt"); + $dbcodeversion=trim($dbcodeversion_file[0]); + } + else + { + echo "ERROR: Couldnt load current db/db.code.version.txt
"; + exit; + } + 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
"; + + //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!)
"; + } + + echo "Checking for database installer for version $dbcodeversion... "; + if(file_exists("db/db.full.$dbcodeversion.sql")) + { + echo "db/db.full.$dbcodeversion.sql found
"; + + 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); + } + else + { + echo "ERROR: Couldnt find db/db.full.$dbcodeversion.sql
"; + } + + //only if this file was created will we go ahead with the rest + //creating all the tables and such.. + +?> + +