New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't remove static files if automated static files are turned off #14228
Conversation
} | ||
|
||
/* Check if parent directory is empty, if so remove parent directory. */ | ||
$pathinfo = pathinfo($this->staticFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$pathinfo = pathinfo($this->staticFilePath); | |
$dirname = pathinfo($this->staticFilePath, PATHINFO_DIRNAME); |
/* Check if parent directory is empty, if so remove parent directory. */ | ||
$pathinfo = pathinfo($this->staticFilePath); | ||
|
||
if (!empty($pathinfo['dirname'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it would make more sense to check for things like this in the cleanupStaticDirectories
method to prevent code duplication.
$pathinfo = pathinfo($this->staticFilePath); | ||
|
||
if (!empty($pathinfo['dirname'])) { | ||
$this->cleanupStaticDirectories($pathinfo['dirname']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->cleanupStaticDirectories($pathinfo['dirname']); | |
$this->cleanupStaticDirectories($dirname); |
@JoshuaLuckers I agree with your review, but code changes that are not bugfixes should be done in 3.x. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…4228 * upstream/pr/14228: Don't remove static files if automated static files are turned off
This really fixes the issue where old static files where removed even if the automate static files system setting was turned off for that element type. It was only partly fixed in #14208, which added a check for removing the file, when the static file path was changed.
What does it do?
A check for the automatic static files system setting is added to the modElementRemoveProcessor class.
Related issue(s)/PR(s)
Issue: #14206, #140206
PR that created the issue: #14135