public function backupDB($current_time)
{
$this->dbConnections();
$destination = backup_path() . "/backup/db/";
// Clean the backup directory, before making any backup
File::cleanDirectory(backup_path());
File::makeDirectory(backup_path() . "/backup");
File::makeDirectory($destination);
$backup_filename = 'database_backup.sql';
$path = \Setting::value('mysqldump_path', 'mysqldump');
if (false) {
if ($this->password == '') {
//without password
$command = $path . " -u " . $this->username . " " . $this->database . " > " . $destination . $backup_filename;
} else {
//with password
$command = $path . " -u " . $this->username . " -p " . $this->password . " " . $this->database . " > " . $destination . $backup_filename;
}
system($command);
} else {
$this->backupTables($this->host, $this->username, $this->password, $this->database, $destination . $backup_filename);
}
}