[Bps-public-commit] r14643 - in Pushmi/trunk: . Pushmi-Admin/lib/Pushmi/Admin Pushmi-Admin/share/web/static/css Pushmi-Admin/share/web/static/images/silk bin

alexmv at bestpractical.com alexmv at bestpractical.com
Wed Jul 30 13:52:15 EDT 2008


Author: alexmv
Date: Wed Jul 30 13:51:06 2008
New Revision: 14643

Added:
   Pushmi/trunk/Pushmi-Admin/share/web/static/images/silk/database_save.png   (contents, props changed)
Modified:
   Pushmi/trunk/   (props changed)
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Dispatcher.pm
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
   Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm
   Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css
   Pushmi/trunk/bin/pushmi

Log:
 r34965 at kohr-ah:  chmrr | 2008-07-30 13:49:13 -0400
  * Database backup link


Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Dispatcher.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Dispatcher.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Dispatcher.pm	Wed Jul 30 13:51:06 2008
@@ -16,6 +16,14 @@
     }
 };
 
+on qr{^/replica/(.*?)-\d{4}-\d{2}-\d{2}\.gz$} => run {
+    my $replica = Pushmi::Admin::Model::Replica->new;
+    $replica->load_by_cols( clean_name => $1 );
+    show '/errors/404' unless $replica->id;
+    set replica => $replica;
+    show '/dump';
+};
+
 under '/replica/*' => run {
     my $replica = Pushmi::Admin::Model::Replica->new;
     $replica->load_by_cols( clean_name => $1 );

Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/Model/Replica.pm	Wed Jul 30 13:51:06 2008
@@ -11,6 +11,7 @@
 use Pushmi::Command::Sync;
 
 use Time::Duration qw//;
+use IO::Compress::Gzip qw//;
 
 use Pushmi::Admin::Record schema {
 
@@ -128,6 +129,17 @@
     $self->clear_cache;
 }
 
+sub dump {
+    my $self = shift;
+    my($fh) = @_;
+    $fh ||= "-";
+
+    my $svn_root = $self->svn_root;
+    open(DUMP, "-|", "svnadmin dump $svn_root -q");
+    IO::Compress::Gzip::gzip \*DUMP, $fh;
+    close DUMP;
+}
+
 sub svn_root {
     my $self  = shift;
     my @parts = File::Spec->splitpath( Jifty->config->app('svn_root') );

Modified: Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm	(original)
+++ Pushmi/trunk/Pushmi-Admin/lib/Pushmi/Admin/View.pm	Wed Jul 30 13:51:06 2008
@@ -265,6 +265,31 @@
                         . " remirroring all remote revisions.  This is likely to take a while!";
                 };
             }
+
+            div {
+                { class is "backup_replica" }
+                hyperlink(
+                    url => "/replica/"
+                        . $replica->clean_name . "-"
+                        . DateTime->now->ymd . ".gz",
+                    label     => "Download backup",
+                    as_button => 1
+                );
+                p {
+                    outs( "This will download a backup of the replica, as a " );
+                    tt { "gzip"};
+                    outs( "'d ");
+                    tt { "svnadmin dump" };
+                    outs( " file." );
+                };
+            }
         };
     }
 };
+
+template 'dump' => sub {
+    my $replica = get('replica');
+    Jifty->handler->apache->header_out('Content-Type' => 'application/x-gzip');
+    Jifty->handler->apache->send_http_header;
+    $replica->dump;
+};

Modified: Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css
==============================================================================
--- Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css	(original)
+++ Pushmi/trunk/Pushmi-Admin/share/web/static/css/app.css	Wed Jul 30 13:51:06 2008
@@ -155,7 +155,7 @@
   -moz-border-radius: 5px; -webkit-border-radius: 5px;
 }
 
-.delete_replica, .remirror_replica {
+.delete_replica, .remirror_replica, .backup_replica {
   padding: 1em;
 }
 
@@ -167,7 +167,7 @@
   padding: 0.5em;
 }
 
-.delete_replica input, .remirror_replica input {
+.delete_replica input, .remirror_replica input, .backup_replica input {
   padding-left: 2.5em;
   background-repeat: no-repeat;
   background-position: 10px 7px;
@@ -175,14 +175,15 @@
 
 .delete_replica input   { background-image: url(/static/images/silk/database_delete.png);  }
 .remirror_replica input { background-image: url(/static/images/silk/database_refresh.png); }
+.backup_replica input   { background-image: url(/static/images/silk/database_save.png);    }
 
-.delete_replica p, .remirror_replica p { 
+.delete_replica p, .remirror_replica p, .backup_replica p {
   margin: 0;
   padding-left: 1em;
   padding-top: 1em;
 }
 
-.delete_replica {
+.delete_replica, .remirror_replica {
   border-bottom: 1px solid #334;
 }
 

Added: Pushmi/trunk/Pushmi-Admin/share/web/static/images/silk/database_save.png
==============================================================================
Binary file. No diff available.

Modified: Pushmi/trunk/bin/pushmi
==============================================================================
--- Pushmi/trunk/bin/pushmi	(original)
+++ Pushmi/trunk/bin/pushmi	Wed Jul 30 13:51:06 2008
@@ -4,6 +4,9 @@
 use SVK::I18N;
 use Getopt::Long;
 
+close STDOUT;
+close STDERR;
+
 $SIG{INT} = sub {
     die loc("Interrupted.\n");
 };



More information about the Bps-public-commit mailing list