Tiger_Media_Storage_Filesystem
@api· implementsTiger_Media_Storage_Interface
Tiger_Media_Storage_Filesystem — local-disk media storage.
Two roots (both resolved relative to APPLICATION_ROOT so config stays portable):
- PUBLIC files under the docroot (
public_root, e.g. public/_media) → served directly atpublic_urlwith no PHP in the path. - PRIVATE files OUTSIDE the docroot (
private_root, e.g. storage/media) → not web-reachable; url() returns '' so the media layer streams them through the ACL-checked /media/file/route.
Keys are relative paths; the adapter refuses .. traversal.
Methods
__construct()
__construct(array $config)
Resolve the public/private roots and public URL base from the disk config.
$configarray— themedia.disks.<name>.*settings
put()
put($key, $sourcePath, $visibility, $mime = null)
Store bytes from a source file path (copies the file to its target).
$keystring— the adapter-relative storage key$sourcePathstring— the source file on disk to copy from$visibilitystring— public|private$mime?string— the content MIME type (unused by this adapter)
Throws RuntimeException — when the target can't be written
write()
write($key, $bytes, $visibility, $mime = null)
Store raw bytes to the target file.
$keystring— the adapter-relative storage key$bytesstring— the raw bytes to store$visibilitystring— public|private$mime?string— the content MIME type (unused by this adapter)
Throws RuntimeException — when the target can't be written
get()
get($key, $visibility)
Read all bytes of a file.
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns string — the file's bytes
Throws RuntimeException — when the file is not found
stream()
stream($key, $visibility)
Open a read stream for a file.
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns resource — a readable file handle
Throws RuntimeException — when the file is not found
delete()
delete($key, $visibility)
Remove a file (idempotent — a missing file is not an error).
$keystring— the adapter-relative storage key$visibilitystring— public|private
exists()
exists($key, $visibility)
Does the file exist?
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns bool — true when the file exists
size()
size($key, $visibility)
Size of a file in bytes (0 if missing).
$keystring— the adapter-relative storage key$visibilitystring— public|private
Returns int — the file size in bytes, or 0 if missing
url()
url($key, $visibility, $ttl = null)
A directly-usable URL for a file (a docroot URL for public; '' for private).
$keystring— the adapter-relative storage key$visibilitystring— public|private$ttl?int— unused by this adapter (no signed URLs)
Returns string — a public URL, or '' when the app must stream the bytes itself