[PerlWikiBot] SF.net SVN: perlwikibot: [26] trunk
Status: Pre-Alpha
Brought to you by:
rotemliss
|
From: <rot...@us...> - 2006-09-16 14:39:07
|
Revision: 26
http://svn.sourceforge.net/perlwikibot/?rev=26&view=rev
Author: rotemliss
Date: 2006-09-16 07:38:57 -0700 (Sat, 16 Sep 2006)
Log Message:
-----------
Allowing page moves, the bot is now pretty much completed for very general uses - now it should be simplified, allow other uses, etc. The moves bug is still exist, but it was exist also in the old files.
Modified Paths:
--------------
trunk/bot.pl
trunk/includes/functions.pm
Modified: trunk/bot.pl
===================================================================
--- trunk/bot.pl 2006-09-16 14:07:18 UTC (rev 25)
+++ trunk/bot.pl 2006-09-16 14:38:57 UTC (rev 26)
@@ -40,11 +40,13 @@
my $action = $pages[$i + 1];
my $actionName = $configure::actions{ $action };
- # Execute the action (TODO: add move and delete)
+ # Execute the action
if ( $actionName eq "replace" ) {
functions::replaceInPage( $title, $action );
} elsif ( $actionName eq "refresh" ) {
functions::refreshPage( $title, $action );
+ } elsif ( $actionName eq "move" ) {
+ functions::movePage( $title, $action );
} elsif ( $actionName eq "delete" ) {
functions::deletePage( $title, $action );
}
Modified: trunk/includes/functions.pm
===================================================================
--- trunk/includes/functions.pm 2006-09-16 14:07:18 UTC (rev 25)
+++ trunk/includes/functions.pm 2006-09-16 14:38:57 UTC (rev 26)
@@ -224,6 +224,23 @@
}
}
+# Move page
+sub movePage {
+ # Get parameters
+ my ( $oldTitle, $action ) = @_;
+
+ # Send page
+ if ( $configure::sendPages == 1 || $configure::sendPages == 2 ) {
+ my $oldTitles = $configure::titles{ $action };
+ my $newTitles = $configure::news{ $action };
+ my $newTitle = $oldTitle;
+ $newTitle =~ s/$oldTitles/$newTitles/; # FIXME: the frequent use of $1 or \1 does not work, therefore this feature is pretty useless; couldn't work around it so far
+ actions::movePage( $oldTitle, $newTitle, $configure::reasons{ $action } );
+ } else {
+ print "Moved page $oldTitle.\n";
+ }
+}
+
# Delete page
sub deletePage {
# Get parameters
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|