User:AnomieBOT/source/tasks/CategoryCleaner.pm: Difference between revisions

Content deleted Content added
AnomieBOT (talk | contribs)
Updating published sources: PageMover: * Approved! CategoryCleaner: * Approved! AltLinkTemplateSubster: * Approved!
AnomieBOT (talk | contribs)
Updating published sources: General: * Update for the addition of 'rvslots'. DatedCategoryDeleterTest: * Disable. It's clear that task won't be needed. BrokenRedirectDeleter: * Handle pages with newlines before the <code>#REDIRECT</code>.
 
(5 intermediate revisions by the same user not shown)
Line 1:
{{ombox|type=notice|text= Approved 2009-12-13<br />[[Wikipedia:Bots/Requests for approval/AnomieBOT 36]]}}
<sourcesyntaxhighlight lang="perl">
package tasks::CategoryCleaner;
 
Line 7:
=begin metadata
 
Bot: AnomieBOT
Task: CategoryCleaner
BRFA: Wikipedia:Bots/Requests for approval/AnomieBOT 36
Status: Approved 2009-12-13
Rate: Max 6 edits/minute
Created: 2009-11-09
 
Remove pages from categories where the page does not meet the page inclusion
criteria. For example, [[:Category:RedirectsWikipedia redirects]] is explicitly stated that it
that it shouldn't contain any actual redirects.
 
=end metadata
Line 33:
iter => {
generator => 'categorymembers',
gcmtitle => 'Category:RedirectsWikipedia redirects',
gcmlimit => 'max100',
prop => 'info',
},
Line 46:
my $api=shift;
my $tok=shift;
my $txt=$tok->{'revisions'}[0]{'slots'}{'main'}{'*'};
$txt=~s/\[\[\s*(?i:Category)\s*:\s*[rRwW]edirectsikipedia redirects\s*(?:\|.*?)?\]\]\s*//;
return ($txt,"Removing [[Category:RedirectsWikipedia redirects]] as that category is not intended for actual redirects");
},
},
Line 111:
 
my ($txt,$log)=$def->{'edit'}($api,$tok);
next if(!defined($txt) || $txt eq $tok->{'revisions'}[0]{'slots'}{'main'}{'*'});
 
$api->log("Editing $title: $log");
Line 133:
1;
 
</syntaxhighlight>
</source>