-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.php
More file actions
57 lines (49 loc) · 1.5 KB
/
update.php
File metadata and controls
57 lines (49 loc) · 1.5 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
class OnyxUpateCore {
private $path_to_upload;
private $zip;
private $status;
private static $instance = null;
public static function getInstance(){
if(!isset($_FILES['OnyxCore_update'])){
return OnyxUpdateCore::$instance;
}
if( OnyxUpdateCore::$instance === null ) {
OnyxUpdateCore::$instance = new OnyxUpdateCore();
}
return $instance;
}
private function __construct(){
$this->zip = new ZipArchive;
return $this->status;
}
private function verify_system(){
}
private function version_compare(){
}
private function load_zip(){
$tmp_path = $_FILES['update_file']['tmp_name'];
$this->path_to_upload = $tmp_path;
}
private function update(){
$res = $this->zip->open($this->path_to_upload);
if ($res === TRUE) {
$folders = array(
'admin',
'install',
'onyx'
);
foreach($folders as $folder){
$folderName = ucfirst($folder);
echo "Updating your {$folderName}'s folder";
$this->zip->extractTo(BASE_PATH, $folder);
echo ' : status <span class="status ok">OK</span><br/>';
}
$this->zip->close();
$this->status 'ok';
} else {
$this->status 'Failed to load the update file at '.$this->path_to_upload;
}
}
}
OnyxUpateCore::getInstance();