Permalink
Browse files

modify regex to avoid blanking entire page (also add a failsafe)

  • Loading branch information...
Ted Timmons
Ted Timmons committed Jun 1, 2010
1 parent eafe3e0 commit 0c7c791d04d96648542bba125e7d2afe5f8e035f
Showing with 9 additions and 1 deletion.
  1. +9 −1 bin/current.pl
View
@@ -201,7 +201,15 @@ sub checkRemoval {
sub removeCurrentTemplate {
my ($title, $content) = @_;
$content =~ s#{{current.*?}}##i;
my $oldlength = length $content;
$content =~ s#\{\{current([^{}]*?)\}\}##i;
my $newlength = length $content;
if (($oldlength - $newlength) > 100) {
_debug("eep! tried removing the current template and we must have done much more. We're scared, so we'll bail.\n");
return -100;
}
$tb->replacePage($title, $content, "[[User:TedderBot/CurrentPruneBot|remove stale current-event template]], please see [[WP:CET]]. (bot edit)");
_debug(":updated [[$title]]\n");
#print "updating $title\n";

0 comments on commit 0c7c791

Please sign in to comment.