SQL Backtrace also contains the queries executed *during* smarty execution
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 21 Sep 2007 22:46:12 +0000 (00:46 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 21 Sep 2007 22:46:12 +0000 (00:46 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/platalpage.php
include/notifs.inc.php
templates/skin/common.backtrace.tpl
templates/skin/common.devel.tpl

index 950f73e..f89f279 100644 (file)
@@ -120,8 +120,8 @@ abstract class PlatalPage extends Smarty
             $this->assign('simple', true);
 
           case SKINNED:
-          $this->register_modifier('escape_html', 'escape_html');
-          $this->default_modifiers = Array('@escape_html');
+            $this->register_modifier('escape_html', 'escape_html');
+            $this->default_modifiers = Array('@escape_html');
         }
         $this->register_outputfilter('hide_emails');
         $this->addJsLink('wiki.js');
@@ -136,11 +136,6 @@ abstract class PlatalPage extends Smarty
             exit;
         }
 
-        if ($globals->debug & DEBUG_BT) {
-            PlBacktrace::clean();
-            $this->assign_by_ref('backtraces', PlBacktrace::$bt);
-        }
-
         $this->assign('validate', true);
         if (!($globals->debug & DEBUG_SMARTY)) {
             error_reporting(0);
@@ -148,8 +143,15 @@ abstract class PlatalPage extends Smarty
         $result = $this->fetch($skin);
         $ttime  = sprintf('Temps total: %.02fs - Mémoire totale : %dKo<br />', microtime(true) - $TIME_BEGIN
                                                                                 , memory_get_peak_usage(true) / 1024);
-        $replc  = "<span class='erreur'>VALIDATION HTML INACTIVE</span><br />";
+        if ($globals->debug & DEBUG_BT) {
+            PlBacktrace::clean();
+            $this->assign_by_ref('backtraces', PlBacktrace::$bt);
+            $result = str_replace('@@BACKTRACE@@', $this->fetch('skin/common.backtrace.tpl'), $result);
+        } else {
+            $result = str_replace('@@BACKTRACE@@', '', $result);
+        }
 
+        $replc  = "<span class='erreur'>VALIDATION HTML INACTIVE</span><br />";
         if ($globals->debug & DEBUG_VALID) {
             $fd = fopen($this->compile_dir."/valid.html","w");
             fwrite($fd, $result);
index 77dd994..c74a0d6 100644 (file)
@@ -180,8 +180,8 @@ function getNbNotifs()
 
     // selectionne les notifs de uid, sans detail sur le watcher, depuis
     // $watchlast, meme ceux sans surveillance, non ordonnés
-    $res = XDB::query(_select_notifs_count('contacts') . ' UNION DISTINCT '
-                    . _select_notifs_count('watch_promo') . ' UNION DISTINCT '
+    $res = XDB::query(_select_notifs_count('contacts') . ' UNION '
+                    . _select_notifs_count('watch_promo') . ' UNION '
                     . _select_notifs_count('watch_nonins'), $uid, $uid, $uid);
     $n = array_sum($res->fetchColumn());
     if ($n == 0) {
index 436e923..2e29454 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
-
+{foreach from=$backtraces key=bt_name item=trace}
+<div class="backtrace">
+  <h1>
+    {if $trace->error}<span style="color: #f00">{/if}
+    Exécution de {$bt_name} : {$trace->traces|@count} actions en {$trace->totaltime|string_format:"%.3f"}s (hover-me pour la trace)
+    {if $trace->error}</span>{/if}
+  </h1>
+  <div class="hide">
 {foreach item=query from=$trace->traces}
 {if $query.data}
 {assign var=cols value=$query.data[0]|@count}
@@ -66,5 +73,8 @@
 {/if}
 </table>
 {/foreach}
+</div>
+</div>
+{/foreach}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 22f6b07..868f138 100644 (file)
 {**************************************************************************}
 
 {if #globals.debug#}
-{foreach from=$backtraces key=bt_name item=trace}
-  <div class="backtrace">
-    <h1>
-      {if $trace->error}<span style="color: #f00">{/if}
-      Exécution de {$bt_name} : {$trace->traces|@count} actions en {$trace->totaltime|string_format:"%.3f"}s (hover-me pour la trace)
-      {if $trace->error}</span>{/if}
-    </h1>
-    <div class="hide">
-      {include file="skin/common.backtrace.tpl"}
-    </div>
-  </div>
-{/foreach}
+@@BACKTRACE@@
 
 {if $validate}
   <div id="dev">