[Rt-commit] r6031 - RT-Extension-TicketAging/sbin
ruz at bestpractical.com
ruz at bestpractical.com
Mon Sep 25 15:41:20 EDT 2006
Author: ruz
Date: Mon Sep 25 15:41:19 2006
New Revision: 6031
Modified:
RT-Extension-TicketAging/sbin/rt-aging
Log:
* add simple USAGE docs
* we must 'use libs' before 'use RT'
* shuffle things a little
Modified: RT-Extension-TicketAging/sbin/rt-aging
==============================================================================
--- RT-Extension-TicketAging/sbin/rt-aging (original)
+++ RT-Extension-TicketAging/sbin/rt-aging Mon Sep 25 15:41:19 2006
@@ -3,23 +3,33 @@
use strict;
use warnings;
+BEGIN {
### after: push @INC, qw(@RT_LIB_PATH@);
push @INC, qw(/opt/rt3/local/lib /opt/rt3/lib);
+}
+use RT;
use Getopt::Long;
+my %opt = (
+ debug => 0,
+ 'prune-backups' => 0,
+);
+GetOptions( \%opt, 'debug', 'prune-backups:i' );
-use RT;
RT::LoadConfig();
-my $debug;
-GetOptions( debug => \$debug );
-RT->Config->Set( LogToScreen => ($debug? 'debug': 'error') );
+# set debugging level
+RT->Config->Set( LogToScreen => ($opt{'debug'}? 'debug': 'error') );
+
RT::Init();
require RT::Extension::TicketAging;
-
sub loc(@) { RT::Extension::TicketAging::loc(@_) }
+if ( $opt{'prune-backups'} ) {
+ prune_backups( OlderThan => $opt{'prune-backups'} );
+}
+
my @ages = RT::Extension::TicketAging->Ages();
my ($map, $msg) = RT::Extension::TicketAging->PrepareMap();
unless ( $map ) {
@@ -135,4 +145,32 @@
return '( '. join( " $aggregator ", grep $_ && !/^\s+$/, @parts ) .' )';
}
+sub prune_backups {
+}
+
+__END__
+
+=head1 NAME
+
+rt-aging - tickets aging utility
+
+=head1 SYNOPSYS
+
+ rt-aging [--debug]
+ rt-aging --prune-backups 90 [--debug]
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--debug>
+
+Prints debug messages.
+
+=item B<--prune-backups> <days>
+
+Deletes backups that are older than C<< <days> >> days.
+
+=back
+=cut
More information about the Rt-commit
mailing list