mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
FIX: mysql dump gzip is on
This commit is contained in:
parent
3d58ada608
commit
c9107fe581
@ -14,6 +14,7 @@ class DumpMySQL extends BuildTask
|
||||
|
||||
public function run($request)
|
||||
{
|
||||
$fileName = 'backup-'.date('d-m-Y').'.sql';
|
||||
$cfg = DB::getConfig();
|
||||
|
||||
try {
|
||||
@ -21,7 +22,15 @@ class DumpMySQL extends BuildTask
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
header('Content-Disposition: attachment; filename="backup-'.date('d-m-Y').'.sql"');
|
||||
// check if gzip is on
|
||||
try {
|
||||
if (count(array_intersect(['mod_deflate', 'mod_gzip'], apache_get_modules())) > 0) {
|
||||
$fileName .= '.gz';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
header('Content-Disposition: attachment; filename="'.$fileName.'"');
|
||||
passthru('mysqldump -u '.$cfg['username'].' --password="'.$cfg['password'].'" '.$cfg['database']);
|
||||
exit(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user