• Resolved fariazz

    (@fariazz)


    When setting up a custom path for the cache location, the plugin currently requires the PARENT of that folder to be writable:

    
    if($fvm_change_cache_path !== false && $fvm_change_cache_base !== false && strlen($fvm_change_cache_path) > 1 && is_dir($fvm_change_cache_path) && is_writable(dirname($fvm_change_cache_path))) {
    

    For example, if I want to save the cache in /wp-content/cool-cache, this is requiring me to make wp-content writable, not the actual path which is /wp-content/cool-cache.

    Instead, the plugin should check that the target path is writable, NOT THE PARENT. You can remove dirname call from here:

    
    if($fvm_change_cache_path !== false && $fvm_change_cache_base !== false && strlen($fvm_change_cache_path) > 1 && is_dir($fvm_change_cache_path) && is_writable($fvm_change_cache_path)) {
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Raul P.

    (@alignak)

    We need to check if the parent is writable, because if cool-cache doesn’t exist, we need to create it on the spot (with the same permissions as it’s parent directory).

    The permission for all substructure on fvm generated files and directories, come only from the cache directory (cool-cache), provided it already exists if it’s parent (wp-content) is not writable.

    If cool-cache doesn’t exist, it will look at it’s parents ownership and permissions, and replicate them (that’s why by default, it defaults to the uploads directory, which is writable by default).

    With the default uploads directory, the wp-content directory doesn’t need to be writable, so if the intended cache directory exists and is writable (cool-cache), I think it is working as intended (will test this).

    In other words, as long as wp-content/cool-cache exists and has similar writing permissions AND ownership as the wp-content/uploads directory, it should be working.

    But anyway, I’ll do some testing and if needed I’ll change it.
    Thanks for reporting

    Thread Starter fariazz

    (@fariazz)

    Thanks for the super quick response here! Plugin is absolutely awesome btw.

    In other words, as long as wp-content/cool-cache exists and has similar writing permissions AND ownership as the wp-content/uploads directory, it should be working.

    That is not correct, as you are not checking the same permissions when defaulting to uploads. The plugin does these checks for the user-entered folder, which include checking the parent:

    if($fvm_change_cache_path !== false && $fvm_change_cache_base !== false && strlen($fvm_change_cache_path) > 1 && is_dir($fvm_change_cache_path) && is_writable($fvm_change_cache_path)) {
    

    And if that is false, it just goes ahead with uploads, without the same check.

    The help text provided gives “wp-content/uploads” and “wp-content/cache” as examples, both of which already exist and will act as container folders. So I imagined what I needed to do was create a containing folder and make it writable.

    From that perspective, I guess I have to set it up for “wp-content/cool-cache/cool-cache” for it to work ?? , if I don’t want to make wp-content writable (which is not the case on our site)

    • This reply was modified 5 years, 7 months ago by fariazz.
    Thread Starter fariazz

    (@fariazz)

    The wp-content/cool-cache/cool-cache approach worked for me!

    Plugin Author Raul P.

    (@alignak)

    This is fixed on 2.6.9, thanks again.

    Thread Starter fariazz

    (@fariazz)

    Thank you Raul!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘For custom directory, paren’t shouldn’t be required to be writable’ is closed to new replies.