-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_database.cgi
More file actions
executable file
·49 lines (37 loc) · 1.02 KB
/
Copy pathdump_database.cgi
File metadata and controls
executable file
·49 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl -w
# Copyright(c) 2003-2007 Robert L. Brown. This is licensed software
# only to be used with an explicit right-to-use license from the
# copyright holder.
use strict;
use CGI qw(:standard *table *ol *ul *Tr *td);
use CGI::Carp;
use Database;
use Layout;
use Param;
require "globals.pl";
doMysqldump();
exit 0;
sub doMysqldump
{
ConnectToDatabase();
my $mysqldump = Param::getValueByName("mysqldump");
if ( !defined $mysqldump ) {
$mysqldump = "mysqldump";
}
my ($seconds, $minutes, $hours, $day_of_month, $month, $year,
$wday, $yday, $isdst) = localtime(time);
my $tstamp = sprintf("%04d%02d%02d%02d%02d%02d",
1900+$year, $month+1, $day_of_month, $hours, $minutes, $seconds);
my @cmd = ( $mysqldump,
"--opt",
"--host=$::DB_HOST",
"--user=$::DB_USER",
"--password=$::DB_PASS",
$::DB_NAME);
print header({
# -type=>"application/x-download",
-type=>"application/octet-stream",
-attachment=>"tracker_backup_$tstamp.sql"},
);
system(@cmd);
}