Skip to content

Commit

Permalink
Merge branch '5.0/add-statement-log-to-dashboard-emailer' into 5.0-trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnavy committed Feb 22, 2024
2 parents 2f3797b + 77ddeab commit cf34cad
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions sbin/rt-email-dashboards.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,38 +66,18 @@ 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", "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};

# Disable JS chart as email clients don't support it
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},
Expand Down Expand Up @@ -191,6 +171,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
Expand Down

0 comments on commit cf34cad

Please sign in to comment.