-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestore.php
34 lines (34 loc) · 995 Bytes
/
Restore.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
<?php
namespace FreePBX\modules\Allowlist;
use FreePBX\modules\Backup as Base;
class Restore Extends Base\RestoreBase{
public function runRestore(){
$configs = $this->getConfigs();
$this->deleteOldData();
// foreach($configs['data'] as $item){
// if(empty($item['number'])){
// continue;
// }
// $this->FreePBX->Allowlist->numberAdd($item);
// }
$this->importAstDB($configs['data']);
$this->importFeatureCodes($configs['features']);
}
public function processLegacy($pdo, $data, $tables, $unknownTables){
$astdb = $data['astdb'];
if(!isset($astdb['allowlist'])){
return $this;
}
$this->deleteOldData();
foreach($astdb['allowlist'] as $number => $desc){
$this->FreePBX->Allowlist->numberAdd(['number' => $number, 'description' => $desc]);
}
$this->restoreLegacyFeatureCodes($pdo);
}
public function deleteOldData(){
$this->astman = $this->FreePBX->astman;
if ($this->astman->connected()) {
$this->astman->database_deltree('allowlist');
}
}
}