X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=maintenance%2FcleanupSpam.php;h=17d2e188d2499397d286df52c64063883389e767;hb=b972c452b50dc863a8a9aa622cdd8ff9b5651e61;hp=24ca86d60f2c6e68c92314462f76e0678508d638;hpb=dc6d8d2c3e4822ec9a4387255218e63a60aea6fe;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php index 24ca86d60f..17d2e188d2 100644 --- a/maintenance/cleanupSpam.php +++ b/maintenance/cleanupSpam.php @@ -54,13 +54,13 @@ class CleanupSpam extends Maintenance { $spec = $this->getArg(); - $likes = []; + $protConds = []; foreach ( [ 'http://', 'https://' ] as $prot ) { - $like = LinkFilter::makeLikeArray( $spec, $prot ); - if ( !$like ) { + $conds = LinkFilter::getQueryConditions( $spec, [ 'protocol' => $prot ] ); + if ( !$conds ) { $this->fatalError( "Not a valid hostname specification: $spec" ); } - $likes[$prot] = $like; + $protConds[$prot] = $conds; } if ( $this->hasOption( 'all' ) ) { @@ -71,11 +71,11 @@ class CleanupSpam extends Maintenance { /** @var $dbr Database */ $dbr = $this->getDB( DB_REPLICA, [], $wikiID ); - foreach ( $likes as $like ) { + foreach ( $protConds as $conds ) { $count = $dbr->selectField( 'externallinks', 'COUNT(*)', - [ 'el_index' . $dbr->buildLike( $like ) ], + $conds, __METHOD__ ); if ( $count ) { @@ -99,11 +99,11 @@ class CleanupSpam extends Maintenance { $count = 0; /** @var $dbr Database */ $dbr = $this->getDB( DB_REPLICA ); - foreach ( $likes as $prot => $like ) { + foreach ( $protConds as $prot => $conds ) { $res = $dbr->select( 'externallinks', [ 'DISTINCT el_from' ], - [ 'el_index' . $dbr->buildLike( $like ) ], + $conds, __METHOD__ ); $count = $dbr->numRows( $res );