Pass phpcs-strict on maintenance/ (7/8)
Change-Id: Ibb03a775055c687a4c5bc6864172e043d3a7e3d8
This commit is contained in:
parent
075bb89246
commit
ebbf031774
10 changed files with 66 additions and 18 deletions
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ) {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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__ );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -23,14 +23,18 @@
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue