UploadsSize final readonly class
Minn\Admin\UploadsSize · public/minn/src/Minn/Admin/UploadsSize.php · 93 lines
How much the uploads folder holds, as Minn Admin 0.43 works it out and shares it through the minn_admin_uploads_size transient: the cached figure in either shape it has had ({bytes, partial}, or a bare count from before the budget), else a walk only an administrator may start, one at a time behind a two-minute lock, stopped after four seconds and kept as partial for an hour instead of twelve.
Constants and properties
| private | CACHE = '_transient_minn_admin_uploads_size' | |
| private | EXPIRES = '_transient_timeout_minn_admin_uploads_size' | |
| private | LOCK = 'minn_admin_uploads_size_lock' | |
| private | BUDGET = 4.0 | |
| private | readonly Minn\Content\Site $site | Promoted from the constructor. |
| private | readonly Minn\Auth\Capabilities $capabilities | Promoted from the constructor. |
| private | readonly string $dir | Promoted from the constructor. |
Public
| new | __construct(Minn\Content\Site $site, Minn\Auth\Capabilities $capabilities, string $dir)# | |
| method | label(int $userId): string# | The Media card's "N used" line, "over N used" for a walk cut short, or "" when the size is not known. |
| method | measure(int $userId): ?array# | The uploads size, cached or walked now. @return array{bytes: int, partial: bool}|null null when nothing is known and this caller may not find out |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.