wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18248: LJSUP-6868. Add arg to select cluster fo...

Committer: gprochaev
LJSUP-6868. Add arg to select cluster for work.

U   trunk/bin/misc/set_comm_supermaintainer.pl
Modified: trunk/bin/misc/set_comm_supermaintainer.pl
===================================================================
--- trunk/bin/misc/set_comm_supermaintainer.pl	2011-02-09 14:23:37 UTC (rev 18247)
+++ trunk/bin/misc/set_comm_supermaintainer.pl	2011-02-10 03:12:45 UTC (rev 18248)
@@ -21,15 +21,17 @@
     Options: 
         --verbose       Show progress
         --all           Process all communities
+        --cluster-id    Cluster ID
         --do-nothing    Do nothing. Only logging.
         --help          Show this text and exit
 HELP
 
-my ($need_help, $verbose, $no_job, $all);
+my ($need_help, $verbose, $no_job, $cluster_id, $all);
 GetOptions(
     "help"          => \$need_help, 
     "verbose"       => \$verbose,
     "do-nothing"    => \$no_job,
+    "cluster-id=i"  => \$cluster_id,
     "all"           => \$all,
 ) or die $help;
 if ($need_help || (!@ARGV && !$all)) {
@@ -62,23 +64,29 @@
 $dbr->{ShowErrorStatement} = 1;
 
 my $where = @ARGV ? " AND user IN('".join("','",@ARGV)."') " : '';
+my $where_cluster = $cluster_id ? " AND clusterid = $cluster_id " : " AND clusterid != 0 ";
 $verbose = 1 if @ARGV;
+
+sub _log {
+    print @_ if $verbose;
+}
+
+$cluster_id
+    ? _log "Using cluster $cluster_id\n"
+    : _log "Using all clusters\n";
+
 my $communities = $dbr->selectcol_arrayref ("
                         SELECT userid 
                         FROM user 
                         WHERE 
                             statusvis <> 'X' 
-                            AND clusterid != 0 
+                            $where_cluster
                             AND journaltype = 'C' 
-                        $where
+                            $where
                     ");
 
 die "Can't fetch communities list\n" unless $communities;
 
-sub _log {
-    print @_ if $verbose;
-}
-
 my $i = 0;
 LJ::start_request();
 foreach my $c_id (@$communities) {

Tags: livejournal, pl, wisest-owl
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments