Skip to content

Commit

Permalink
Adding a workaround to DboSource::showLog() to work around fix added …
Browse files Browse the repository at this point in the history
…in [da9c0da].

Also adding explanation message when logs are not generated.
  • Loading branch information
markstory committed Aug 27, 2010
1 parent 123873b commit ea9e308
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cake/libs/model/datasources/dbo_source.php
Expand Up @@ -630,7 +630,7 @@ function showLog($sorted = false) {
$controller = null;
$View =& new View($controller, false);
$View->set('logs', array($this->configKeyName => $log));
echo $View->element('sql_dump');
echo $View->element('sql_dump', array('_forced_from_dbo_' => true));
} else {
foreach ($log['log'] as $k => $i) {
print (($k + 1) . ". {$i['query']} {$i['error']}\n");
Expand Down
10 changes: 7 additions & 3 deletions cake/libs/view/elements/sql_dump.ctp
Expand Up @@ -20,7 +20,8 @@
if (!class_exists('ConnectionManager') || Configure::read('debug') < 2) {
return false;
}
if (!isset($logs)):
$noLogs = !isset($logs);
if ($noLogs):
$sources = ConnectionManager::sourceList();

$logs = array();
Expand All @@ -31,8 +32,9 @@ if (!isset($logs)):
endif;
$logs[$source] = $db->getLog();
endforeach;
endif;


if ($noLogs || isset($_forced_from_dbo_)):
foreach ($logs as $source => $logInfo):
$text = $logInfo['count'] > 1 ? 'queries' : 'query';
printf(
Expand All @@ -52,6 +54,8 @@ if (!isset($logs)):
?>
</tbody></table>
<?php
endforeach;
endforeach;
else:
echo '<p>Encountered unexpected $logs cannot generate SQL log</p>';
endif;
?>

0 comments on commit ea9e308

Please sign in to comment.