preparing admin route for db backup
This commit is contained in:
parent
950fbe1755
commit
883897ec3c
3 changed files with 516 additions and 0 deletions
23
pfosten/resources/views/admin/backup.php
Normal file
23
pfosten/resources/views/admin/backup.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
$DBUSER = $_GET["dbuser"];
|
||||
$DBPASSWD = $_GET["dbpasswd"];
|
||||
$DATABASE = $_GET["database"];
|
||||
#echo("$DBUSER, $DBPASSWD, $DATABASE");
|
||||
//http://localhost:8005/backup?dbuser=user&dbpasswd=passwd&database=db1
|
||||
|
||||
|
||||
$filename = "backup-" . date("d-m-Y") . ".sql.gz";
|
||||
echo($filename);
|
||||
$mime = "application/x-gzip";
|
||||
|
||||
header( "Content-Type: " . $mime );
|
||||
header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
|
||||
|
||||
$cmd = "mysqldump -u $DBUSER --password=$DBPASSWD $DATABASE | gzip --best";
|
||||
|
||||
passthru( $cmd );
|
||||
|
||||
exit(0);
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue