Skip to content

Commit

Permalink
MDL-74010 core: check defined MDL_PERF* values in conditionals.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Aug 5, 2022
1 parent 35b993b commit a65476d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions config-dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@
// Print to footer (works with the default theme)
// define('MDL_PERFTOFOOT', true);
//
// Print additional data to log of included files
// define('MDL_PERFINC', true);
//
// Enable earlier profiling that causes more code to be covered
// on every request (db connections, config load, other inits...).
// Requires extra configuration to be defined in config.php like:
Expand Down
6 changes: 3 additions & 3 deletions lib/classes/shutdown_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ protected static function request_shutdown() {
}

// Deal with perf logging.
if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {
if ((defined('MDL_PERF') && MDL_PERF) || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) {
if ($apachereleasemem) {
error_log('Mem usage over '.$apachereleasemem.': marking Apache child for reaping.');
}
if (defined('MDL_PERFTOLOG')) {
if (defined('MDL_PERFTOLOG') && MDL_PERFTOLOG) {
$perf = get_performance_info();
error_log("PERF: " . $perf['txt']);
}
if (defined('MDL_PERFINC')) {
if (defined('MDL_PERFINC') && MDL_PERFINC) {
$inc = get_included_files();
$ts = 0;
foreach ($inc as $f) {
Expand Down
4 changes: 2 additions & 2 deletions lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -1504,9 +1504,9 @@ public function footer() {

// Provide some performance info if required
$performanceinfo = '';
if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) {
if ((defined('MDL_PERF') && MDL_PERF) || (!empty($CFG->perfdebug) && $CFG->perfdebug > 7)) {
$perf = get_performance_info();
if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug > 7) {
if ((defined('MDL_PERFTOFOOT') && MDL_PERFTOFOOT) || debugging() || $CFG->perfdebug > 7) {
$performanceinfo = $perf['html'];
}
}
Expand Down

0 comments on commit a65476d

Please sign in to comment.