X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcleanupSpam.php;h=2f3f01347ca30b085f7fca7a28a64782efa3676d;hb=b5906606e1aa1a795231fb813b766818b1dd6c25;hp=b43ce814d673049c64a4304e03fc5c6d539bc350;hpb=53be5c92adab85c799754775e6b68c30fed6bf9c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php index b43ce814d6..2f3f01347c 100644 --- a/maintenance/cleanupSpam.php +++ b/maintenance/cleanupSpam.php @@ -32,7 +32,7 @@ class CleanupSpam extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Cleanup all spam from a given hostname"; + $this->addDescription( '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( @@ -64,14 +64,14 @@ class CleanupSpam extends Maintenance { $this->output( "Finding spam on " . count( $wgLocalDatabases ) . " wikis\n" ); $found = false; foreach ( $wgLocalDatabases as $wikiID ) { - $dbr = $this->getDB( DB_SLAVE, array(), $wikiID ); + $dbr = $this->getDB( DB_SLAVE, [], $wikiID ); $count = $dbr->selectField( 'externallinks', 'COUNT(*)', - array( 'el_index' . $dbr->buildLike( $like ) ), __METHOD__ ); + [ 'el_index' . $dbr->buildLike( $like ) ], __METHOD__ ); if ( $count ) { $found = true; $cmd = wfShellWikiCmd( "$IP/maintenance/cleanupSpam.php", - array( '--wiki', $wikiID, $spec ) ); + [ '--wiki', $wikiID, $spec ] ); passthru( "$cmd | sed 's/^/$wikiID: /'" ); } } @@ -84,8 +84,8 @@ class CleanupSpam extends Maintenance { // Clean up spam on this wiki $dbr = $this->getDB( DB_SLAVE ); - $res = $dbr->select( 'externallinks', array( 'DISTINCT el_from' ), - array( 'el_index' . $dbr->buildLike( $like ) ), __METHOD__ ); + $res = $dbr->select( 'externallinks', [ 'DISTINCT el_from' ], + [ 'el_index' . $dbr->buildLike( $like ) ], __METHOD__ ); $count = $dbr->numRows( $res ); $this->output( "Found $count articles containing $spec\n" ); foreach ( $res as $row ) {