[Rt-commit] rt branch add-statement-log-to-dashboard-emailer created. rt-5.0.5-161-g17ba733dee

BPS Git Server git at git.bestpractical.com
Thu Feb 22 16:52:30 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, add-statement-log-to-dashboard-emailer has been created
        at  17ba733deeca27bd95c3c3d0a00924deb55f1ecc (commit)

- Log -----------------------------------------------------------------
commit 17ba733deeca27bd95c3c3d0a00924deb55f1ecc
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Thu Feb 22 11:51:47 2024 -0500

    Rewrite dashboard emailer to use the CLI interface
    
    This allows for the generation of statement logs from the command line
    when sending dashboards via email.

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 4b3b008782..a44723fb68 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -66,26 +66,12 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
 
 }
 
-# Read in the options
+use RT::Interface::CLI qw(Init);
 my %opts;
-use Getopt::Long;
-GetOptions( \%opts,
-    "help|h", "dryrun", "time=i", "epoch=i", "all", "log=s", "user=s", "recipient=s@", "dashboards=s"
+Init( \%opts,
+    "dryrun", "time=i", "epoch=i", "all", "log=s", "user=s", "recipient=s@", "dashboards=s"
 );
 
-if ($opts{'help'}) {
-    require Pod::Usage;
-    print Pod::Usage::pod2usage(-verbose => 2);
-    exit;
-}
-
-require RT;
-require RT::Interface::CLI;
-RT::Interface::CLI->import(qw{ loc });
-
-# Load the config file
-RT::LoadConfig();
-
 # adjust logging to the screen according to options
 RT->Config->Set( LogToSTDERR => $opts{log} ) if $opts{log};
 
@@ -95,9 +81,6 @@ RT->Config->Set( EnableJSChart => 0 );
 # Disable inline editing as email clients don't support it
 RT->Config->Set( InlineEdit => 0 );
 
-# Connect to the database and get RT::SystemUser and RT::Nobody loaded
-RT::Init();
-
 require RT::Dashboard::Mailer;
 RT::Dashboard::Mailer->MailDashboards(
     All        => $opts{all},
@@ -191,6 +174,11 @@ the subscription settings in the web UI.
 
 Adjust LogToSTDERR config option
 
+=item --statement-log LEVEL
+
+Log any SQL queries produced at the specified log level. This works
+similar to the C<$StatementLog> option in the main RT config file.
+
 =back
 
 =cut

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list