diff options
author | ivan <ivan> | 2004-01-20 20:30:03 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-01-20 20:30:03 +0000 |
commit | 790f80663a0ddcb4f2496bad4b2e0bfa80bc3210 (patch) | |
tree | 7a069af2b897d62b8eac1aba300c7b04b38bd256 /httemplate/misc | |
parent | 7bf662bf7b1bdbddb43052600efeaefd62ea0002 (diff) |
add database dump from web interface
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/dump.cgi | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/httemplate/misc/dump.cgi b/httemplate/misc/dump.cgi new file mode 100644 index 000000000..2c7dfc455 --- /dev/null +++ b/httemplate/misc/dump.cgi @@ -0,0 +1,19 @@ +<% + 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 { + eidiot "don't (yet) know how to dump ". driver_name. " databases\n"; + } + + http_header('Content-Type' => 'text/plain' ); + + while (<DUMP>) { + chomp; +%><%= $_ %><% } + close DUMP; +%> |