-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRestore.php
More file actions
27 lines (27 loc) · 814 Bytes
/
Restore.php
File metadata and controls
27 lines (27 loc) · 814 Bytes
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\Systemadmin;
use FreePBX\modules\Backup as Base;
class Restore Extends Base\RestoreBase{
public function runRestore(){
$configs = $this->getConfigs();
$this->importTables($configs['tables']);
$dbh = \FreePBX::Database();
$sql = "TRUNCATE TABLE systemadmin_packetcapture";
$stmt = $dbh->prepare($sql);
$stmt->execute();
if(!empty($configs['settings'])) {
$this->importAdvancedSettings($configs['settings']);
}
$files = $this->getFiles();
foreach ($files as $file) {
$filename = $file->getPathTo().'/'.$file->getFilename();
$source = $this->tmpdir.'/files'.$file->getPathTo().'/'.$file->getFilename();
$dest = $filename;
$test = $file->getPathTo();
if(file_exists($source)){
@mkdir($dest,0755,true);
@copy($source, $dest);
}
}
}
}