forked from FreePBX/recordings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Backup.php
32 lines (32 loc) · 969 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
28
29
30
31
32
<?php
namespace FreePBX\modules\Recordings;
use FreePBX\modules\Backup as Base;
class Backup Extends Base\BackupBase{
public function runBackup($id,$transaction){
$dirs = [];
$base = $this->FreePBX->Config->get('ASTVARLIBDIR');
$recs = $this->FreePBX->Recordings->getAll();
foreach($recs as $rec){
foreach($rec['files'] as $file){
foreach($file as $key => $value){
$basefilepath = $base.'/sounds/'.$key.'/';
foreach($value as $recordingfile){
if(!file_exists($basefilepath.$recordingfile)){
continue;
}
$dirpaths = pathinfo($basefilepath.$recordingfile);
$path = $dirpaths['dirname'];
$dirs[$path] = $path;
$this->addFile(basename($recordingfile),$path,'ASTVARLIBDIR',"recording");
}
}
}
}
$this->addDirectories($dirs);
$this->addDependency('soundlang');
$this->addConfigs([
'data' => $this->FreePBX->Recordings->getAll(),
'features' => $this->dumpFeatureCodes()
]);
}
}