-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup_files_old.php
More file actions
32 lines (29 loc) · 1.36 KB
/
backup_files_old.php
File metadata and controls
32 lines (29 loc) · 1.36 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
<?php
foreach ($directories as $dkey => $dvalue) {
$directories[$dkey] = array(
"PackagePath" => $projectPrefix.'/'.$directories[$dkey].'/',
"ProjectPath" => $BackupLocation.$directories[$dkey]."/*"
);
}
foreach ($files as $fkey => $fvalue) {
$filePath[$fkey] = array(
'PackagePath' => $projectPrefix.'/'.$files[$fkey]['PackageDir'],
'ProjectPath' => $BackupLocation.$files[$fkey]['ProjectDir']
);
}
$zip = new ZipArchive();
$task = $zip->open($archiveName, ZipArchive::CREATE);
if ($task === TRUE) {
foreach ($directories as $dkey => $value) {
$options = array('add_path' => $directories[$dkey]['PackagePath'], 'remove_all_path' => TRUE);
$zip->addGlob($directories[$dkey]['ProjectPath'], 0, $options);
}
foreach ($files as $fkey => $fvalue) {
$options = array('add_path' => $filePath[$fkey]['PackagePath'], 'remove_all_path' => TRUE);
$zip->addGlob($filePath[$fkey]['ProjectPath'], 0, $options);
}
$zip->close();
$output .= '<div class="alert-success">Datei-Backup erstellt.<br>Der Dateiname ist '.$archiveName.'</div>';
}
else {$output .= '<div class="alert-danger">Datei-Backup erstellt</div>';}
?>