Fiabilise les médias et la navigation mobile

This commit is contained in:
Alexandre NOEL 2026-09-08 22:28:01 +02:00
commit 5909f55aba
12 changed files with 266 additions and 19 deletions

View file

@ -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