diff --git a/symphony/lib/core/class.errorhandler.php b/symphony/lib/core/class.errorhandler.php
index 788ae83bd9..b020d9cdce 100644
--- a/symphony/lib/core/class.errorhandler.php
+++ b/symphony/lib/core/class.errorhandler.php
@@ -223,14 +223,33 @@ public static function render(Exception $e){
=======
>>>>>>> Symphony no longer logs queries in the core, this can be done with an extension. Remove getLastError(), there is no need as DatabaseExceptions contain all necessary information.
+<<<<<<< HEAD
return sprintf(file_get_contents(self::getTemplate('fatalerror.generic')),
+=======
+ if(is_object(Symphony::Database())){
+ $debug = Symphony::Database()->debug();
+
+ if(!empty($debug) foreach($debug as $query){
+ $queries .= sprintf(
+ '
%s;
[%01.4f]',
+ ($odd == true ? ' class="odd"' : NULL),
+ htmlspecialchars($query['query']),
+ (isset($query['execution_time']) ? $query['execution_time'] : NULL)
+ );
+ $odd = !$odd;
+ }
+ }
+
+ return sprintf(file_get_contents(TEMPLATE . '/fatalerror.generic.tpl'),
+>>>>>>> Slight backflip, queries are logged by the core but only if there is an authenticated user
($e instanceof ErrorException ? GenericErrorHandler::$errorTypeStrings[$e->getSeverity()] : 'Fatal Error'),
$e->getMessage(),
$e->getFile(),
$e->getLine(),
$markdown,
$lines,
- $trace
+ $trace,
+ $queries
);
}
diff --git a/symphony/lib/core/class.symphony.php b/symphony/lib/core/class.symphony.php
index 06e8593c49..90aca48771 100644
--- a/symphony/lib/core/class.symphony.php
+++ b/symphony/lib/core/class.symphony.php
@@ -117,8 +117,7 @@ protected function __construct(){
$this->initialiseExtensionManager();
$this->initialiseCookie();
- // If the user is not a logged in Author, turn off the verbose error
- // messages.
+ // If the user is not a logged in Author, turn off the verbose error messages.
if(!self::isLoggedIn() && is_null($this->Author)){
GenericExceptionHandler::$enabled = false;
}
@@ -788,6 +787,7 @@ public static function render(Exception $e){
if(is_object(Symphony::Database())){
$debug = Symphony::Database()->debug();
+<<<<<<< HEAD
if(count($debug['query']) > 0){
foreach($debug['query'] as $query){
$queries .= sprintf(
@@ -798,6 +798,16 @@ public static function render(Exception $e){
);
$odd = !$odd;
}
+=======
+ if(!empty($debug) foreach($debug as $query){
+ $queries .= sprintf(
+ '%s;
[%01.4f]',
+ ($odd == true ? ' class="odd"' : NULL),
+ htmlspecialchars($query['query']),
+ (isset($query['execution_time']) ? $query['execution_time'] : NULL)
+ );
+ $odd = !$odd;
+>>>>>>> Slight backflip, queries are logged by the core but only if there is an authenticated user
}
}
diff --git a/symphony/lib/toolkit/class.mysql.php b/symphony/lib/toolkit/class.mysql.php
index a168fedac6..70ecf6ac70 100644
--- a/symphony/lib/toolkit/class.mysql.php
+++ b/symphony/lib/toolkit/class.mysql.php
@@ -497,7 +497,19 @@ public function query($query, $type = "OBJECT"){
'query_hash' => $query_hash,
'execution_time' => precision_timer('stop', $start)
));
+
+ // If the ExceptionHandler is enabled, then the user is authenticated
+ // or we have a serious issue, so log the query.
+ if(GenericExceptionHandler::$enabled) {
+ self::$_log[$query_hash] = array(
+ 'query' => $query,
+ 'query_hash' => $query_hash,
+ 'execution_time' => precision_timer('stop', $start)
+ );
+ }
}
+
+ // Symphony isn't ready yet. Log internally
else {
self::$_log[$query_hash] = array(
'query' => $query,
@@ -826,9 +838,7 @@ public function getStatistics() {
$query_timer = 0.0;
$slow_queries = array();
- $query_log = $this->debug();
-
- foreach($query_log as $key => $val) {
+ foreach(self::$_log as $key => $val) {
$query_timer += $val['execution_time'];
if($val['execution_time'] > 0.0999) $slow_queries[] = $val;
}
diff --git a/symphony/template/fatalerror.database.tpl b/symphony/template/fatalerror.database.tpl
index fc23bd3c6e..10b0159b9e 100644
--- a/symphony/template/fatalerror.database.tpl
+++ b/symphony/template/fatalerror.database.tpl
@@ -83,6 +83,9 @@
Backtrace:
+
+ Database Query Log:
+