deploy_advanced_cache() fails to save because Wordpress Filesystem API is not used #56

Open
opened 2016-08-03 20:31:29 +01:00 by diablodale · 2 comments
diablodale commented 2016-08-03 20:31:29 +01:00 (Migrated from github.com)

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.).

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.).
diablodale commented 2016-08-09 02:22:00 +01:00 (Migrated from github.com)

I've forked and have some code already working. I'll send pull request when ready.

I've forked and have some code already working. I'll send pull request when ready.
diablodale commented 2016-08-11 17:37:55 +01:00 (Migrated from github.com)

Work in progress at https://github.com/diablodale/wp-ffpc/commits/wpfilesystem
Currently testing ok. Need to fix a minor admin notice UI issue.

Work in progress at https://github.com/diablodale/wp-ffpc/commits/wpfilesystem Currently testing ok. Need to fix a minor admin notice UI issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: petermolnar/wp-ffpc#56
No description provided.