1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-06-05 22:09:38 +02:00

Aggiunti controllo sui permessi all'aggiornamento

This commit is contained in:
Thomas Zilio
2021-10-18 10:24:02 +02:00
parent 1f141a5dc9
commit 5955aeeb97
2 changed files with 21 additions and 7 deletions

View File

@@ -25,6 +25,10 @@
use HTMLBuilder\HTMLBuilder;
use Models\OperationLog;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;
use Symfony\Component\Finder\Finder;
use Util\FileSystem;
/**
* Esegue il redirect.
@@ -71,12 +75,12 @@ function sanitizeFilename($filename)
function delete($files)
{
// Filesystem Symfony
$fs = new Symfony\Component\Filesystem\Filesystem();
$fs = new SymfonyFilesystem();
// Eliminazione
try {
$fs->remove($files);
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
} catch (IOException $e) {
return false;
}
@@ -110,7 +114,7 @@ function copyr($source, $destination, $ignores = [])
return false;
}
$files = Symfony\Component\Finder\Finder::create()
$files = Finder::create()
->files()
->exclude((array) $ignores['dirs'])
->ignoreDotFiles(false)
@@ -124,14 +128,17 @@ function copyr($source, $destination, $ignores = [])
$result = true;
// Filesystem Symfony
$fs = new Symfony\Component\Filesystem\Filesystem();
$fs = new SymfonyFilesystem();
$fs->chmod($destination, 0777, 0000, true);
foreach ($files as $file) {
$filename = rtrim($destination, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file->getRelativePathname();
// Copia
// Copia effettiva del file
try {
$fs->copy($file, $filename);
} catch (Symfony\Component\Filesystem\Exception\IOException $e) {
$fs->copy($file, $filename, true);
} catch (IOException $e) {
$result = false;
}
}