-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathBackup.php
27 lines (23 loc) · 973 Bytes
/
Backup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace FreePBX\modules\Cdr;
use FreePBX\modules\Backup as Base;
class Backup Extends Base\BackupBase{
public function runBackup($id,$transaction){
$dumpOtherOptions = [];
$backupDetails = $this->FreePBX->Backup->getAll($id);
if (isset($backupDetails['cdrStartDate']) && isset($backupDetails['cdrEndDate'])) {
$startDate = $backupDetails['cdrStartDate'];
$endDate = $backupDetails['cdrEndDate'];
$query = 'calldate between "'.$startDate.'" and "'.$endDate.'"';
$dumpOtherOptions[] = " --where='" . $query."'";
}
$dumpOtherOptions[] = '--opt --compact --skip-lock-tables --skip-triggers --no-create-info';
$dumpOtherOptions = implode(" ", $dumpOtherOptions);
$fileObj = $this->dumpTableIntoFile('cdr','cdr', $dumpOtherOptions, true);
$this->addDirectories([$fileObj->getPath()]);
$this->addConfigs([
'settings' => $this->dumpAdvancedSettings(),
'kvstore' => $this->dumpKVStore()
]);
}
}