Block file write
-
First of all, congratulations for the job with the plugin. It is a really good all in one performance WordPress toolkit.
I work with versioned code and Docker to run the development environment. And I have issues with the way as the plugin work to apply the settings writing on the config files. I’m not against about that. But in my case, this broke my capability to version the code.
To solve that I write some piece of code that undo the write made by W3TC.
/** * Add action to undo the mechanism that generate automatically the nginx.conf * and the WP_CACHE definition to wp-config.php */ function w3tc_admin_init() { global $pagenow, $wp_config_backup; $is_w3tc_page = \W3TC\Util_Admin::is_w3tc_admin_page(); if ( 'plugins.php' === $pagenow || $is_w3tc_page || isset( $_REQUEST['w3tc_note'] ) || isset( $_REQUEST['w3tc_error'] ) || isset( $_REQUEST['w3tc_message'] ) ) { $config_path = \W3TC\Util_Environment::wp_config_path(); $wp_config_backup = @file_get_contents( $config_path ); add_action( 'admin_notices', 'odiario_w3tc_undo_filesystem_changes', 20 ); } } add_action( 'admin_init', 'w3tc_admin_init' ); function w3tc_undo_filesystem_changes() { global $wp_config_backup; @unlink(\W3TC\Util_Rule::get_minify_rules_core_path()); try { $config_path = \W3TC\Util_Environment::wp_config_path(); \W3TC\Util_WpFile::write_to_file( $config_path, $wp_config_backup ); } catch(Exception $e) {} }
I don’t think a good solution because I continue receiving notices to update the code and restart the web server.
My request is a flag that skip the file write system. Is this makes sense to the project?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Block file write’ is closed to new replies.