summaryrefslogtreecommitdiff
path: root/maintenance/Maintenance.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /maintenance/Maintenance.php
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'maintenance/Maintenance.php')
-rw-r--r--maintenance/Maintenance.php25
1 files changed, 18 insertions, 7 deletions
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index 5dafdfc0..04aa3a5e 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -36,6 +36,8 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless
$maintClass = false;
+use MediaWiki\Logger\LoggerFactory;
+
/**
* Abstract maintenance class for quickly writing and churning out
* maintenance scripts with minimal effort. All that _must_ be defined
@@ -599,17 +601,27 @@ abstract class Maintenance {
* Activate the profiler (assuming $wgProfiler is set)
*/
protected function activateProfiler() {
- global $wgProfiler;
+ global $wgProfiler, $wgProfileLimit, $wgTrxProfilerLimits;
$output = $this->getOption( 'profiler' );
- if ( $output && is_array( $wgProfiler ) && isset( $wgProfiler['class'] ) ) {
+ if ( !$output ) {
+ return;
+ }
+
+ 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 );
}
+
+ $trxProfiler = Profiler::instance()->getTransactionProfiler();
+ $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) );
+ $trxProfiler->setExpectations( $wgTrxProfilerLimits['Maintenance'], __METHOD__ );
}
/**
@@ -945,10 +957,9 @@ abstract class Maintenance {
$wgShowSQLErrors = true;
- // @codingStandardsIgnoreStart Allow error suppression. wfSuppressWarnings()
- // is not available.
- @set_time_limit( 0 );
- // @codingStandardsIgnoreStart
+ MediaWiki\suppressWarnings();
+ set_time_limit( 0 );
+ MediaWiki\restoreWarnings();
$this->adjustMemoryLimit();
}