From 50538bd332253d1d9fb2d9dbad31f86014eacb35 Mon Sep 17 00:00:00 2001 From: Gregory PLANCHAT Date: Sun, 3 Jun 2012 22:25:54 +0200 Subject: [PATCH] Updated profiler default visibility Updated comments blocks Signed-off-by: Gregory PLANCHAT --- src/.htaccess | 2 +- src/application/bootstrap.php | 7 +++---- src/application/code/core/Wootook.php | 1 + .../Wootook/Core/Database/ConnectionManager.php | 15 +++------------ .../code/core/Wootook/Core/ErrorProfiler.php | 6 ++++-- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/.htaccess b/src/.htaccess index c37a643..ca113c2 100644 --- a/src/.htaccess +++ b/src/.htaccess @@ -15,4 +15,4 @@ SetEnv DEPRECATION On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule .* index.php [L] - \ No newline at end of file + diff --git a/src/application/bootstrap.php b/src/application/bootstrap.php index 1154c2a..b0b3c9c 100644 --- a/src/application/bootstrap.php +++ b/src/application/bootstrap.php @@ -28,9 +28,6 @@ * */ -define('DEBUG', true); -define('DEPRECATION', true); - if (!defined('PHP_VERSION_ID')) { $version = explode('.',PHP_VERSION); define('PHP_VERSION_ID', (((int)$version[0]) * 10000 + ((int)$version[1]) * 100 + ((int)$version[2]))); @@ -95,7 +92,9 @@ if (defined('IN_ADMIN')) { include ROOT_PATH . 'includes/constants.php'; -Wootook_Core_ErrorProfiler::register(); +if (defined('DEBUG')) { + Wootook_Core_ErrorProfiler::register(); +} Wootook_Core_Helper_Config_Events::registerEvents(); if (!Wootook::$isInstalled) { diff --git a/src/application/code/core/Wootook.php b/src/application/code/core/Wootook.php index e427d1d..0515ab1 100644 --- a/src/application/code/core/Wootook.php +++ b/src/application/code/core/Wootook.php @@ -389,6 +389,7 @@ class Wootook $adapter = Wootook_Core_Database_ConnectionManager::getSingleton() ->getConnection('core_read'); } catch (Wootook_Core_Exception_Database_AdapterError $e) { + // This may also occur when the pdo_sqlite driver isn't loaded self::$isInstalled = false; Wootook_Core_ErrorProfiler::getSingleton()->addException($e); return $config; diff --git a/src/application/code/core/Wootook/Core/Database/ConnectionManager.php b/src/application/code/core/Wootook/Core/Database/ConnectionManager.php index b1a098f..4ba8289 100644 --- a/src/application/code/core/Wootook/Core/Database/ConnectionManager.php +++ b/src/application/code/core/Wootook/Core/Database/ConnectionManager.php @@ -165,11 +165,6 @@ class Wootook_Core_Database_ConnectionManager $options = array(); } - $hostname = $params->hostname; - $username = $params->username; - $password = $params->password; - $database = $params->database; - if (empty($params->hostname) || empty($params->username) || empty($params->database)) { return null; } @@ -181,14 +176,10 @@ class Wootook_Core_Database_ConnectionManager $options = $event->getData('options'); - try { - $connection = $this->load($engine, false, array($params, $options)); - } catch (Wootook_Core_Exception_Database_AdapterError $e) { - //Wootook_Core_ErrorProfiler::getSingleton()->addException($e); - return null; - } + $connection = $this->load($engine, false, array($params, $options)); + if (!$connection) { - throw new Wootook_Core_Exception_DataAccessException('Could not find data connection handler.'); + throw new Wootook_Core_Exception_Database_AdapterError('Could not find data connection handler.'); } if (($prefix = Wootook::getConfig("resource/database/{$connectionName}/table_prefix")) !== null) { diff --git a/src/application/code/core/Wootook/Core/ErrorProfiler.php b/src/application/code/core/Wootook/Core/ErrorProfiler.php index 5d93c87..a957b62 100644 --- a/src/application/code/core/Wootook/Core/ErrorProfiler.php +++ b/src/application/code/core/Wootook/Core/ErrorProfiler.php @@ -48,7 +48,7 @@ class Wootook_Core_ErrorProfiler private $_listen = true; - private $_mute = false; + private $_mute = true; /** * @@ -410,7 +410,9 @@ JS_EOF; set_error_handler(array(self::getSingleton(), 'errorManager')); set_exception_handler(array(self::getSingleton(), 'exceptionManager')); - self::getSingleton()->_mute = false; + if (defined('DEBUG')) { + self::getSingleton()->_mute = false; + } if (self::$_isTraceRegistered === false && defined('DEBUG')) { self::$_isTraceRegistered = true;