From 3446daa3daa9ea4e93db824bb9b5fe5d911be0fe Mon Sep 17 00:00:00 2001
From: martinlanghoff
Date: Wed, 12 Sep 2007 02:57:08 +0000
Subject: [PATCH] redirect() - log performance profiling info
Many heavy pages end in a redirect. Log their profiling data!
Thanks to Matt Clarkson for spotting the problem.
---
lib/weblib.php | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/weblib.php b/lib/weblib.php
index ba05f98d13..fe86620497 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -5467,6 +5467,14 @@ function redirect($url, $message='', $delay=-1) {
$message = "Error output, so disabling automatic redirect.
" . $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')) {
--
2.39.5