forked from FreePBX-ContributedModules/endpointman
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBackup.php
33 lines (31 loc) · 1.11 KB
/
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
33
<?php
namespace FreePBX\modules\Endpointman;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use FreePBX\modules\Backup as Base;
class Backup Extends Base\BackupBase{
public function runBackup($id,$transaction){
/*
$this->addConfigs([
'data' => $this->FreePBX->Endpointman->getCategories(),
'settings' => $this->dumpAdvancedSettings()
]);
*/
$dirs = [];
$varlibdir = $this->FreePBX->Endpointman->PHONE_MODULES_PATH;
$iterator = new RecursiveDirectoryIterator($varlibdir.'endpoint',RecursiveDirectoryIterator::SKIP_DOTS);
foreach (new RecursiveIteratorIterator($iterator) as $file) {
$dirs[] = $file->getPath();
$this->addFile($file->getBasename(),$file->getPath(),'',"endpoint");
}
$iterator = new RecursiveDirectoryIterator($varlibdir.'temp',RecursiveDirectoryIterator::SKIP_DOTS);
foreach (new RecursiveIteratorIterator($iterator) as $file) {
$dirs[] = $file->getPath();
$this->addFile($file->getBasename(),$file->getPath(),'',"temp");
}
$this->addDirectories(array_unique($dirs));
$this->addConfigs([
'settings' => $this->dumpAdvancedSettings()
]);
}
}