[Rt-commit] r6025 - in rt/branches/3.7-EXPERIMENTAL: .
html/Admin/Tools/Shredder/Dumps
html/Admin/Tools/Shredder/Elements lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Sat Sep 23 00:47:06 EDT 2006
Author: ruz
Date: Sat Sep 23 00:47:05 2006
New Revision: 6025
Added:
rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Dumps/
rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Dumps/dhandler
rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/DumpFileLink
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/PluginArguments
rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/index.html
rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm
Log:
r3783 at cubic-pc: cubic | 2006-09-23 08:54:07 +0400
Shredder
* allow user to download dump file after wiping
Added: rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Dumps/dhandler
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Dumps/dhandler Sat Sep 23 00:47:05 2006
@@ -0,0 +1,21 @@
+<%ATTR>
+AutoFlush => 0
+</%ATTR>
+<%FLAGS>
+inherit => undef
+</%FLAGS>
+<%INIT>
+my $arg = $m->dhandler_arg;
+$m->abort(404) if $arg =~ m{\.\.|/|\\};
+
+use File::Spec ();
+use RT::Shredder ();
+my $File = File::Spec->catfile( RT::Shredder->StoragePath, $arg );
+$r->content_type('application/octets-stream');
+open my $fh, "<:raw", $File or $m->abort(404);
+my $buf;
+while( read $fh, $buf, 1024*1024 ) {
+ $m->out($buf);
+}
+return 0;
+</%INIT>
Added: rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/DumpFileLink
==============================================================================
--- (empty file)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/DumpFileLink Sat Sep 23 00:47:05 2006
@@ -0,0 +1,14 @@
+<div id="shredder-dump-file-link" class="shredder-help">
+<a href="<% RT->Config->Get('WebPath') %>/Admin/Tools/Shredder/Dumps/<% $File %>">Download dumpfile</a>
+</div>
+<%ARGS>
+$File => ''
+</%ARGS>
+<%INIT>
+return unless $File;
+use File::Spec ();
+use RT::Shredder ();
+
+$File = File::Spec->abs2rel( $File, RT::Shredder->StoragePath )
+ if File::Spec->file_name_is_absolute($File);
+</%INIT>
Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/PluginArguments
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/PluginArguments (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/Elements/PluginArguments Sat Sep 23 00:47:05 2006
@@ -4,7 +4,7 @@
<div id="shredder-plugin-<% $Plugin %>-arguments" class="shredder-form">
<span>Fill arguments:</span><br />
% foreach my $a( $plugin_obj->SupportArgs ) {
-<span><% $a %>:<span><input type="text" name="<% "$Plugin:$a" %>" value="<% $ARGS{ "$Plugin:$a" } || '' %>" /><br />
+<span><% $a %>:</span><input type="text" name="<% "$Plugin:$a" %>" value="<% $ARGS{ "$Plugin:$a" } || '' %>" /><br />
% }
</div>
<%INIT>
Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/index.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/index.html (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Tools/Shredder/index.html Sat Sep 23 00:47:05 2006
@@ -14,6 +14,7 @@
<div id="shredder-select-plugin">
<& /Elements/ListActions, actions => $messages{'Errors'} &>
<& /Elements/ListActions, actions => $messages{'Success'} &>
+<& Elements/DumpFileLink, File => $dump_file &>
<& Elements/SelectPlugin, Plugin => $Plugin, %ARGS &>
<div id="shredder-submit-button" class="<% $Plugin? '': 'hidden' %>">
<& /Elements/Submit, Name => 'Search', Label => loc('Search') &>
@@ -77,6 +78,8 @@
}
} }
+my $dump_file = '';
+
if( $Plugin && $Wipeout ) { { # use additional block({}) to effectively exit block on errors
my $shredder = new RT::Shredder( force => 1 );
my $backup_plugin = new RT::Shredder::Plugin;
@@ -93,8 +96,8 @@
last;
}
- my ($fn) = $backup_plugin->FileName;
- push @{ $messages{'Success'} }, "SQL dump file is '$fn'";
+ ($dump_file) = $backup_plugin->FileName;
+ push @{ $messages{'Success'} }, "SQL dump file is '$dump_file'";
$shredder->AddDumpPlugin( Object => $backup_plugin );
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Shredder.pm Sat Sep 23 00:47:05 2006
@@ -604,8 +604,8 @@
sub StoragePath
{
- return $RT::ShredderStoragePath if $RT::ShredderStoragePath;
- return File::Spec->catdir( $RT::VarPath, qw(data RT-Shredder) );
+ return $RT::ShredderStoragePath ||
+ File::Spec->catdir( $RT::VarPath, qw(data RT-Shredder) );
}
my %active_dump_state = ();
More information about the Rt-commit
mailing list