first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// PHP program to delete all
|
||||
// file from a folder
|
||||
|
||||
// Folder path to be flushed
|
||||
$folder_path = "../../tempzip";
|
||||
|
||||
// List of name of files inside
|
||||
// specified folder
|
||||
$files = glob($folder_path.'/*');
|
||||
|
||||
// Deleting all the files in the list
|
||||
foreach($files as $file) {
|
||||
|
||||
if(is_file($file))
|
||||
|
||||
// Delete the given file
|
||||
unlink($file);
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// Archivia in ZIP la cartella modulo_certificazione (backup)
|
||||
// NB: il vecchio blocco di dump database è stato rimosso perché conteneva
|
||||
// credenziali in chiaro ed era disattivato. Se serve un dump DB,
|
||||
// usare mysqldump o un comando artisan dedicato.
|
||||
|
||||
ignore_user_abort(true);
|
||||
set_time_limit(3600);
|
||||
|
||||
$main_path = '../modulo_certificazione';
|
||||
$zip_file = '../tempbck//cimac.tar';
|
||||
|
||||
if (file_exists($main_path) && is_dir($main_path)) {
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if (file_exists($zip_file)) {
|
||||
unlink($zip_file); // truncate ZIP
|
||||
}
|
||||
if ($zip->open($zip_file, ZIPARCHIVE::CREATE) !== TRUE) {
|
||||
die("cannot open <$zip_file>\n");
|
||||
}
|
||||
|
||||
$files = 0;
|
||||
$paths = array($main_path);
|
||||
|
||||
while (list(, $path) = each($paths)) {
|
||||
foreach (glob($path . '/*') as $p) {
|
||||
if (is_dir($p)) {
|
||||
$paths[] = $p;
|
||||
} else {
|
||||
$zip->addFile($p);
|
||||
$files++;
|
||||
echo $p . "<br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo 'Total files: ' . $files;
|
||||
$zip->close();
|
||||
}
|
||||
Reference in New Issue
Block a user