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
Bug fix where static files are removing if automated static files are turned off #14208
Conversation
…ng old empty static files
What happens if you select the wrong file by accident (like index.php), save it and change it to the correct file afterwards? Is it possible to have those files move to a "trash folder" instead of deleting them from the filesystem immediately? |
@JoshuaLuckers I don't think a trash folder is necessary. If you set up your static file structure correctly the source does not have access to files such as index.php |
core/model/modx/modelement.class.php
Outdated
break; | ||
} | ||
|
||
return (bool) $this->xpdo->getOption('static_elements_automate_' . $type, null, false); |
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.
What is type
is an empty string? In this case, all times will be called wrong setting. Make sense fetch setting value only when the type is defined.
I tested this PR (reproduced from #14206 (comment)) for setting When this settings as Yes - previous static file removed from file system. |
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.
I tested the following with static_elements_automate_*
turned off:
- If I change the static file for an element the old file is not deleted (good).
- If I delete an element that uses a static file the static file is deleted (not good).
@JoshuaLuckers Your issue should be fixed with #14228. But this PR covers another part. |
This fixes the issue where old static files where removed even if the automate static files system setting was turned off for that element type.
What does it do?
I've added a system setting check that checks if static files are automated for the current element type.
Related issue(s)/PR(s)
Issue: #14206
PR that created the issue: #14135