X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fprofiler%2FProfiler.php;h=252a227a1d3fa93153d0144d59560fa61fce3adc;hb=8624538de243da3779db5eb3362bedf78d2e2931;hp=8b4f01a3064fd76130feca52aed8fff0185bb1ce;hpb=b2cec6c5928e8e1b417c0855ce8e5560e2e089e1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 8b4f01a306..d02011fa34 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -22,6 +22,7 @@ * @defgroup Profiler Profiler */ use Wikimedia\ScopedCallback; +use Wikimedia\Rdbms\TransactionProfiler; /** * Profiler base class that defines the interface and some trivial @@ -63,7 +64,7 @@ abstract class Profiler { global $wgProfiler, $wgProfileLimit; $params = [ - 'class' => 'ProfilerStub', + 'class' => ProfilerStub::class, 'sampling' => 1, 'threshold' => $wgProfileLimit, 'output' => [], @@ -73,8 +74,9 @@ abstract class Profiler { } $inSample = mt_rand( 0, $params['sampling'] - 1 ) === 0; - if ( PHP_SAPI === 'cli' || !$inSample ) { - $params['class'] = 'ProfilerStub'; + // wfIsCLI() is not available yet + if ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' || !$inSample ) { + $params['class'] = ProfilerStub::class; } if ( !is_array( $params['output'] ) ) { @@ -163,7 +165,7 @@ abstract class Profiler { abstract public function scopedProfileIn( $section ); /** - * @param SectionProfileCallback $section + * @param SectionProfileCallback &$section */ public function scopedProfileOut( SectionProfileCallback &$section = null ) { $section = null; @@ -186,7 +188,7 @@ abstract class Profiler { * Get all usable outputs. * * @throws MWException - * @return array Array of ProfilerOutput instances. + * @return ProfilerOutput[] * @since 1.25 */ private function getOutputs() {