[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-526-g3217f12

Shawn Moore sartak at bestpractical.com
Thu Nov 18 16:41:20 EST 2010


The branch, 3.9-trunk has been updated
       via  3217f12b7e61c947131490ad4cb3b3f93a4ff337 (commit)
       via  2737f26b795726b167d80040ea23751b0cf5a9e2 (commit)
       via  0c838cb7cfd100e136fd0241937c07a6320c8b63 (commit)
       via  2a8cdf55d365a9eacb585b200dad916dd33dbf83 (commit)
       via  be05c38ad507ab72d08b1d13d7b7e7bd22987003 (commit)
       via  43b89e742505d81e04cb5e09d47e5e0aa986f7fc (commit)
       via  c091e8737c3d783ba1c9718c76526284049903bf (commit)
       via  41d3a3dd65d92160150ffc5b80f500899eb2e295 (commit)
       via  44541f8a64925fa294db57aa8f28f51f83f98f23 (commit)
       via  f80de9a6c6ca3d21344ada2ec50e7768ac42aed6 (commit)
       via  90daea838afa846d90981f0d61fc2e5bd47ec70d (commit)
       via  271991ee3e74e226d07e9144e6770d7ba399f2a3 (commit)
       via  b0ef4e723ad11e7f0b9aa3f9bcf0eac9ec9523da (commit)
      from  c52bbfa5a6119e94ebbda5d48c7a22a00001ae40 (commit)

Summary of changes:
 sbin/rt-email-dashboards.in                        |  120 ++++++++------------
 share/html/Dashboards/Render.html                  |    9 +-
 t/{ => api}/cron.t                                 |    0
 t/{ => api}/rtname.t                               |    0
 t/{ => api}/savedsearch.t                          |    0
 .../attributes.t => mail/digest-attributes.t}      |    0
 t/{ => ticket}/clicky.t                            |    0
 7 files changed, 56 insertions(+), 73 deletions(-)
 mode change 100755 => 100644 share/html/Dashboards/Modify.html
 rename t/{ => api}/cron.t (100%)
 rename t/{ => api}/rtname.t (100%)
 rename t/{ => api}/savedsearch.t (100%)
 rename t/{maildigest/attributes.t => mail/digest-attributes.t} (100%)
 rename t/{ => ticket}/clicky.t (100%)

- Log -----------------------------------------------------------------
commit b0ef4e723ad11e7f0b9aa3f9bcf0eac9ec9523da
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:02:08 2010 -0500

    Include request_path in the dashboard FakeRequest

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 1f89df4..c79a1a4 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -439,6 +439,8 @@ sub get_resource {
     $path = "/$path"
         unless $path =~ m{^/};
 
+    $HTML::Mason::Commands::r->path_info($path);
+
     # grab the query arguments
     my %args;
     for (split /&/, ($uri->query||'')) {
@@ -501,6 +503,11 @@ sub content_type {
     $self->{content_type} = shift if @_;
     return $self->{content_type};
 }
+sub path_info {
+    my $self = shift;
+    $self->{path_info} = shift if @_;
+    return $self->{path_info};
+}
 
 =head1 NAME
 

commit 271991ee3e74e226d07e9144e6770d7ba399f2a3
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:05:41 2010 -0500

    Put $id into the dashboard table tag's id
    
        That way you can have site specific styles for individual dashboards

diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
index 74bcaca..1901bc1 100644
--- a/share/html/Dashboards/Render.html
+++ b/share/html/Dashboards/Render.html
@@ -58,8 +58,7 @@
 
 % $m->callback(CallbackName => 'BeforeTable', Dashboard => $DashboardObj, show_cb => $show_cb);
 
-<table class="dashboard">
-<!-- Dashboard #<%$id%> -->
+<table class="dashboard" id="dashboard-<%$id%>">
 
 % $m->callback(CallbackName => 'BeforePanes', Dashboard => $DashboardObj, show_cb => $show_cb);
 

commit 90daea838afa846d90981f0d61fc2e5bd47ec70d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:33:36 2010 -0500

    Move the one file in t/maildigest into t/mail

diff --git a/t/maildigest/attributes.t b/t/mail/digest-attributes.t
similarity index 100%
rename from t/maildigest/attributes.t
rename to t/mail/digest-attributes.t

commit f80de9a6c6ca3d21344ada2ec50e7768ac42aed6
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:34:28 2010 -0500

    Move savedsearch.t into t/api

diff --git a/t/savedsearch.t b/t/api/savedsearch.t
similarity index 100%
rename from t/savedsearch.t
rename to t/api/savedsearch.t

commit 44541f8a64925fa294db57aa8f28f51f83f98f23
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:35:41 2010 -0500

    Move more tests out of the top-level t/

diff --git a/t/cron.t b/t/api/cron.t
similarity index 100%
rename from t/cron.t
rename to t/api/cron.t
diff --git a/t/rtname.t b/t/api/rtname.t
similarity index 100%
rename from t/rtname.t
rename to t/api/rtname.t
diff --git a/t/clicky.t b/t/ticket/clicky.t
similarity index 100%
rename from t/clicky.t
rename to t/ticket/clicky.t

commit 41d3a3dd65d92160150ffc5b80f500899eb2e295
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:46:17 2010 -0500

    When sending a real dashboard, include edit links at the bottom

diff --git a/share/html/Dashboards/Render.html b/share/html/Dashboards/Render.html
index 1901bc1..4b6f5c0 100644
--- a/share/html/Dashboards/Render.html
+++ b/share/html/Dashboards/Render.html
@@ -80,6 +80,12 @@
 
 % $m->callback(CallbackName => 'AfterTable', Dashboard => $DashboardObj, show_cb => $show_cb);
 
+% if (!$Preview) {
+% my $edit = RT->Config->Get('WebPath') . '/Dashboards/Modify.html?id='.$id;
+% my $subscription = RT->Config->Get('WebPath') . '/Dashboards/Subscription.html?id='.$id;
+<p><&|/l, $edit, $subscription &>You <a href="[_1]">may edit this dashboard</a> and <a href="[_2]">your subscription</a> to it in RT.</&></p>
+% }
+
 %# Matches the closing div in /Elements/Footer that it expects
 %# from PageLayout (which we don't use here)
 <div>

commit c091e8737c3d783ba1c9718c76526284049903bf
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 14:47:56 2010 -0500

    Remove spurious +x mode from Dashboards/Modify.html

diff --git a/share/html/Dashboards/Modify.html b/share/html/Dashboards/Modify.html
old mode 100755
new mode 100644

commit 43b89e742505d81e04cb5e09d47e5e0aa986f7fc
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 15:13:51 2010 -0500

    Don't use loc-style messages for logging

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index c79a1a4..050d9dd 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -123,10 +123,10 @@ sub error    { $RT::Logger->error(@_); verbose(@_); 1 }
 sub warning  { $RT::Logger->warning(@_); verbose(@_); 1 }
 
 my $now = $opts{epoch} || time;
-verbose "Using time [_1]", scalar localtime($now);
+verbose("Using time " . scalar(localtime($now)));
 
 my $from = get_from();
-debug "Sending email from [_1]", $from;
+debug("Sending email from $from");
 
 # look through each user for her subscriptions
 my $Users = RT::Users->new(RT->SystemUser);
@@ -134,16 +134,13 @@ $Users->LimitToPrivileged;
 
 while (defined(my $user = $Users->Next)) {
     if ($user->PrincipalObj->Disabled) {
-        debug "Skipping over "
-            . $user->Name
-            . " due to having a disabled account.";
+        debug("Skipping over " . $user->Name . " due to having a disabled account.");
         next;
     }
 
     my ($hour, $dow, $dom) = hour_dow_dom_in($user->Timezone || RT->Config->Get('Timezone'));
     $hour .= ':00';
-    debug "Checking [_1]'s subscriptions: hour [_2], dow [_3], dom [_4]",
-          $user->Name, $hour, $dow, $dom;
+    debug("Checking ".$user->Name."'s subscriptions: hour $hour, dow $dow, dom $dom");
 
     my $currentuser = RT::CurrentUser->new;
     $currentuser->LoadByName($user->Name);
@@ -154,19 +151,23 @@ while (defined(my $user = $Users->Next)) {
         my $counter = $subscription->SubValue('Counter') || 0;
 
         if (!$opts{all}) {
-            debug "Checking against subscription with frequency [_1], hour [_2], dow [_3], dom [_4]",
-                $subscription->SubValue('Frequency'), $subscription->SubValue('Hour'),
-                $subscription->SubValue('Dow'), $subscription->SubValue('Dom');
+            my $sub_frequency = $subscription->SubValue('Frequency');
+            my $sub_hour = $subscription->SubValue('Hour');
+            my $sub_dow = $subscription->SubValue('Dow');
+            my $sub_dom = $subscription->SubValue('Dom');
+            my $sub_fow = $subscription->SubValue('Fow');
 
-            next if $subscription->SubValue('Frequency') eq 'never';
+            debug("Checking against subscription with frequency $sub_frequency, hour $sub_hour, dow $sub_dow, dom $sub_dom, fow $sub_fow");
+
+            next if $sub_frequency eq 'never';
 
             # correct hour?
-            next if $subscription->SubValue('Hour') ne $hour;
+            next if $sub_hour ne $hour;
 
             # if weekly, correct day of week?
-            if ( $subscription->SubValue('Frequency') eq 'weekly' ) {
-                next if $subscription->SubValue('Dow') ne $dow;
-                my $fow       = $subscription->SubValue('Fow') || 1;
+            if ( $sub_frequency eq 'weekly' ) {
+                next if $sub_frequency ne $dow;
+                my $fow = $sub_fow || 1;
                 if ( $counter % $fow ) {
                     $subscription->SetSubValues( Counter => $counter + 1 )
                       unless $opts{'dryrun'};
@@ -175,11 +176,11 @@ while (defined(my $user = $Users->Next)) {
             }
 
             # if monthly, correct day of month?
-            elsif ($subscription->SubValue('Frequency') eq 'monthly') {
-                next if $subscription->SubValue('Dom') != $dom;
+            elsif ($sub_frequency eq 'monthly') {
+                next if $sub_dom != $dom;
             }
 
-            elsif ($subscription->SubValue('Frequency') eq 'm-f') {
+            elsif ($sub_frequency eq 'm-f') {
                 next if $dow eq 'Sunday' || $dow eq 'Saturday';
             }
         }
@@ -189,7 +190,7 @@ while (defined(my $user = $Users->Next)) {
 
         eval { send_dashboard($currentuser, $email, $subscription) };
         if ( $@ ) {
-            error 'Caught exception: ' . $@;
+            error("Caught exception: $@");
         }
         else {
             $subscription->SetSubValues(
@@ -204,17 +205,14 @@ sub send_dashboard {
 
     my $rows = $subscription->SubValue('Rows');
 
-    my $dashboard = RT::Dashboard->new($currentuser);
+    my $DashboardId = $subscription->SubValue('DashboardId');
 
-    my ($ok, $msg) = $dashboard->LoadById($subscription->SubValue('DashboardId'));
+    my $dashboard = RT::Dashboard->new($currentuser);
+    my ($ok, $msg) = $dashboard->LoadById($DashboardId);
 
     # failed to load dashboard. perhaps it was deleted or it changed privacy
     if (!$ok) {
-        warning "Unable to load dashboard [_1] of subscription [_2] for user [_3]: [_4]",
-            $subscription->SubValue('DashboardId'),
-            $subscription->Id,
-            $currentuser->Name,
-            $msg;
+        warning("Unable to load dashboard $DashboardId of subscription ".$subscription->Id." for user ".$currentuser->Name.": $msg");
 
         my $ok = RT::Interface::Email::SendEmailUsingTemplate(
             From      => $from,
@@ -229,22 +227,20 @@ sub send_dashboard {
         if ($ok) {
             my ($deleted, $msg) = $subscription->Delete();
             if ($deleted) {
-                verbose("Deleted an obsolete subscription: [_1]", $msg);
+                verbose("Deleted an obsolete subscription: $msg");
             }
             else {
-                warning("Unable to delete an obsolete subscription: [_1]", $msg);
+                warning("Unable to delete an obsolete subscription: $msg");
             }
         }
         else {
-            warning("Unable to notify [_1] of an obsolete subscription", $currentuser->Name);
+            warning("Unable to notify ".$currentuser->Name." of an obsolete subscription");
         }
 
         return;
     }
 
-    verbose 'Creating dashboard "[_1]" for user "[_2]":',
-            $dashboard->Name,
-            $currentuser->Name;
+    verbose('Creating dashboard "'.$dashboard->Name.'" for user "'.$currentuser->Name.'":');
 
     if ($opts{'dryrun'}) {
         print << "SUMMARY";
@@ -265,7 +261,7 @@ SUMMARY
         $contents =~ s/$_//g;
     }
 
-    debug "Got [_1] characters of output.", length $contents;
+    debug("Got ".length($contents)." characters of output.");
 
     $contents = HTML::RewriteAttributes::Links->rewrite(
         $contents,
@@ -278,10 +274,7 @@ SUMMARY
 sub email_dashboard {
     my ($currentuser, $email, $dashboard, $subscription, $content) = @_;
 
-    verbose 'Sending dashboard "[_1]" to user [_2] <[_3]>',
-            $dashboard->Name,
-            $currentuser->Name,
-            $email;
+    verbose('Sending dashboard "'.$dashboard->Name.'" to user '.$currentuser->Name.' <'.$email.'>');
 
     my $subject = sprintf '[%s] ' .  RT->Config->Get('DashboardSubject'),
         RT->Config->Get('rtname'),
@@ -294,12 +287,10 @@ sub email_dashboard {
         Entity => $entity,
     );
 
-    debug "Done sending dashboard to [_1] <[_2]>",
-          $currentuser->Name, $email
-              and return if $ok;
+    debug("Done sending dashboard to ".$currentuser->Name." <$email>")
+        and return if $ok;
 
-    error 'Failed to email dashboard to user [_1] <[_2]>',
-          $currentuser->Name, $email;
+    error("Failed to email dashboard to user ".$currentuser->Name." <$email>");
 }
 
 sub build_email {
@@ -319,7 +310,7 @@ sub build_email {
             # downgrade non-text strings, because all strings are utf8 by
             # default, which is wrong for non-text strings.
             if ( $mimetype !~ m{text/} ) {
-                utf8::downgrade( $data, 1 ) or warning "downgrade $data failed";
+                utf8::downgrade( $data, 1 ) or warning("downgrade $data failed");
             }
 
             push @parts, MIME::Entity->build(
@@ -374,7 +365,7 @@ sub get_from {
 
     sub mason {
         unless ($mason) {
-            debug "Creating Mason object.";
+            debug("Creating Mason object.");
 
             # user may not have permissions on the data directory, so create a
             # new one
@@ -428,7 +419,7 @@ sub get_resource {
     my $uri = URI->new(shift);
     my ($content, $filename, $mimetype, $encoding);
 
-    verbose "Getting resource [_1]", $uri;
+    verbose("Getting resource $uri");
 
     # strip out the equivalent of WebURL, so we start at the correct /
     my $path = $uri->path;
@@ -463,7 +454,7 @@ sub get_resource {
         }
     }
 
-    debug "Running component '[_1]'", $path;
+    debug("Running component '$path'");
     $content = run_component($path, %args);
 
     # guess at the filename from the component name
@@ -484,12 +475,7 @@ sub get_resource {
     $mimetype ||= 'application/octet-stream';
     $encoding ||= 'base64';
 
-    debug "Resource [_1]: length=[_2] filename='[_3]' mimetype='[_4]', encoding='[_5]'",
-        $uri,
-        length($content),
-        $filename,
-        $mimetype,
-        $encoding;
+    debug("Resource $uri: length=".length($content)." filename='$filename' mimetype='$mimetype', encoding='$encoding'");
 
     return ($content, $filename, $mimetype, $encoding);
 }

commit be05c38ad507ab72d08b1d13d7b7e7bd22987003
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 15:15:05 2010 -0500

    Use $RT::Logger directly for errors and warnings

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 050d9dd..65672af 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -119,8 +119,6 @@ no warnings 'once';
 # helper functions
 sub verbose  { print @_, "\n" if $opts{debug} || $opts{verbose}; 1 }
 sub debug    { print @_, "\n" if $opts{debug}; 1 }
-sub error    { $RT::Logger->error(@_); verbose(@_); 1 }
-sub warning  { $RT::Logger->warning(@_); verbose(@_); 1 }
 
 my $now = $opts{epoch} || time;
 verbose("Using time " . scalar(localtime($now)));
@@ -190,7 +188,7 @@ while (defined(my $user = $Users->Next)) {
 
         eval { send_dashboard($currentuser, $email, $subscription) };
         if ( $@ ) {
-            error("Caught exception: $@");
+            $RT::Logger->error("Caught exception: $@");
         }
         else {
             $subscription->SetSubValues(
@@ -212,7 +210,7 @@ sub send_dashboard {
 
     # failed to load dashboard. perhaps it was deleted or it changed privacy
     if (!$ok) {
-        warning("Unable to load dashboard $DashboardId of subscription ".$subscription->Id." for user ".$currentuser->Name.": $msg");
+        $RT::Logger->warning("Unable to load dashboard $DashboardId of subscription ".$subscription->Id." for user ".$currentuser->Name.": $msg");
 
         my $ok = RT::Interface::Email::SendEmailUsingTemplate(
             From      => $from,
@@ -230,11 +228,11 @@ sub send_dashboard {
                 verbose("Deleted an obsolete subscription: $msg");
             }
             else {
-                warning("Unable to delete an obsolete subscription: $msg");
+                $RT::Logger->warning("Unable to delete an obsolete subscription: $msg");
             }
         }
         else {
-            warning("Unable to notify ".$currentuser->Name." of an obsolete subscription");
+            $RT::Logger->warning("Unable to notify ".$currentuser->Name." of an obsolete subscription");
         }
 
         return;
@@ -290,7 +288,7 @@ sub email_dashboard {
     debug("Done sending dashboard to ".$currentuser->Name." <$email>")
         and return if $ok;
 
-    error("Failed to email dashboard to user ".$currentuser->Name." <$email>");
+    $RT::Logger->error("Failed to email dashboard to user ".$currentuser->Name." <$email>");
 }
 
 sub build_email {
@@ -310,7 +308,7 @@ sub build_email {
             # downgrade non-text strings, because all strings are utf8 by
             # default, which is wrong for non-text strings.
             if ( $mimetype !~ m{text/} ) {
-                utf8::downgrade( $data, 1 ) or warning("downgrade $data failed");
+                utf8::downgrade( $data, 1 ) or $RT::Logger->warning("downgrade $data failed");
             }
 
             push @parts, MIME::Entity->build(

commit 2a8cdf55d365a9eacb585b200dad916dd33dbf83
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 15:16:48 2010 -0500

    Eliminate --debug in favor of $RT::Logger->debug

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 65672af..124a940 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -78,7 +78,7 @@ BEGIN {
 my %opts;
 use Getopt::Long;
 GetOptions( \%opts,
-    "help|h", "dryrun", "verbose", "debug", "epoch=i", "all", "skip-acl"
+    "help|h", "dryrun", "verbose", "epoch=i", "all", "skip-acl"
 );
 
 if ($opts{'help'}) {
@@ -117,14 +117,13 @@ $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
 no warnings 'once';
 
 # helper functions
-sub verbose  { print @_, "\n" if $opts{debug} || $opts{verbose}; 1 }
-sub debug    { print @_, "\n" if $opts{debug}; 1 }
+sub verbose  { print @_, "\n" if $opts{verbose}; 1 }
 
 my $now = $opts{epoch} || time;
 verbose("Using time " . scalar(localtime($now)));
 
 my $from = get_from();
-debug("Sending email from $from");
+$RT::Logger->debug("Sending email from $from");
 
 # look through each user for her subscriptions
 my $Users = RT::Users->new(RT->SystemUser);
@@ -132,13 +131,13 @@ $Users->LimitToPrivileged;
 
 while (defined(my $user = $Users->Next)) {
     if ($user->PrincipalObj->Disabled) {
-        debug("Skipping over " . $user->Name . " due to having a disabled account.");
+        $RT::Logger->debug("Skipping over " . $user->Name . " due to having a disabled account.");
         next;
     }
 
     my ($hour, $dow, $dom) = hour_dow_dom_in($user->Timezone || RT->Config->Get('Timezone'));
     $hour .= ':00';
-    debug("Checking ".$user->Name."'s subscriptions: hour $hour, dow $dow, dom $dom");
+    $RT::Logger->debug("Checking ".$user->Name."'s subscriptions: hour $hour, dow $dow, dom $dom");
 
     my $currentuser = RT::CurrentUser->new;
     $currentuser->LoadByName($user->Name);
@@ -155,7 +154,7 @@ while (defined(my $user = $Users->Next)) {
             my $sub_dom = $subscription->SubValue('Dom');
             my $sub_fow = $subscription->SubValue('Fow');
 
-            debug("Checking against subscription with frequency $sub_frequency, hour $sub_hour, dow $sub_dow, dom $sub_dom, fow $sub_fow");
+            $RT::Logger->debug("Checking against subscription with frequency $sub_frequency, hour $sub_hour, dow $sub_dow, dom $sub_dom, fow $sub_fow");
 
             next if $sub_frequency eq 'never';
 
@@ -259,7 +258,7 @@ SUMMARY
         $contents =~ s/$_//g;
     }
 
-    debug("Got ".length($contents)." characters of output.");
+    $RT::Logger->debug("Got ".length($contents)." characters of output.");
 
     $contents = HTML::RewriteAttributes::Links->rewrite(
         $contents,
@@ -285,7 +284,7 @@ sub email_dashboard {
         Entity => $entity,
     );
 
-    debug("Done sending dashboard to ".$currentuser->Name." <$email>")
+    $RT::Logger->debug("Done sending dashboard to ".$currentuser->Name." <$email>")
         and return if $ok;
 
     $RT::Logger->error("Failed to email dashboard to user ".$currentuser->Name." <$email>");
@@ -363,7 +362,7 @@ sub get_from {
 
     sub mason {
         unless ($mason) {
-            debug("Creating Mason object.");
+            $RT::Logger->debug("Creating Mason object.");
 
             # user may not have permissions on the data directory, so create a
             # new one
@@ -452,7 +451,7 @@ sub get_resource {
         }
     }
 
-    debug("Running component '$path'");
+    $RT::Logger->debug("Running component '$path'");
     $content = run_component($path, %args);
 
     # guess at the filename from the component name
@@ -473,7 +472,7 @@ sub get_resource {
     $mimetype ||= 'application/octet-stream';
     $encoding ||= 'base64';
 
-    debug("Resource $uri: length=".length($content)." filename='$filename' mimetype='$mimetype', encoding='$encoding'");
+    $RT::Logger->debug("Resource $uri: length=".length($content)." filename='$filename' mimetype='$mimetype', encoding='$encoding'");
 
     return ($content, $filename, $mimetype, $encoding);
 }
@@ -547,11 +546,6 @@ be Oct 12 19:06:58 GMT 2007).
 Print out some tracing information (such as which dashboards are being
 generated and sent out)
 
-=item --debug
-
-Print out more tracing information (such as each user and subscription that is
-being considered)
-
 =item --all
 
 Ignore subscription frequency when considering each dashboard (should only be

commit 0c838cb7cfd100e136fd0241937c07a6320c8b63
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 15:17:49 2010 -0500

    Eliminate --verbose in favor of $RT::Logger->info

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 124a940..36693ab 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -78,7 +78,7 @@ BEGIN {
 my %opts;
 use Getopt::Long;
 GetOptions( \%opts,
-    "help|h", "dryrun", "verbose", "epoch=i", "all", "skip-acl"
+    "help|h", "dryrun", "epoch=i", "all", "skip-acl"
 );
 
 if ($opts{'help'}) {
@@ -116,11 +116,8 @@ $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
 
 no warnings 'once';
 
-# helper functions
-sub verbose  { print @_, "\n" if $opts{verbose}; 1 }
-
 my $now = $opts{epoch} || time;
-verbose("Using time " . scalar(localtime($now)));
+$RT::Logger->info("Using time " . scalar(localtime($now)) . " for dashboard generation");
 
 my $from = get_from();
 $RT::Logger->debug("Sending email from $from");
@@ -224,7 +221,7 @@ sub send_dashboard {
         if ($ok) {
             my ($deleted, $msg) = $subscription->Delete();
             if ($deleted) {
-                verbose("Deleted an obsolete subscription: $msg");
+                $RT::Logger->info("Deleted an obsolete subscription: $msg");
             }
             else {
                 $RT::Logger->warning("Unable to delete an obsolete subscription: $msg");
@@ -237,7 +234,7 @@ sub send_dashboard {
         return;
     }
 
-    verbose('Creating dashboard "'.$dashboard->Name.'" for user "'.$currentuser->Name.'":');
+    $RT::Logger->info('Generating dashboard "'.$dashboard->Name.'" for user "'.$currentuser->Name.'":');
 
     if ($opts{'dryrun'}) {
         print << "SUMMARY";
@@ -271,7 +268,7 @@ SUMMARY
 sub email_dashboard {
     my ($currentuser, $email, $dashboard, $subscription, $content) = @_;
 
-    verbose('Sending dashboard "'.$dashboard->Name.'" to user '.$currentuser->Name.' <'.$email.'>');
+    $RT::Logger->info('Mailing dashboard "'.$dashboard->Name.'" to user '.$currentuser->Name.' <'.$email.'>');
 
     my $subject = sprintf '[%s] ' .  RT->Config->Get('DashboardSubject'),
         RT->Config->Get('rtname'),
@@ -416,7 +413,7 @@ sub get_resource {
     my $uri = URI->new(shift);
     my ($content, $filename, $mimetype, $encoding);
 
-    verbose("Getting resource $uri");
+    $RT::Logger->info("Getting resource $uri");
 
     # strip out the equivalent of WebURL, so we start at the correct /
     my $path = $uri->path;
@@ -541,11 +538,6 @@ Instead of using the current time to figure out which dashboards should be
 sent, use SECONDS (usually since midnight Jan 1st, 1970, so C<1192216018> would
 be Oct 12 19:06:58 GMT 2007).
 
-=item --verbose
-
-Print out some tracing information (such as which dashboards are being
-generated and sent out)
-
 =item --all
 
 Ignore subscription frequency when considering each dashboard (should only be

commit 2737f26b795726b167d80040ea23751b0cf5a9e2
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 15:18:34 2010 -0500

    Remove skip-acl option which doesn't do anything

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 36693ab..ae06e4f 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -78,7 +78,7 @@ BEGIN {
 my %opts;
 use Getopt::Long;
 GetOptions( \%opts,
-    "help|h", "dryrun", "epoch=i", "all", "skip-acl"
+    "help|h", "dryrun", "epoch=i", "all"
 );
 
 if ($opts{'help'}) {

commit 3217f12b7e61c947131490ad4cb3b3f93a4ff337
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Nov 18 15:19:59 2010 -0500

    A bit more help prose

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index ae06e4f..0827fe9 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -530,7 +530,8 @@ Display this documentation
 
 =item --dryrun
 
-Figure out which dashboards would be sent, but don't actually generate them
+Figure out which dashboards would be sent, but don't actually generate or email
+any of them
 
 =item --epoch SECONDS
 
@@ -541,7 +542,7 @@ be Oct 12 19:06:58 GMT 2007).
 =item --all
 
 Ignore subscription frequency when considering each dashboard (should only be
-used with --dryrun)
+used with --dryrun for testing and debugging)
 
 =back
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list