dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
maintenance: Deprecate Maintenance::hasArg/getArg with no param
[lhc/web/wiklou.git]
/
maintenance
/
cleanupSpam.php
diff --git
a/maintenance/cleanupSpam.php
b/maintenance/cleanupSpam.php
index
24ca86d
..
04f278f
100644
(file)
--- a/
maintenance/cleanupSpam.php
+++ b/
maintenance/cleanupSpam.php
@@
-52,15
+52,15
@@
class CleanupSpam extends Maintenance {
// Hack: Grant bot rights so we don't flood RecentChanges
$wgUser->addGroup( 'bot' );
// Hack: Grant bot rights so we don't flood RecentChanges
$wgUser->addGroup( 'bot' );
- $spec = $this->getArg();
+ $spec = $this->getArg(
0
);
- $
like
s = [];
+ $
protCond
s = [];
foreach ( [ 'http://', 'https://' ] as $prot ) {
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" );
}
$this->fatalError( "Not a valid hostname specification: $spec" );
}
- $
likes[$prot] = $like
;
+ $
protConds[$prot] = $conds
;
}
if ( $this->hasOption( 'all' ) ) {
}
if ( $this->hasOption( 'all' ) ) {
@@
-71,11
+71,11
@@
class CleanupSpam extends Maintenance {
/** @var $dbr Database */
$dbr = $this->getDB( DB_REPLICA, [], $wikiID );
/** @var $dbr Database */
$dbr = $this->getDB( DB_REPLICA, [], $wikiID );
- foreach ( $
likes as $like
) {
+ foreach ( $
protConds as $conds
) {
$count = $dbr->selectField(
'externallinks',
'COUNT(*)',
$count = $dbr->selectField(
'externallinks',
'COUNT(*)',
-
[ 'el_index' . $dbr->buildLike( $like ) ]
,
+
$conds
,
__METHOD__
);
if ( $count ) {
__METHOD__
);
if ( $count ) {
@@
-99,11
+99,11
@@
class CleanupSpam extends Maintenance {
$count = 0;
/** @var $dbr Database */
$dbr = $this->getDB( DB_REPLICA );
$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' ],
$res = $dbr->select(
'externallinks',
[ 'DISTINCT el_from' ],
-
[ 'el_index' . $dbr->buildLike( $like ) ]
,
+
$conds
,
__METHOD__
);
$count = $dbr->numRows( $res );
__METHOD__
);
$count = $dbr->numRows( $res );