You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create missing parent folders for the file rate limiter path #585
FileRateLimitAdapter creates its storage folder with a non-recursive mkdir. When the configured path points to a folder whose parent does not exist, every request that goes through the rate limit middleware fails with a 500.
Current state (checked on master)
FileRateLimitAdapter::__construct() calls $this->fs->makeDirectory($this->path) when path is not a directory (src/RateLimit/Adapters/FileRateLimitAdapter.php:46).
LocalFileSystemAdapter::makeDirectory() returns mkdir($dirname), which does not create parent folders (src/Storage/Adapters/Local/LocalFileSystemAdapter.php:27).
ViewCache already creates its folder recursively: mkdir($this->cacheDir, 0777, true) (src/ResourceCache/ViewCache.php:68).
Create the whole path in FileRateLimitAdapter, with a recursive mkdir as ViewCache does. Nothing else changes: the shared makeDirectory() contract, which also has the Dropbox and Google Drive adapters, stays as it is.
Breaking changes
None. A path that already exists, or whose parent exists, behaves exactly as before.
Tests (first)
In FileRateLimitAdapterTest: construct the adapter with a path whose parent folders do not exist and assert that the full path is created. Red on master, green after the change.
Acceptance criteria
Constructing FileRateLimitAdapter with a path that has missing parents creates the whole path.
The existing rate limiter tests pass unchanged.
composer test, composer cs:check and composer phpstan pass.
Out of scope
Making LocalFileSystemAdapter::makeDirectory() recursive for all callers (CronLock, ModuleManager, the console commands). That changes a shared primitive and needs its own decision.
Throwing a clear error when the folder cannot be created at all (for example, permissions).
Activity
[#585] Create missing parent folders for the file rate limiter path