[PerlWikiBot] SF.net SVN: perlwikibot: [22] trunk
Status: Pre-Alpha
Brought to you by:
rotemliss
|
From: <rot...@us...> - 2006-09-16 13:06:45
|
Revision: 22
http://svn.sourceforge.net/perlwikibot/?rev=22&view=rev
Author: rotemliss
Date: 2006-09-16 06:06:38 -0700 (Sat, 16 Sep 2006)
Log Message:
-----------
Adding the ability to specify a server for each action, and ignoring actions which are not executed on the specified server.
Modified Paths:
--------------
trunk/config/configure.sample
trunk/includes/functions.pm
Modified: trunk/config/configure.sample
===================================================================
--- trunk/config/configure.sample 2006-09-16 12:48:10 UTC (rev 21)
+++ trunk/config/configure.sample 2006-09-16 13:06:38 UTC (rev 22)
@@ -43,7 +43,7 @@
); # The global actions done
our %actionServers = (
"action" => "server",
-); # Which server should it be executed on? TODO - allow using multiple servers like that, currently ignored
+); # Which server should it be executed on?
our %titles = (
"action" => "^שיחת משתמש:[\\d]+\\.[\\d]+\\.[\\d]+\\.[\\d]+\$",
); # Restrict the actions to these titles
Modified: trunk/includes/functions.pm
===================================================================
--- trunk/includes/functions.pm 2006-09-16 12:48:10 UTC (rev 21)
+++ trunk/includes/functions.pm 2006-09-16 13:06:38 UTC (rev 22)
@@ -15,8 +15,8 @@
die "Unable to handle any case setting besides \"first-letter\".\n";
}
- # Get the executed actions
- my @possibleActions = @configure::executedActions;
+ # Get the executed actions of the specified server
+ my @possibleActions = filterActionsList( @configure::executedActions );
# An array contains all the pages
my @matchingPages;
@@ -108,6 +108,23 @@
return timegm( $6, $5, $4, $3, $2 - 1, $1 - 1900 );
}
+# Filter actions list to the specified script server
+sub filterActionsList {
+ # Get parameters
+ my @originalList = @_;
+
+ # Go over the actions list, and filter the actions which are not in the current server
+ my @newList;
+ my $counter = 0;
+ for ( my $i = 0; $i <= $#originalList; $i++ ) {
+ if ( $configure::actionServers{ $originalList[$i] } eq $ARGV[0] ) {
+ $newList[$counter++] = $originalList[$i];
+ }
+ }
+
+ return @newList;
+}
+
# Log in
sub login {
# Is sysop finally required?
@@ -162,7 +179,9 @@
my $editSummary = $configure::initialEditSummaries{ $ARGV[0] };
# Groups array
- my @actions = ( @configure::executedActions, @configure::bywayActions );
+ my @executedActions = filterActionsList( @configure::executedActions );
+ my @bywayActions = filterActionsList( @configure::bywayActions );
+ my @actions = ( @executedActions, @bywayActions );
# Replaced something at all? Flag to check
my $replaced = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|