Various problems with minify on Windows server
-
I’ve been trying to test the performance gains when minifying and merging JS and CSS on a local WordPress installation running in Windows.
I came across a number of issues which were preventing any minifying from being performed.
The following message was output in the cached page.
ERROR: WP-Optimize Minify was not allowed to save its cache on –
/cache/wpo-minify/1638573497/assets/wpo-minify-header-e2081b78.min.cssI tracked this down to the logic that loads the CSS and JS files in WP_Optimize_Minify_Functions::get_asset_content().
If the server is Windows then the logic doesn’t attempt to load the file directly using file_get_contents() but uses self::download_remote().
The wp_remote_get() call was failing in my environment due to an SSL certificate problem ( error 60 ). My usual workaround for this is to set sslverify to false.
For this problem I found it easier to change server_is_windows() to return false.
Then the code worked correctly for me.There was another issue in the get_file_size() function.
The last array value of $possible_urls was incorrect.includes_url() => ABSPATH . '/' . WPINC,
I resolved the issue by changing it to:
`includes_url() => ABSPATH . WPINC . ‘/’,
This problem was also the cause of a Notice when WP_DEBUG is true. $file was not set on line 1112.
Having made these changes I am now able to make progress with locally testing performance improvements using Minify.
How do I go about getting these fixes applied? Is there a GitHub repo where I can create a Pull Request?
- The topic ‘Various problems with minify on Windows server’ is closed to new replies.