MDL-79276 core: Fix perfdebug footer bug in non html pages
This commit is contained in:
@@ -195,7 +195,7 @@ class core_shutdown_manager {
|
||||
* Standard shutdown sequence.
|
||||
*/
|
||||
protected static function request_shutdown() {
|
||||
global $CFG, $OUTPUT;
|
||||
global $CFG, $OUTPUT, $PERF;
|
||||
|
||||
// Help apache server if possible.
|
||||
$apachereleasemem = false;
|
||||
@@ -216,14 +216,9 @@ class core_shutdown_manager {
|
||||
$perf = get_performance_info();
|
||||
error_log("PERF: " . $perf['txt']);
|
||||
}
|
||||
if (MDL_PERFTOFOOT || debugging() || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) {
|
||||
if (NO_OUTPUT_BUFFERING) {
|
||||
// If the performance footer was deferred then print it now.
|
||||
if (!CLI_SCRIPT && !WS_SERVER) {
|
||||
$perf = get_performance_info();
|
||||
echo $OUTPUT->select_element_for_replace('#perfdebugfooter', $perf['html']);
|
||||
}
|
||||
}
|
||||
if (!empty($PERF->perfdebugdeferred)) {
|
||||
$perf = get_performance_info();
|
||||
echo $OUTPUT->select_element_for_replace('#perfdebugfooter', $perf['html']);
|
||||
}
|
||||
if (MDL_PERFINC) {
|
||||
$inc = get_included_files();
|
||||
|
||||
@@ -1489,7 +1489,7 @@ class core_renderer extends renderer_base {
|
||||
* @return string HTML fragment
|
||||
*/
|
||||
public function footer() {
|
||||
global $CFG, $DB;
|
||||
global $CFG, $DB, $PERF;
|
||||
|
||||
$output = '';
|
||||
|
||||
@@ -1519,6 +1519,7 @@ class core_renderer extends renderer_base {
|
||||
if (NO_OUTPUT_BUFFERING) {
|
||||
// If the output buffer was off then we render a placeholder and stream the
|
||||
// performance debugging into it at the very end in the shutdown handler.
|
||||
$PERF->perfdebugdeferred = true;
|
||||
$performanceinfo .= html_writer::tag('div',
|
||||
get_string('perfdebugdeferred', 'admin'),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user