deploy_advanced_cache() fails to save because Wordpress Filesystem API is not used #56
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
deploy_advanced_cache() fails to save on my Wordpress server setup because the Wordpress Filesystem API is not used.
https://codex.wordpress.org/Filesystem_API
Specifically, in my scenario the user under which the apache webservice runs does not have permissions to write to /wp-content and, of course, the needed advanced-cache.php file.
This scenario setup is a hardened setup. Wordpress fully supports this and abstracts away the problem by using the Wordpress Filesystem APIs. On my servers, I have configured Wordpress to allow a different user "wpadmin" to write to files/directories. This wpadmin user can do so using SSH2 and this is transparent after the initial wordpress config. https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants
I see in your code you often use file_put_contents(). In many of those location, it should be replaced with the Wordpress Filesystem API. This will then allow transparent file saves for php/config files in all situations (non-hardened, hardened, ftp, ssh2, etc.).
I've forked and have some code already working. I'll send pull request when ready.
Work in progress at https://github.com/diablodale/wp-ffpc/commits/wpfilesystem
Currently testing ok. Need to fix a minor admin notice UI issue.