Fiabilise les médias et la navigation mobile
This commit is contained in:
parent
465b384c08
commit
5909f55aba
12 changed files with 266 additions and 19 deletions
|
|
@ -28,6 +28,19 @@ final class PrivateMediaService
|
|||
throw new RuntimeException(t('service.image.directory_failed'));
|
||||
}
|
||||
@chmod($dir, $mode);
|
||||
if ($public) {
|
||||
self::hardenPublicParents($dir);
|
||||
}
|
||||
}
|
||||
|
||||
private static function hardenPublicParents(string $dir): void
|
||||
{
|
||||
$mediaRoot = dirname(__DIR__, 2) . '/public/media';
|
||||
foreach ([$mediaRoot, $mediaRoot . '/animals', $dir] as $publicDir) {
|
||||
if (is_dir($publicDir)) {
|
||||
@chmod($publicDir, 0755);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function moveVisibility(int $animalId, string $filename, bool $toPublic): void
|
||||
|
|
|
|||
Loading…
Reference in a new issue