[Rt-commit] r6113 - RT-Extension-TicketAging/lib/RT/Extension
ruz at bestpractical.com
ruz at bestpractical.com
Fri Sep 29 04:47:31 EDT 2006
Author: ruz
Date: Fri Sep 29 04:47:30 2006
New Revision: 6113
Modified:
RT-Extension-TicketAging/lib/RT/Extension/TicketAging.pm
Log:
* add support for absolute filename templates
* update docs
Modified: RT-Extension-TicketAging/lib/RT/Extension/TicketAging.pm
==============================================================================
--- RT-Extension-TicketAging/lib/RT/Extension/TicketAging.pm (original)
+++ RT-Extension-TicketAging/lib/RT/Extension/TicketAging.pm Fri Sep 29 04:47:30 2006
@@ -81,6 +81,26 @@
=head2 Aging configuration
+=head3 Libs preloading
+
+Add C<use RT::Extension::TicketAging;> line to the bottom of the RT
+site config, after all extension's options described below.
+
+=head3 C<$TicketAgingFilenameTemplate>
+
+This is the filename template used to create the Shredder dump file
+when tickets are Destroyed. Defaults to the RT::Shredder default.
+Good candidates:
+
+ Set($TicketAgingFilenameTemplate, 'aging-%t.XXXX.sql');
+ # or
+ Set($TicketAgingFilenameTemplate, '/var/backups/aging/%t.XXXX.sql');
+
+See the documentation for C<<RT::Shredder->GetFileName>> for more
+details.
+
+=head3 C<$TicketAgingMap>
+
B<THIS IS AN EXPERIMENTAL FEATURE>
Administrators may define their own aging behaviors.
@@ -91,8 +111,6 @@
activates new age commands but if its not one of the above values you
have to configure the conditions and actions for each age.
-=head2 C<$TicketAgingMap>
-
C<$TicketAgingMap> can be set in your configuration to override or add
to the default life cycle. Its easiest to illustrate this with code.
@@ -241,15 +259,6 @@
=back
-
-=head2 C<$TicketAgingFilenameTemplate>
-
-This is the filename template used to create the Shredder dump file
-when tickets are Destroyed. Defaults to the RT::Shredder default.
-
-See the documentation for C<<RT::Shredder->GetFileName>> for more
-details.
-
=cut
@@ -261,7 +270,9 @@
my $cf = RT::CustomField->new( $RT::SystemUser );
$cf->Load('Age');
- die "Couldn't load the custom field" unless $cf->id;
+ die "Couldn't load the 'Age' custom field. May be you forgot to run `make initdb`"
+ unless $cf->id;
+
my $values = $cf->Values;
while ( my $value = $values->Next ) {
push @Ages, $value->Name;
@@ -269,6 +280,17 @@
return @Ages;
}
+our $FilenameTemplate = FilenameTemplate();
+sub FilenameTemplate {
+ my $tmpl = RT->Config->Get('TicketAgingFilenameTemplate');
+ require File::Spec;
+ unless ( File::Spec->file_name_is_absolute( $tmpl ) ) {
+ require RT::Shredder;
+ $tmpl = File::Spec->catfile( RT::Shredder->StoragePath, $tmpl );
+ }
+ return $tmpl;
+}
+
our %Default_Map = (
Active => { },
Finished => {
@@ -322,9 +344,9 @@
my $plugin = new RT::Shredder::Plugin;
my ($status, $msg) = $plugin->LoadByName('SQLDump');
return ($status, $msg) unless $status;
- my $template = RT->Config->Get('TicketAgingFilenameTemplate');
($status, $msg) = $plugin->TestArgs(
- file_name => $template || ''
+ file_name => $FilenameTemplate,
+ from_storage => 0,
);
return ($status, $msg) unless $status;
More information about the Rt-commit
mailing list