[Plugin: WP Super Cache] Howto drop write permissions for wp-content
-
Playing around with wp cache and now with wp supercache (nice plugin!) I noticed that it needs file write permissions on wp-content for changing settings. This is – from my point of view – not necessary so I wrote a patch to change the behaviour:
--- wp-cache.php.orig 2008-04-02 13:10:18.000000000 +0200 +++ wp-cache.php 2008-04-02 13:23:14.000000000 +0200 @@ -25,7 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -$wp_cache_config_file = ABSPATH . 'wp-content/wp-cache-config.php'; +$wp_cache_config_file_rel = 'wp-content/wp-cache-config.php'; +$wp_cache_config_file = ABSPATH . $wp_cache_config_file_rel; if( !@include($wp_cache_config_file) ) { get_wpcachehome(); @@ -65,7 +66,7 @@ } function wp_cache_manager() { - global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world; + global $wp_cache_config_file_rel, $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world; if( function_exists( 'is_site_admin' ) ) if( !is_site_admin() ) @@ -130,14 +131,14 @@ <p>It appears that mod_rewrite is not installed. Sometimes this check isn't 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files. You will still be able to use WP-Cache.</p><?php } - if( !is_writeable( ABSPATH . 'wp-content/' ) || !is_writable($wp_cache_config_file) ) { + if( !is_writable( $wp_cache_config_file) ) { define( "SUBMITDISABLED", 'disabled style="color: #aaa" ' ); ?><h4 style='color: #a00'>Read Only Mode. Configuration cannot be changed. <a href="javascript:toggleLayer('readonlywarning');" title="Why your configuration may not be changed">Why</a></h4> <div id='readonlywarning' style='border: 1px solid #aaa; margin: 2px; padding: 2px; display: none;'> - <p>The WP Super Cache configuration file is <code><?php echo ABSPATH ?>wp-content/wp-cache-config.php</code> and cannot be modified. The wp-content directory and wp-cache-config.php file must be writeable by the webserver to make any changes.<br /> + <p>The WP Super Cache configuration file is <code><?php echo $wp_cache_config_file_rel ?></code> and cannot be modified. The wp-cache-config.php file must be writeable by the webserver to make any changes.<br /> A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it's globally writeable and it should be fine.<br /> - Writeable: <code>chmod 777 wp-content; chmod 666 wp-content/wp-cache-config.php</code><br /> - Readonly: <code>chmod 755 wp-content; chmod 644 wp-content/wp-cache-config.php</code></p> + Writeable: <code>chmod 666 wp-content/wp-cache-config.php</code><br /> + Readonly: <code>chmod 644 wp-content/wp-cache-config.php</code></p> </div><?php } else { define( "SUBMITDISABLED", ' ' );Now wp-content can be readonly as long as wp-content/wp-cache-config.php and wp-content/cache/ are writeable.
I posted it here as I did not find any bug tracking system for this plugin.
Best Regards
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘[Plugin: WP Super Cache] Howto drop write permissions for wp-content’ is closed to new replies.