-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathBackup.php
35 lines (35 loc) · 1.24 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
34
35
<?php
namespace FreePBX\modules\Contactmanager;
use FreePBX\modules\Backup as Base;
class Backup Extends Base\BackupBase{
public function runBackup($id,$transaction){
$this->addDependency('userman');
//contactmanger internal contacts are userman users and this is the table which links them
$sql = "SELECT * FROM contactmanager_group_entries WHERE user !='-1'";
$db = \FreePBX::Database();
$sth = $db->prepare($sql);
$sth->execute();
$res = $sth->fetchAll(\PDO::FETCH_ASSOC);
$contactmanager_group_entries = array();
foreach($res as $dat) {
$contactmanager_group_entries[] = $dat;
}
$sql = "SELECT * FROM contactmanager_groups WHERE `type`='internal' ";
$db = \FreePBX::Database();
$sth = $db->prepare($sql);
$sth->execute();
$res = $sth->fetchAll(\PDO::FETCH_ASSOC);
$contactmanager_groups = array();
foreach($res as $data) {
$contactmanager_groups[] = $data;
}
$this->addConfigs([
'data' => $this->FreePBX->Contactmanager->bulkHandlerExport('contacts'),
'kvstore' => $this->dumpKVStore(),
'features' => $this->dumpFeatureCodes(),
'settings' => $this->dumpAdvancedSettings(),
'contactmanager_group_entries' => $contactmanager_group_entries,
'contactmanager_groups' => $contactmanager_groups
]);
}
}