Content deleted Content added
Updating published sources: SourceUploader: * Force wikitext content model. * Use {{tag|syntaxhighlight}} for css (and a few other types not in use yet). |
Updating published sources: SourceUploader: * Improve list handling for doc pages. * Add a TemplateStyles stylesheet to doc pages. * Cleanup some manpage refs. |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 65:
my $class=shift;
my $self=$class->SUPER::new();
$self->{'loadexisting'}=1;
$self->{'order'}=-1000;
$self->{'fail'}=0;
return $self;▼
}
sub build_sources {
my $self = shift;
my $basedir=$AnomieBOT::API::basedir;
Line 75 ⟶ 79:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot find source directory\n");
return
}
Line 82 ⟶ 86:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot load changelog: $!\n");
return
}
local $_;
Line 114 ⟶ 118:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot open directory $dir: $!\n");
return
}
Line 134 ⟶ 138:
$self->{'fail'}=1;
AnomieBOT::API->warn("Cannot open file $p: $!\n");
return
}
do {
Line 159 ⟶ 163:
$parser->output_string(\$x);
$parser->parse_string_document($pages{$pp});
$pages{"$pp/doc"}="<templatestyles src=\"User:$mainbot/source-docs.css\"/>\n$x" if($parser->content_seen);
# Handle embedded notices and metadata
Line 284 ⟶ 288:
$self->{'pages'}={%pages};
$self->{'tasklists'}=\%tasklists;
▲ return $self;
}
Line 290 ⟶ 293:
my ($self, $api)=@_;
return undef if $self->{'fail'};
$self->build_sources() unless defined( $self->{'pages'} );
return undef if $self->{'fail'};
Line 308 ⟶ 314:
my $iter=$api->iterator(
list => 'allpages',
apprefix => $api->user.'/source/',
apnamespace => '2',
aplimit => 'max'
Line 406 ⟶ 412:
$res=$res->{'content'}//'';
$res=~s/\s*$//;
my $txt="{{#ifeq:{{PAGESIZE:{{FULLPAGENAME}}}}|0|\n{{ombox\n| type = delete\n| image = [[File:Shutdown button.svg|40px|link={{fullurl:Special:Block|wpTarget=".uri_escape($bot)."&wpExpiry=indefinite&wpHardBlock=1&wpAutoBlock=0&wpCreateAccount=0&wpReason=other&wpReason-other=Bot%20malfunctioning:%20}}|Emergency block button]]\n| text = To disable the task {{SUBPAGENAME}}, enter your reasoning in this page. If the task is currently running, the bot may make one more edit before noticing that it has been shut off, but rest assured it ''will'' notice.\n}}\n|{{ombox\n| text = To re-enable the task, blank the page.\n}}\n}}";
unless($res=~/(?:^|\n)\Q$txt\E(?:$|\n)/){
$api->whine("Please fix [[Template:Editnotices/Group/User:$bot/shutoff]]", "To display the proper editnotice on shutoff pages for the AnomieBOT bot [[User:$bot]], please ensure that [[Template:Editnotices/Group/User:$bot/shutoff]] contains the following text:\n<pre>$txt</pre>\nThanks.");
|