Pass phpcs-strict on maintenance/ (7/8)
authorSiebrand Mazeland <siebrand@kitano.nl>
Wed, 23 Apr 2014 09:40:50 +0000 (11:40 +0200)
committerSiebrand Mazeland <siebrand@kitano.nl>
Wed, 23 Apr 2014 10:16:10 +0000 (12:16 +0200)
Change-Id: Ibb03a775055c687a4c5bc6864172e043d3a7e3d8

maintenance/cdb.php
maintenance/checkImages.php
maintenance/checkLess.php
maintenance/checkSyntax.php
maintenance/cleanupAncientTables.php
maintenance/cleanupImages.php
maintenance/cleanupRemovedModules.php
maintenance/cleanupSpam.php
maintenance/cleanupWatchlist.php
maintenance/commandLine.inc

index 4590611..86c686b 100644 (file)
@@ -77,7 +77,8 @@ do {
                        print "Loading cdb file $file...";
                        try {
                                $fileHandle = CdbReader::open( $file );
-                       } catch ( CdbException $e ) {}
+                       } catch ( CdbException $e ) {
+                       }
 
                        if ( !$fileHandle ) {
                                print "not a cdb file or unable to read it\n";
index e6aea53..e914645 100644 (file)
@@ -73,7 +73,8 @@ class CheckImages extends Maintenance {
                                }
 
                                if ( $stat['size'] != $row->img_size ) {
-                                       $this->output( "{$row->img_name}: size mismatch DB={$row->img_size}, actual={$stat['size']}\n" );
+                                       $this->output( "{$row->img_name}: size mismatch DB={$row->img_size}, "
+                                               . "actual={$stat['size']}\n" );
                                        continue;
                                }
 
index f81285f..b97e1b0 100644 (file)
@@ -31,7 +31,8 @@ class CheckLess extends Maintenance {
 
        public function __construct() {
                parent::__construct();
-               $this->mDescription = 'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite';
+               $this->mDescription =
+                       'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite';
        }
 
        public function execute() {
index ef88545..e01767e 100644 (file)
@@ -38,10 +38,23 @@ class CheckSyntax extends Maintenance {
                parent::__construct();
                $this->mDescription = "Check syntax for all PHP files in MediaWiki";
                $this->addOption( 'with-extensions', 'Also recurse the extensions folder' );
-               $this->addOption( 'path', 'Specific path (file or directory) to check, either with absolute path or relative to the root of this MediaWiki installation',
-                       false, true );
-               $this->addOption( 'list-file', 'Text file containing list of files or directories to check', false, true );
-               $this->addOption( 'modified', 'Check only files that were modified (requires Git command-line client)' );
+               $this->addOption(
+                       'path',
+                       'Specific path (file or directory) to check, either with absolute path or '
+                               . 'relative to the root of this MediaWiki installation',
+                       false,
+                       true
+               );
+               $this->addOption(
+                       'list-file',
+                       'Text file containing list of files or directories to check',
+                       false,
+                       true
+               );
+               $this->addOption(
+                       'modified',
+                       'Check only files that were modified (requires Git command-line client)'
+               );
                $this->addOption( 'syntax-only', 'Check for syntax validity only, skip code style warnings' );
        }
 
@@ -53,7 +66,8 @@ class CheckSyntax extends Maintenance {
                $this->buildFileList();
 
                // ParseKit is broken on PHP 5.3+, disabled until this is fixed
-               $useParseKit = function_exists( 'parsekit_compile_file' ) && version_compare( PHP_VERSION, '5.3', '<' );
+               $useParseKit = function_exists( 'parsekit_compile_file' )
+                       && version_compare( PHP_VERSION, '5.3', '<' );
 
                $str = 'Checking syntax (using ' . ( $useParseKit ?
                        'parsekit' : ' php -l, this can take a long time' ) . ")\n";
index 694efaa..428484b 100644 (file)
@@ -40,8 +40,9 @@ class CleanupAncientTables extends Maintenance {
        public function execute() {
                if ( !$this->hasOption( 'force' ) ) {
                        $this->error( "This maintenance script will remove old columns and indexes.\n"
-                               . "It is recommended to backup your database first, and ensure all your data has been migrated to newer tables\n"
-                               . "If you want to continue, run this script again with the --force \n"
+                               . "It is recommended to backup your database first, and ensure all your data has\n"
+                               . "been migrated to newer tables. If you want to continue, run this script again\n"
+                               . "with --force.\n"
                        );
                }
 
index 01ed9ca..1b46ab8 100644 (file)
@@ -122,7 +122,12 @@ class ImageCleanup extends TableCleanup {
        }
 
        private function pageExists( $name, $db ) {
-               return $db->selectField( 'page', '1', array( 'page_namespace' => NS_FILE, 'page_title' => $name ), __METHOD__ );
+               return $db->selectField(
+                       'page',
+                       '1',
+                       array( 'page_namespace' => NS_FILE, 'page_title' => $name ),
+                       __METHOD__
+               );
        }
 
        private function pokeFile( $orig, $new ) {
index 84eec28..cc8b024 100644 (file)
@@ -36,7 +36,13 @@ class CleanupRemovedModules extends Maintenance {
                parent::__construct();
                $this->mDescription = 'Remove cache entries for removed ResourceLoader modules from the database';
                $this->addOption( 'batchsize', 'Delete rows in batches of this size. Default: 500', false, true );
-               $this->addOption( 'max-slave-lag', 'If the slave lag exceeds this many seconds, wait until it drops below this value. Default: 5', false, true );
+               $this->addOption(
+                       'max-slave-lag',
+                       'If the slave lag exceeds this many seconds, wait until it drops below this value. '
+                               . 'Default: 5',
+                       false,
+                       true
+               );
        }
 
        public function execute() {
index 12b1241..8551f8f 100644 (file)
@@ -35,7 +35,10 @@ class CleanupSpam extends Maintenance {
                $this->mDescription = "Cleanup all spam from a given hostname";
                $this->addOption( 'all', 'Check all wikis in $wgLocalDatabases' );
                $this->addOption( 'delete', 'Delete pages containing only spam instead of blanking them' );
-               $this->addArg( 'hostname', 'Hostname that was spamming, single * wildcard in the beginning allowed' );
+               $this->addArg(
+                       'hostname',
+                       'Hostname that was spamming, single * wildcard in the beginning allowed'
+               );
        }
 
        public function execute() {
@@ -123,19 +126,28 @@ class CleanupSpam extends Maintenance {
                                $content = $rev->getContent( Revision::RAW );
 
                                $this->output( "reverting\n" );
-                               $page->doEditContent( $content, wfMessage( 'spam_reverting', $domain )->inContentLanguage()->text(),
-                                       EDIT_UPDATE, $rev->getId() );
+                               $page->doEditContent(
+                                       $content,
+                                       wfMessage( 'spam_reverting', $domain )->inContentLanguage()->text(),
+                                       EDIT_UPDATE,
+                                       $rev->getId()
+                               );
                        } elseif ( $this->hasOption( 'delete' ) ) {
                                // Didn't find a non-spammy revision, blank the page
                                $this->output( "deleting\n" );
-                               $page->doDeleteArticle( wfMessage( 'spam_deleting', $domain )->inContentLanguage()->text() );
+                               $page->doDeleteArticle(
+                                       wfMessage( 'spam_deleting', $domain )->inContentLanguage()->text()
+                               );
                        } else {
                                // Didn't find a non-spammy revision, blank the page
                                $handler = ContentHandler::getForTitle( $title );
                                $content = $handler->makeEmptyContent();
 
                                $this->output( "blanking\n" );
-                               $page->doEditContent( $content, wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text() );
+                               $page->doEditContent(
+                                       $content,
+                                       wfMessage( 'spam_blanking', $domain )->inContentLanguage()->text()
+                               );
                        }
                        $dbw->commit( __METHOD__ );
                }
index 94e90db..22fd05f 100644 (file)
@@ -65,7 +65,8 @@ class WatchlistCleanup extends TableCleanup {
                $title = Title::newFromText( $verified );
 
                if ( $row->wl_user == 0 || is_null( $title ) || !$title->equals( $current ) ) {
-                       $this->output( "invalid watch by {$row->wl_user} for ({$row->wl_namespace}, \"{$row->wl_title}\")\n" );
+                       $this->output( "invalid watch by {$row->wl_user} for "
+                               . "({$row->wl_namespace}, \"{$row->wl_title}\")\n" );
                        $updated = $this->removeWatch( $row );
                        $this->progress( $updated );
                        return;
index be07142..0d3e643 100644 (file)
 
 require_once __DIR__ . '/Maintenance.php';
 
+// @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
 global $optionsWithArgs;
+// @codingStandardsIgnoreEnd
 if ( !isset( $optionsWithArgs ) ) {
        $optionsWithArgs = array();
 }
 
 class CommandLineInc extends Maintenance {
        public function __construct() {
+               // @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $optionsWithArgs;
+               // @codingStandardsIgnoreEnd
                parent::__construct();
                foreach ( $optionsWithArgs as $name ) {
                        $this->addOption( $name, '', false, true );
@@ -48,7 +52,9 @@ class CommandLineInc extends Maintenance {
        }
 
        public function execute() {
+               // @codingStandardsIgnoreStart MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $args, $options;
+               // @codingStandardsIgnoreEnd
                $args = $this->mArgs;
                $options = $this->mOptions;
        }