24require_once __DIR__ .
'/Maintenance.php';
34 parent::__construct();
36 $this->
addOption(
'all',
'Check all wikis in $wgLocalDatabases' );
37 $this->
addOption(
'delete',
'Delete pages containing only spam instead of blanking them' );
40 'Hostname that was spamming, single * wildcard in the beginning allowed'
50 $this->
fatalError(
"Invalid username specified in 'spambot_username' message: $username" );
53 $wgUser->addGroup(
'bot' );
55 $spec = $this->
getArg( 0 );
58 foreach ( [
'http://',
'https://' ] as $prot ) {
61 $this->
fatalError(
"Not a valid hostname specification: $spec" );
63 $protConds[
$prot] = $conds;
74 foreach ( $protConds as $conds ) {
75 $count =
$dbr->selectField(
84 "$IP/maintenance/cleanupSpam.php",
85 [
'--wiki', $wikiID, $spec ]
87 passthru(
"$cmd | sed 's/^/$wikiID: /'" );
92 $this->
output(
"All done\n" );
94 $this->
output(
"None found\n" );
102 foreach ( $protConds as $prot => $conds ) {
105 [
'DISTINCT el_from' ],
110 $this->
output(
"Found $count articles containing $spec\n" );
111 foreach (
$res as $row ) {
116 $this->
output(
"Done\n" );
128 $title = Title::newFromID( $id );
130 $this->
error(
"Internal error: no page for ID $id" );
135 $this->
output( $title->getPrefixedDBkey() .
" ..." );
137 $currentRevId =
$rev->getId();
145 if (
$rev &&
$rev->getId() == $currentRevId ) {
148 $this->
output(
"False match\n" );
152 $page = WikiPage::factory( $title );
157 $this->
output(
"reverting\n" );
158 $page->doEditContent(
160 wfMessage(
'spam_reverting', $domain )->inContentLanguage()->
text(),
166 $this->
output(
"deleting\n" );
167 $page->doDeleteArticle(
168 wfMessage(
'spam_deleting', $domain )->inContentLanguage()->
text()
172 $handler = ContentHandler::getForTitle( $title );
175 $this->
output(
"blanking\n" );
176 $page->doEditContent(
178 wfMessage(
'spam_blanking', $domain )->inContentLanguage()->
text(),
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
string[] $wgLocalDatabases
Other wikis on this site, can be administered from a single developer account.
wfShellWikiCmd( $script, array $parameters=[], array $options=[])
Generate a shell-escaped command line string to run a MediaWiki cli script.
Maintenance script to cleanup all spam from a given hostname.
cleanupArticle( $id, $domain, $protocol)
__construct()
Default constructor.
execute()
Do the actual work.
static getQueryConditions( $filterEntry, array $options=[])
Return query conditions which will match the specified string.
static matchEntry(Content $content, $filterEntry, $protocol='http://')
Check whether $content contains a link to $filterEntry.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true)
Add some args that are needed.
beginTransaction(IDatabase $dbw, $fname)
Begin a transcation on a DB.
commitTransaction(IDatabase $dbw, $fname)
Commit the transcation on a DB handle and wait for replica DBs to catch up.
output( $out, $channel=null)
Throw some output to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular option exists.
getArg( $argId=0, $default=null)
Get an argument.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
static newSystemUser( $name, $options=[])
Static factory method for creation of a "system" user from username.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
this hook is for auditing only or null if authentication failed before getting that far $username
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
require_once RUN_MAINTENANCE_IF_MAIN