Skip to content
Snippets Groups Projects
Commit b772b1b2 authored by Till Brehm's avatar Till Brehm
Browse files

Implemented #5303 database Backup including routines

parent c6bf185c
No related branches found
No related tags found
No related merge requests found
......@@ -225,6 +225,11 @@ class cronjob_backup extends cronjob {
if(is_array($records)) {
include '/usr/local/ispconfig/server/lib/mysql_clientdb.conf';
//* Check mysqldump capabilities
exec('mysqldump --help',$tmp);
$mysqldump_routines = (strpos(implode($tmp),'--routines') !== false)?'--routines':'';
unset($tmp);
foreach($records as $rec) {
......@@ -252,7 +257,7 @@ class cronjob_backup extends cronjob {
$db_name = $rec['database_name'];
$db_backup_file = 'db_'.$db_name.'_'.date('Y-m-d_H-i').'.sql';
//$command = "mysqldump -h '".escapeshellcmd($clientdb_host)."' -u '".escapeshellcmd($clientdb_user)."' -p'".escapeshellcmd($clientdb_password)."' -c --add-drop-table --create-options --quick --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
$command = "mysqldump -h ".escapeshellarg($clientdb_host)." -u ".escapeshellarg($clientdb_user)." -p".escapeshellarg($clientdb_password)." -c --add-drop-table --create-options --quick --max_allowed_packet=512M --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
$command = "mysqldump -h ".escapeshellarg($clientdb_host)." -u ".escapeshellarg($clientdb_user)." -p".escapeshellarg($clientdb_password)." -c --add-drop-table --create-options --quick --max_allowed_packet=512M ".$mysqldump_routines." --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
exec($command, $tmp_output, $retval);
//* Compress the backup with gzip / pigz
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment