redirect() - log performance profiling info
authormartinlanghoff <martinlanghoff>
Wed, 12 Sep 2007 02:57:08 +0000 (02:57 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 12 Sep 2007 02:57:08 +0000 (02:57 +0000)
Many heavy pages end in a redirect. Log their profiling data!

Thanks to Matt Clarkson for spotting the problem.

lib/weblib.php

index ba05f98d13ea077ebab009c41c590fca43912f1b..fe86620497d8c1151cc1819d87ebe24094f6a442 100644 (file)
@@ -5467,6 +5467,14 @@ function redirect($url, $message='', $delay=-1) {
         $message = "<strong>Error output, so disabling automatic redirect.</strong></p><p>" . $message;
     }
 
+    $performanceinfo = '';
+    if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {
+        if (defined('MDL_PERFTOLOG')) {
+            $perf = get_performance_info();
+            error_log("PERF: " . $perf['txt']);
+        }
+    }
+
 /// when no message and header printed yet, try to redirect
     if (empty($message) and !defined('HEADER_PRINTED')) {