-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
executable file
·45 lines (35 loc) · 946 Bytes
/
example.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
36
37
38
39
40
41
42
43
44
45
<?php
include('backup.php');
/* backup array structure
$backup_array = array (
'absolute_path' => 'folder_path_in_zip'
);
example:
$backup_array = array (
'/home/user/public_html/example/index.php' => 'index.php'
'/home/user/public_html/example/folder/index.php' => 'folder/index.php'
);
*/
$backup_array = array ();
global $backup_core;
$backup_core = new SYNC_Backup();
$zipfile = 'first.zip';
$zip = new $backup_core->use_zip_object;
if (file_exists($zipfile)) {
$opencode = $zip->open($zipfile);
$original_size = filesize($zipfile);
clearstatcache();
} else {
$create_code = (version_compare(PHP_VERSION, '5.2.12', '>') && defined('ZIPARCHIVE::CREATE')) ? ZIPARCHIVE::CREATE : 1;
$opencode = $zip->open($zipfile, $create_code);
$original_size = 0;
}
foreach ($backup_array as $file => $add_as) {
@touch($zipfile);
$zip->addFile($file, $add_as);
}
if ($zip->close()) {
echo 'success';
}else{
echo "failure";
}