Hi,
to make downloading of backups more easy it is helpful, if the date of the backup is attached to the sql-backup like it is for the htdocs backup as well.
I did three little changes in /var/www/imscp/engine/backup/imscp-backup-all may be you could make them official part of the script:
Shell-Script: /var/www/imscp/engine/backup/imscp-backup-all
- # Backup all customer databases
- if ($canDumpDatabases && $rdata->{$_}->{'allowbackup'} ~~ ['full', 'sql']) {
- my $dbData = $db->doQuery(
- 'sqld_name',
- "SELECT sqld_id, sqld_name FROM sql_database WHERE domain_id = ?",
- $rdata->{$_}->{'domain_id'}
- );
- unless (ref $dbData eq 'HASH') {
- error($dbData);
- $ret ||= 1;
- next;
- }
- for (keys %{$dbData}) {
- $rs = $db->dumpdb($_, "$bkpDir/$_-$date.sql");
- if($rs) {
- $ret ||= $rs;
- next;
- }
- my $file = iMSCP::File->new(filename => "$bkpDir/$_-$date.sql");
- $rs = $file->mode(0644);
- $ret ||= $rs;
- $rs = $file->owner($userName, $groupName);
- $ret ||= $rs;
- if($algorithm ne 'no') {
- my @cmd = (
- $main::imscpConfig{$command->{$algorithm}->{'command'}},
- '--force',
- escapeShell("$bkpDir/$_-$date.sql")
- );
- $rs = execute("@cmd", \$stdout, \$stderr);
- debug($stdout) if $stdout;
- error($stderr) if $stderr && $rs;
- error("Unable to compress the $_ database dump file") if $rs && ! $stderr;
- $ret ||= $rs;
- }
- }
- }
The only change is to add -$date to the three times where $bkpDir/$_.sql occurs, so that it is $bkpDir/$_-$date.sql.
regards,
thoand