Update warning message for file system operations #2636
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update the message to indicate that WP_Filesystem should not be used for general file IO.
Description
The coding standards suggest using WP_Filesystem instead of all file-operations, which often sends developers down a path that they really shouldn't have.
This just clarifies that perhaps they shouldn't perform file operations, and to use WP_Filesystem for upgrade-routines (Which the classes are intended for).
This might get some pushback from some people who feel WP_Filesystem should be used if it exists, but it's an abstraction that applies for a constantly reducing set of sites, which run on read-only filesystems and require FTP to interact with the WordPress files.
Generally, WP_Filesystem either uses direct IO, or, FTP which requires interactive prompting, which most plugins/themes that use WP_Filesystem are not handling anyway.
I will note it's possible for WP_Filesystem to be configured with hard-coded credentials, but that's even more rare.
Pushing people onto this class just doesn't benefit anyone.
I would almost suggest that the mention of WP_Filesystem should be removed entirely, and this just be left as a "You really shouldn't do file operations if this is running often" type warning.
Suggested changelog entry
Related issues/external references
Fixes #