File tree 2 files changed +16
-0
lines changed
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use ADBOS::Email;
12
12
use Email::Valid;
13
13
use Apache::Solr ();
14
14
use Apache::Solr::Document ();
15
+ use POSIX qw/ strftime/ ;
15
16
16
17
my $config = simple_config;
17
18
my $db = ADBOS::DB-> new($config );
@@ -268,6 +269,15 @@ sub opdef($$$;$)
268
269
$self -> _standard_template(' opdef.html' , $vars );
269
270
}
270
271
272
+ sub backup ($)
273
+ { my ($self ,$req ) = @_ ;
274
+
275
+ $req -> content_type(" text/sql; charset=utf-8" );
276
+ my $date = strftime " %Y%m%d " , localtime ;
277
+ $req -> headers_out-> add(' Content-disposition' => " attachment; filename=$date -adbosbackup-R.sql" );
278
+ $req -> sendfile($config -> {backup });
279
+ }
280
+
271
281
sub brief ()
272
282
{ my ($self , $period , $comments ) = @_ ;
273
283
Original file line number Diff line number Diff line change 66
66
$display -> unparsed($user , $id );
67
67
}
68
68
}
69
+ elsif ($req -> unparsed_uri =~ m ! ^/+backup! gi )
70
+ {
71
+ $user = $auth -> login if !$user ;
72
+ $display -> main($user ) unless ($user -> {type } eq ' admin' );
73
+ $display -> backup($req );
74
+ }
69
75
elsif ($req -> unparsed_uri =~ m ! ^/+users/?([0-9]*)! gi )
70
76
{
71
77
$user = $auth -> login if !$user ;
You can’t perform that action at this time.
0 commit comments