/** static public function test * Test the MySQL connection * * @param void * @return bool connection OK */ public static function test() { if (!is_null(self::$_instance)) { return true; } if (!Mysql::test()) { return false; } // look for anything in the settings table $query = "\n\t\t\tSELECT *\n\t\t\tFROM `" . self::SETTINGS_TABLE . "`\n\t\t"; $return = Mysql::get_instance()->query($query); return (bool) $return; }
} // set our DEBUG constant $GLOBALS['_&_DEBUG_QUERY'] = ''; $GLOBALS['_?_DEBUG_QUERY'] = ''; if (!defined('DEBUG')) { if (test_debug()) { define('DEBUG', true); // DO NOT CHANGE THIS ONE } else { define('DEBUG', (bool) $debug); // set to true for output of debugging code } } $GLOBALS['_LOGGING'] = DEBUG; // do not change, rather, change debug value if (Mysql::test()) { $Mysql = Mysql::get_instance(); $Mysql->set_settings(array('log_path' => LOG_DIR, 'email_subject' => GAME_NAME . ' Query Error')); if (class_exists('Settings') && Settings::test()) { $Mysql->set_settings(array('log_errors' => Settings::read('DB_error_log'), 'email_errors' => Settings::read('DB_error_email'), 'email_from' => Settings::read('from_email'), 'email_to' => Settings::read('to_email'))); } } if (defined('DEBUG') && DEBUG) { ini_set('display_errors', 'On'); error_reporting(-1); // everything if (isset($Mysql)) { $Mysql->set_error(3); } } // log the player in