From: Alexandre Emsenhuber Date: Sun, 25 Dec 2011 16:36:13 +0000 (+0000) Subject: And while I'm a it: X-Git-Tag: 1.31.0-rc.0~25759 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=a36729e97aef01755508aab9169948a8144d3037;p=lhc%2Fweb%2Fwiklou.git And while I'm a it: * Use the commented-out code ("MW 1.6" is way old and "Revision.php 1.26" sounds like CVS) * Don't revert to a revision whose text was deleted --- diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php index 9b8e435f9d..ca1e302bc3 100644 --- a/maintenance/cleanupSpam.php +++ b/maintenance/cleanupSpam.php @@ -94,20 +94,13 @@ class CleanupSpam extends Maintenance { $this->output( $title->getPrefixedDBkey() . " ..." ); $rev = Revision::newFromTitle( $title ); - $revId = $rev->getId(); - $currentRevId = $revId; + $currentRevId = $rev->getId(); - while ( $rev && LinkFilter::matchEntry( $rev->getText() , $domain ) ) { - # Revision::getPrevious can't be used in this way before MW 1.6 (Revision.php 1.26) - # $rev = $rev->getPrevious(); - $revId = $title->getPreviousRevisionID( $revId ); - if ( $revId ) { - $rev = Revision::newFromTitle( $title, $revId ); - } else { - $rev = false; - } + while ( $rev && ( $rev->isDeleted( Revision::DELETED_TEXT ) || LinkFilter::matchEntry( $rev->getText() , $domain ) ) ) { + $rev = $rev->getPrevious(); } - if ( $revId == $currentRevId ) { + + if ( $rev && $rev->getId() == $currentRevId ) { // The regex didn't match the current article text // This happens e.g. when a link comes from a template rather than the page itself $this->output( "False match\n" );