Aggregation sometimes tries to delete non-existing directories

Created on 13 July 2023, 12 months ago
Updated 18 April 2024, 2 months ago

Problem/Motivation

Opening as minor because it's a log annoyance but a few people have noticed it, e.g. #3301573-52: Remove the aggregate stale file threshold and state entry β†’ and #3369979-45: Drupal 10.1 breaks Bootstrap β†’ .

 vendor/bin/drush cr
 [notice] The file assets://css was not deleted because it does not exist.
 [notice] The file assets://js was not deleted because it does not exist.

in < 10.1, we used to iterate over the files in those directories and run a callback to delete the files or not.

Now we can just remove all files in the directories, but ::deleteRecursive() logs a notice if a directory doesn't exist that you're trying to delete. This could happen if you drush cr multiple times without visiting an HTML page for example.

Steps to reproduce

Proposed resolution

If this method is called and the directory is already empty, we don't need to empty it again, so we could just check file_exists() - even if there's a race condition and another process created the directory immediately after our file_exists() check, that's no different to if they'd tried to create the directory immediately after we'd attempted to delete the non-existent one.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
Asset libraryΒ  β†’

Last updated 2 days ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024