For anyone interested :
In file ( Line 158 ) :
/var/www/imscp/engine/backup/imscp-backup-all
After :
Code
- sub backupDatabases
- {
- my ($mainDmnId, $bkpDir, $cmpAlgo, $cmpLevel, $user, $group) = @_;
- my $db = iMSCP::Database->factory( );
- my $data = $db->doQuery(
- 'sqld_name', 'SELECT sqld_id, sqld_name FROM sql_database WHERE domain_id = ?', $mainDmnId
- );
- unless (ref $data eq 'HASH') {
- error( $data );
- return 1;
- }
- for my $dbName(keys %{$data}) {
- local $@;
- eval { $db->dumpdb( $dbName, $bkpDir ); };
- next if $@;
Add these lines :
Code
- my $bkpDate = strftime "%Y-%m-%d", localtime;
- my @cmd_mv = 'mv '.$bkpDir.'/'.$dbName . '.sql ' . $bkpDir.'/'.$dbName.'-'.$bkpDate.'.sql';
- my $rs_mv = execute( "@cmd_mv", \my $stdout_mv, \my $stderr_mv);
- debug( $stdout_mv ) if $stdout_mv;
- error( sprintf( "Couldn't mv %s database dump: %s", $dbName, $stderr_mv || 'Unknown error' ) ) if $rs_mv