summaryrefslogtreecommitdiff
path: root/httemplate/misc/dump.cgi
blob: 3b60b20efc300a93439ac9210abfc16c337b8c45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
%  die "access denied"
%    unless $FS::CurrentUser::CurrentUser->access_right('Export');
%
%  if ( driver_name =~ /^Pg$/ ) {
%    my $dbname = (split(':', datasrc))[2];
%    if ( $dbname =~ /[;=]/ ) {
%      my %elements = map { /^(\w+)=(.*)$/; $1=>$2 } split(';', $dbname);
%      $dbname = $elements{'dbname'};
%    }
%    open(DUMP,"pg_dump $dbname |");
%  } else {
%    errorpage("don't (yet) know how to dump ". driver_name. " databases");
%  }
%
%  http_header('Content-Type' => 'text/plain' );
%
%  while (<DUMP>) {
%    print $_;
%  }
%  close DUMP;