• Resolved bobbingwide

    (@bobbingwide)


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

    I 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?

    • This topic was modified 3 years, 3 months ago by bobbingwide. Reason: Correct ssl_verify to sslverify
Viewing 3 replies - 1 through 3 (of 3 total)
  • @bobbingwide Thanks for sharing the fix, I’ll share the same with our development team to further investigate and apply the fix in future release.

    Thread Starter bobbingwide

    (@bobbingwide)

    Hi, just to confirm that I made two changes.
    The second fix resolved the Notice for $file not set.
    Example file: wp-includes/css/dashicons.min.css

    The first fix effectively disables the server_is_windows() logic

    @bobbingwide Thanks for the update, I’ll share the same with our development team.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Various problems with minify on Windows server’ is closed to new replies.