From 929b280b999db52a7abfa44d6e142aa8c86aa976 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 8 May 2015 18:59:42 -0700 Subject: [PATCH] Unbreak --profile=text for CLI scrips * Fixes "Undefined index: threshold" and "Invalid argument supplied for foreach()" errors so that output actually can show Change-Id: Ibf8090f265d988c58d1752319336a5146a28f4d0 --- maintenance/Maintenance.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 3f804a0260..c97c6a35f4 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -603,7 +603,7 @@ abstract class Maintenance { * Activate the profiler (assuming $wgProfiler is set) */ protected function activateProfiler() { - global $wgProfiler, $wgTrxProfilerLimits; + global $wgProfiler, $wgProfileLimit, $wgTrxProfilerLimits; $output = $this->getOption( 'profiler' ); if ( !$output ) { @@ -613,7 +613,9 @@ abstract class Maintenance { if ( is_array( $wgProfiler ) && isset( $wgProfiler['class'] ) ) { $class = $wgProfiler['class']; $profiler = new $class( - array( 'sampling' => 1, 'output' => $output ) + $wgProfiler + array( 'sampling' => 1, 'output' => array( $output ) ) + + $wgProfiler + + array( 'threshold' => $wgProfileLimit ) ); $profiler->setTemplated( true ); Profiler::replaceStubInstance( $profiler ); -- 2.20.1