{"id":12761013,"date":"2020-04-30T20:55:58","date_gmt":"2020-04-30T20:55:58","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/block-file-write\/"},"modified":"2020-04-30T20:57:17","modified_gmt":"2020-04-30T20:57:17","slug":"block-file-write","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/block-file-write\/","title":{"rendered":"Block file write"},"content":{"rendered":"<p>First of all, congratulations for the job with the plugin. It is a really good all in one performance WordPress toolkit.<\/p>\n<p>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&#8217;m not against about that. But in my case, this broke my capability to version the code.<\/p>\n<p>To solve that I write some piece of code that undo the write made by W3TC.<\/p>\n<pre><code>\n\/**\n * Add action to undo the mechanism that generate automatically the nginx.conf\n * and the WP_CACHE definition to wp-config.php\n *\/\nfunction w3tc_admin_init() {\n\tglobal $pagenow, $wp_config_backup;\n\n\t$is_w3tc_page = \\W3TC\\Util_Admin::is_w3tc_admin_page();\n\n\tif (\n\t\t&#039;plugins.php&#039; === $pagenow ||\n\t\t$is_w3tc_page ||\n\t\tisset( $_REQUEST[&#039;w3tc_note&#039;] ) ||\n\t\tisset( $_REQUEST[&#039;w3tc_error&#039;] ) ||\n\t\tisset( $_REQUEST[&#039;w3tc_message&#039;] )\n\t) {\n\t\t$config_path = \\W3TC\\Util_Environment::wp_config_path();\n\t\t$wp_config_backup = @file_get_contents( $config_path );\n\n\t\tadd_action( &#039;admin_notices&#039;, &#039;odiario_w3tc_undo_filesystem_changes&#039;, 20 );\n\t}\n}\nadd_action( &#039;admin_init&#039;, &#039;w3tc_admin_init&#039; );\n\nfunction w3tc_undo_filesystem_changes() {\n\tglobal $wp_config_backup;\n\n\t@unlink(\\W3TC\\Util_Rule::get_minify_rules_core_path());\n\n\ttry {\n\t\t$config_path = \\W3TC\\Util_Environment::wp_config_path();\n\t\t\\W3TC\\Util_WpFile::write_to_file( $config_path, $wp_config_backup );\n\t} catch(Exception $e) {}\n}<\/code><\/pre>\n<p>I don&#8217;t think a good solution because I continue receiving notices to update the code and restart the web server.<\/p>\n<p>My request is a flag that skip the file write system. Is this makes sense to the project?<\/p>\n","protected":false},"template":"","class_list":["post-12761013","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12761013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":2,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12761013\/revisions"}],"predecessor-version":[{"id":12761019,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12761013\/revisions\/12761019"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12761013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}