Merge "Exclude redirects from Special:Fewestrevisions"
[lhc/web/wiklou.git] / maintenance / cleanupSpam.php
index 17d2e18..13f3cfa 100644 (file)
@@ -21,6 +21,8 @@
  * @ingroup Maintenance
  */
 
+use MediaWiki\Storage\RevisionRecord;
+
 require_once __DIR__ . '/Maintenance.php';
 
 /**
@@ -52,7 +54,7 @@ class CleanupSpam extends Maintenance {
                // Hack: Grant bot rights so we don't flood RecentChanges
                $wgUser->addGroup( 'bot' );
 
-               $spec = $this->getArg();
+               $spec = $this->getArg( 0 );
 
                $protConds = [];
                foreach ( [ 'http://', 'https://' ] as $prot ) {
@@ -68,7 +70,7 @@ class CleanupSpam extends Maintenance {
                        $this->output( "Finding spam on " . count( $wgLocalDatabases ) . " wikis\n" );
                        $found = false;
                        foreach ( $wgLocalDatabases as $wikiID ) {
-                               /** @var $dbr Database */
+                               /** @var Database $dbr */
                                $dbr = $this->getDB( DB_REPLICA, [], $wikiID );
 
                                foreach ( $protConds as $conds ) {
@@ -97,7 +99,7 @@ class CleanupSpam extends Maintenance {
                        // Clean up spam on this wiki
 
                        $count = 0;
-                       /** @var $dbr Database */
+                       /** @var Database $dbr */
                        $dbr = $this->getDB( DB_REPLICA );
                        foreach ( $protConds as $prot => $conds ) {
                                $res = $dbr->select(
@@ -136,8 +138,8 @@ class CleanupSpam extends Maintenance {
                $rev = Revision::newFromTitle( $title );
                $currentRevId = $rev->getId();
 
-               while ( $rev && ( $rev->isDeleted( Revision::DELETED_TEXT )
-                       || LinkFilter::matchEntry( $rev->getContent( Revision::RAW ), $domain, $protocol ) )
+               while ( $rev && ( $rev->isDeleted( RevisionRecord::DELETED_TEXT )
+                       || LinkFilter::matchEntry( $rev->getContent( RevisionRecord::RAW ), $domain, $protocol ) )
                ) {
                        $rev = $rev->getPrevious();
                }
@@ -152,7 +154,7 @@ class CleanupSpam extends Maintenance {
                        $page = WikiPage::factory( $title );
                        if ( $rev ) {
                                // Revert to this revision
-                               $content = $rev->getContent( Revision::RAW );
+                               $content = $rev->getContent( RevisionRecord::RAW );
 
                                $this->output( "reverting\n" );
                                $page->doEditContent(