Skip to content

Commit b772b1b

Browse files
author
Till Brehm
committed
Implemented #5303 database Backup including routines
1 parent c6bf185 commit b772b1b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/lib/classes/cron.d/500-backup.inc.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ public function onRunJob() {
225225
if(is_array($records)) {
226226

227227
include '/usr/local/ispconfig/server/lib/mysql_clientdb.conf';
228+
229+
//* Check mysqldump capabilities
230+
exec('mysqldump --help',$tmp);
231+
$mysqldump_routines = (strpos(implode($tmp),'--routines') !== false)?'--routines':'';
232+
unset($tmp);
228233

229234
foreach($records as $rec) {
230235

@@ -252,7 +257,7 @@ public function onRunJob() {
252257
$db_name = $rec['database_name'];
253258
$db_backup_file = 'db_'.$db_name.'_'.date('Y-m-d_H-i').'.sql';
254259
//$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."'";
255-
$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."'";
260+
$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."'";
256261
exec($command, $tmp_output, $retval);
257262

258263
//* Compress the backup with gzip / pigz

0 commit comments

Comments
 (0)