Committer: dnikolaev
LJSUP-7213: bin/misc/smsru_stats.pl "--verbose" flag was addedU trunk/bin/misc/smsru_stats.pl
Modified: trunk/bin/misc/smsru_stats.pl =================================================================== --- trunk/bin/misc/smsru_stats.pl 2010-11-15 04:08:30 UTC (rev 9706) +++ trunk/bin/misc/smsru_stats.pl 2010-11-15 04:23:01 UTC (rev 9707) @@ -9,7 +9,11 @@ require "ljlib.pl"; use LJ::DBUtil; use LJ::NotificationMethod; +use Getopt::Long; +my $verbose = 0; +GetOptions("verbose" => \$verbose); + my $SECONDS_IN_DAY = 86400; my $DAYS_IN_PERIOD = 7; my @OPERATORS = qw(beeline megafon mts total); @@ -30,9 +34,9 @@ # iterate over all clusters and query for stats foreach my $cid (@LJ::CLUSTERS) { - print STDERR "Querying cluster $cid...\n"; + print "Querying cluster $cid...\n" if $verbose; - my $udb = LJ::DBUtil->connect_to_cluster($cid, 1) + my $udb = LJ::DBUtil->connect_to_cluster($cid, $verbose) or die "Unable to connect database for cluster: $cid\n"; my $sth = $udb->prepare( @@ -185,7 +189,7 @@ $message .= "</body></html>\n"; -print STDERR "Sending email(s)\n"; +print "Sending email(s)\n" if $verbose; foreach my $email (@stat_recipients) { LJ::send_mail({ @@ -197,7 +201,7 @@ }); } -print STDERR "done!\n"; +print "done!\n" if $verbose; sub is_user_subscribed {