From 4f4bf1da18181d412cd755143e016ede587cc1d6 Mon Sep 17 00:00:00 2001 From: paulr Date: Thu, 10 Nov 2011 17:34:53 +1100 Subject: [PATCH] fixing up the "is setup" check in the installer --- gwvplib/gwvpdatabase.php | 18 +++++++++++++++--- gwvplib/gwvpsetup.php | 5 ++++- www/index.php | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gwvplib/gwvpdatabase.php b/gwvplib/gwvpdatabase.php index acb1a7a..5823c0c 100644 --- a/gwvplib/gwvpdatabase.php +++ b/gwvplib/gwvpdatabase.php @@ -3,6 +3,11 @@ global $DB_CONNECTION; $DB_CONNECTION = false; + +global $db_url, $db_type; +error_log("in include for database, $db_type, $db_name"); + + // i need to figure out how i do data encapsulation here. We'll support mysql and sqlite3 off the bat if we can - sqlite3 comes first tho function gwvp_dbCreateMysqlStructure() { @@ -200,10 +205,15 @@ function gwvp_setConfigVal($confname, $confval) function gwvp_isDBSetup() { // for sqlite, we just check if the db exists, for everyone else, we check for a conneciton and go yay or nay - global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_url; - + global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name; + + // oh this isnt working. poo. + error_log("checking for $db_name, $db_type"); + if($db_type == "sqlite") { - if(file_exists($db_url)) return true; + if(file_exists($db_name)) { + return true; + } else return false; } @@ -216,6 +226,8 @@ function gwvp_ConnectDB() global $WEB_ROOT_FS, $BASE_URL, $data_directory, $db_type, $db_name, $DB_CONNECTION; // first check if $DB_CONNECTION IS live + error_log("in connection $db_type, $db_name"); + if($DB_CONNECTION != false) return $DB_CONNECTION; if($db_type == "sqlite") { diff --git a/gwvplib/gwvpsetup.php b/gwvplib/gwvpsetup.php index aa0eaf1..a9e7a06 100644 --- a/gwvplib/gwvpsetup.php +++ b/gwvplib/gwvpsetup.php @@ -27,7 +27,10 @@ function gwvp_PostSetupPageBody() // TODO: need to do this bit function gwvp_issetup() { - return true; + // check for the config file + if(!file_exists("config.php")) return false; + + return gwvp_isDBSetup(); } diff --git a/www/index.php b/www/index.php index 218c5ad..6864c2c 100644 --- a/www/index.php +++ b/www/index.php @@ -1,7 +1,7 @@