projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7bf662b
)
add database dump from web interface
author
ivan
<ivan>
Tue, 20 Jan 2004 20:30:03 +0000
(20:30 +0000)
committer
ivan
<ivan>
Tue, 20 Jan 2004 20:30:03 +0000
(20:30 +0000)
httemplate/index.html
patch
|
blob
|
history
httemplate/misc/dump.cgi
[new file with mode: 0644]
patch
|
blob
diff --git
a/httemplate/index.html
b/httemplate/index.html
index
d4284fa
..
548c25c
100644
(file)
--- a/
httemplate/index.html
+++ b/
httemplate/index.html
@@
-153,6
+153,7
@@
<BR><A HREF="browse/queue.cgi">View pending job queue</A>
<BR><A HREF="misc/cust_main-import.cgi">Batch import customers from CSV file</A>
<BR><A HREF="misc/cust_main-import_charges.cgi">Batch import charges from CSV file</A>
<BR><A HREF="browse/queue.cgi">View pending job queue</A>
<BR><A HREF="misc/cust_main-import.cgi">Batch import customers from CSV file</A>
<BR><A HREF="misc/cust_main-import_charges.cgi">Batch import charges from CSV file</A>
+ <BR><A HREF="misc/dump.cgi">Download database dump</A>
<BR><BR><CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR>
<A NAME="config" HREF="config/config-view.cgi">Configuration</a><!-- - <font size="+2" color="#ff0000">start here</font> -->
<BR><BR><A NAME="admin">Administration</a>
<BR><BR><CENTER><HR WIDTH="94%" NOSHADE></CENTER><BR>
<A NAME="config" HREF="config/config-view.cgi">Configuration</a><!-- - <font size="+2" color="#ff0000">start here</font> -->
<BR><BR><A NAME="admin">Administration</a>
diff --git a/httemplate/misc/dump.cgi
b/httemplate/misc/dump.cgi
new file mode 100644
(file)
index 0000000..
2c7dfc4
--- /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;
+%>