QA: Upgrade mediawiki_selenium for fix to Raita logging
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index 50b8a01..e4ac467 100644 (file)
  * @defgroup Maintenance Maintenance
  */
 
-// Make sure we're on PHP5.3.3 or better
-if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.3' ) < 0 ) {
-       // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+
-       require_once dirname( __FILE__ ) . '/../includes/PHPVersionError.php';
-       wfPHPVersionError( 'cli' );
-}
+// Bail on old versions of PHP, or if composer has not been run yet to install
+// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
+require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
+wfEntryPointCheck( 'cli' );
 
 /**
  * @defgroup MaintenanceArchive Maintenance archives
@@ -603,13 +601,19 @@ 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 && 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 );