Merge "Pass real boolean or array params to mw.Api#get and #post when convenient"
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index c97c6a3..8dad5dc 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
@@ -462,7 +460,7 @@ abstract class Maintenance {
                }
 
                # Save additional script dependant options to display
-               # them separately in help
+               #  them separately in help
                $this->mDependantParameters = array_diff_key( $this->mParams, $this->mGenericParameters );
        }
 
@@ -959,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();
        }
@@ -1111,7 +1108,15 @@ abstract class Maintenance {
         */
        private function lockSearchindex( $db ) {
                $write = array( 'searchindex' );
-               $read = array( 'page', 'revision', 'text', 'interwiki', 'l10n_cache', 'user', 'page_restrictions' );
+               $read = array(
+                       'page',
+                       'revision',
+                       'text',
+                       'interwiki',
+                       'l10n_cache',
+                       'user',
+                       'page_restrictions'
+               );
                $db->lockTables( $read, $write, __CLASS__ . '::' . __METHOD__ );
        }