Move up devunt's name to Developers
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index a0ffcb2..c97c6a3 100644 (file)
@@ -38,6 +38,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
@@ -601,17 +603,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__ );
        }
 
        /**
@@ -1099,7 +1111,7 @@ abstract class Maintenance {
         */
        private function lockSearchindex( $db ) {
                $write = array( 'searchindex' );
-               $read = array( 'page', 'revision', 'text', 'interwiki', 'l10n_cache', 'user' );
+               $read = array( 'page', 'revision', 'text', 'interwiki', 'l10n_cache', 'user', 'page_restrictions' );
                $db->lockTables( $read, $write, __CLASS__ . '::' . __METHOD__ );
        }