From 84652b4994cef495c32284a763c45adaaeb7e359 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Tue, 26 May 2009 01:28:14 +0000 Subject: [PATCH] Added debug ability --- config.default.php | 4 ++++ db.inc.php | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config.default.php b/config.default.php index 7afae19f..47d81eb1 100644 --- a/config.default.php +++ b/config.default.php @@ -159,5 +159,9 @@ if (!defined('LDB_HOST')) define('LDB_HOST', DB_HOST); if (!defined('LDB_NAME')) define('LDB_NAME', DB_NAME); if (!defined('LDB_TYPE')) define('LDB_TYPE', DB_TYPE); +/** + * Debugging + */ +if (!defined('DEBUG')) define('DEBUG',false); ?> diff --git a/db.inc.php b/db.inc.php index 8d670289..42361e9f 100644 --- a/db.inc.php +++ b/db.inc.php @@ -52,6 +52,16 @@ if (!(include_once(ADODB_PATH . 'session/adodb-session2.php'))) print "

ERROR: Please modify config.inc.php for ADODB_PATH to point to your ADODb installation

"; } +define('ADODB_OUTP',"outputDebug"); + +/** + * Output for debugging + */ +function outputDebug($text,$newline) +{ + error_log($text,0); +} + //if PEAR not installed: set_include_path("."); //TEMP ONLY set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__).'/include/pear/'); @@ -60,13 +70,13 @@ set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__).'/inclu $db = newADOConnection(DB_TYPE); $db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); $db->SetFetchMode(ADODB_FETCH_ASSOC); - +if (DEBUG == true) $db->debug = true; //global database variable for limesurvey $ldb = newADOConnection(LDB_TYPE); $ldb->Connect(LDB_HOST, LDB_USER, LDB_PASS, LDB_NAME); $ldb->SetFetchMode(ADODB_FETCH_ASSOC); - +if (DEBUG == true) $ldb->debug = true; //store session in database (see sessions2 table) ADOdb_Session::config(DB_TYPE, DB_HOST, DB_USER, DB_PASS, DB_NAME,$options=false);