• Resolved BeeTeam368

    (@beeteam368)


    Hello @raul,

    Thanks for this great plugin.

    We still ask our customers to use it.

    However, in versions 3.x, Some errors have occurred:

    [30-Dec-2020 17:47:10 UTC] PHP Notice:  Undefined index: query in ...\fast-velocity-minify\inc\common.php on line 794
    
    [30-Dec-2020 17:47:10 UTC] PHP Notice:  Undefined variable: htmljscodeheader in ...\fast-velocity-minify\inc\frontend.php on line 889
    
    [30-Dec-2020 17:47:10 UTC] PHP Notice:  Undefined variable: htmljscodedefer in ...\fast-velocity-minify\inc\frontend.php on line 895

    And JS files as well as CSS files are not minified.

    Even when we refreshed the cache, we got this message: The cache directory is not rewritable!

    Is there anything to look out for when using the new version of FVM?

    Regards!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Raul P.

    (@alignak)

    Hi,

    If it says that The cache directory is not rewritable!, you need to check your file permissions on the wp-content/cache directory.

    WordPress created that directory, but the plugin cannot write to it.
    Ask your hosting to reset the file permissions on your site.

    It’s common, specially on cpanel server, sometimes files change ownership to “nobody” (for whatever reason) and then wordpress cannot delete them, or modify them.

    If the cache directory cannot be used because it’s blocked by your hosting, you can create another cache directory inside the uploads directory, and then adjust the path and url on FVM settings.

    I did not see those error notices on my test server, but I will fix them on the next version update. Meanwhile, simply disable WP_DEBUG (recommended on live sites) if any of those are showing up on the site.

    Plugin Author Raul P.

    (@alignak)

    Fixed on v4.0.4, thanks again

    Thread Starter BeeTeam368

    (@beeteam368)

    Hello Raul,

    Thanks for the reply.

    It looks like you are using PHP’s stripos() function incorrectly.

    Eg:

    stripos($fvm_cache_paths[‘cache_dir_min’], ‘/fvm’) !== false

    Because “/fvm” will always be at the end of the path – Eg:

    C:…\folder\cache\fvm\domain.xyz …

    I just tried to find and remove some of these functions in the conditional statement and the minify CSS files were generated.

    Regards!

    • This reply was modified 4 years, 2 months ago by BeeTeam368.
    Plugin Author Raul P.

    (@alignak)

    @beeteam368 not necessarily.

    That is an extra check, to ensure that the directory we are purging actually is within the allowed path and includes a /fvm directory.

    A hacker or some other malware may somehow hijack the $fvm_cache_paths['cache_dir_min'] and return some other path, which would then be purged when you trigger a cache purge.

    With this check, if you somehow trigger fvm_purge_minification_now() or fvm_purge_minification_expired() or fvm_purge_minification() and try to overwrite the $fvm_cache_paths['cache_dir_min'] path, this will prevent purging on any other directory that doesn’t include /fvm in it’s path.

    Sure, it doesn’t need to be case insensitive or I could use substring… but I am used to reuse code for similar checks and stripos is fast and one of my lazy favorites.

    But thanks for asking.

    Edit: I think that it happens likely because you are using windows (evil).
    It should not be stripos($fvm_cache_paths['cache_dir_min'], '/fvm') but instead stripos($fvm_cache_paths['cache_dir_min'], DIRECTORY_SEPARATOR . 'fvm') on windows.

    Ill fix that soon.

    • This reply was modified 4 years, 2 months ago by Raul P..
    • This reply was modified 4 years, 2 months ago by Raul P..
    Thread Starter BeeTeam368

    (@beeteam368)

    Hello Raul,

    I think conditional statement:

    stripos($fvm_cache_paths['cache_dir_min'], '/fvm') !== false

    should be replaced with conditional statement:

    ( stripos($fvm_cache_paths[‘cache_dir_min’], ‘/fvm‘) !== false || stripos($fvm_cache_paths[‘cache_dir_min’], ‘\fvm‘) !== false )

    Because in some cases, the pathname to the directory will be this:

    /wp-content\cache\fvm\min\

    The main difference is the slash: \ and /

    Thanks!

    • This reply was modified 4 years, 2 months ago by BeeTeam368.
    Plugin Author Raul P.

    (@alignak)

    Yes, that’s what the DIRECTORY_SEPARATOR is for, it will choose based on your OS.
    It’s just that I work mostly on Linux and sometimes Windows compatibility is overlooked.

    If you can try and replace the common.php file on your site, with the one on github and let me know if it works, I would appreciate it (should be fixed). I just don’t want to push another update right away in case I missed something else.

    https://github.com/peixotorms/fast-velocity-minify/blob/main/inc/common.php

    Thanks

    Plugin Author Raul P.

    (@alignak)

    Please try version 3.0.5 as it should be working now.

    Thread Starter BeeTeam368

    (@beeteam368)

    Hello Raul,

    Sorry for the late reply!

    We are still testing it and it looks like it should be fine.

    Will report to you if we discover anything in this 3.x version.

    Regards!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘FVM Version 3.x Error’ is closed to new replies.