From 14f876fbc92e4abec82fb75d2d488def6ba58b60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20W=C3=BCrth?=
Date: Thu, 8 Aug 2013 00:41:03 +0200
Subject: [PATCH] Improved code readability
Changed table echo to printf for more readable code
Wrapped sql_dump error message in __d(), as discussed here:
https://github.com/cakephp/cakephp/commit/4c4fdc6f70e5b98b043609af11025200d09263c6#commitcomment-3155723
and here:
https://github.com/cakephp/cakephp/pull/1491/files#r5646701
---
lib/Cake/View/Elements/sql_dump.ctp | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/Cake/View/Elements/sql_dump.ctp b/lib/Cake/View/Elements/sql_dump.ctp
index 59aeca8e6..5623a58cf 100644
--- a/lib/Cake/View/Elements/sql_dump.ctp
+++ b/lib/Cake/View/Elements/sql_dump.ctp
@@ -58,19 +58,27 @@ if ($noLogs || isset($_forced_from_dbo_)):
}
foreach ($i['params'] as $bindKey => $bindVal) {
if ($bindType === true) {
- $bindParam .= h($bindKey) ." => " . h($bindVal) . ", ";
+ $bindParam .= h($bindKey) . " => " . h($bindVal) . ", ";
} else {
$bindParam .= h($bindVal) . ", ";
}
}
$i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]";
}
- echo "" . ($k + 1) . " | " . h($i['query']) . " | {$i['error']} | {$i['affected']} | {$i['numRows']} | {$i['took']} |
\n";
+ printf('%d | %s | %s | %d | %d | %d |
%s',
+ $k + 1,
+ h($i['query']),
+ $i['error'],
+ $i['affected'],
+ $i['numRows'],
+ $i['took'],
+ "\n"
+ );
endforeach;
?>
Encountered unexpected $logs cannot generate SQL log
';
+ printf('%s
', __d('cake_dev', 'Encountered unexpected %s. Cannot generate SQL log.', '$logs'));
endif;