• Resolved Carl Alberto

    (@carl-alberto)


    Hi Raul,

    First of all, awesome plugin you have here but it seems overriding the cache location to the common dynamic writable path of WordPress in wp-content/uploads via FVM_DIR is not working. That override is useful especially on a version-controlled codebase but the documented override by the plugin does not work when using the FVM_DIR constant as suggested by the doc https://github.com/peixotorms/fast-velocity-minify/blob/f2dc31229eac0f68f7ce49a6a2927d9fc656b59d/readme.txt#L35 because FVM_DIR is used in the plugin
    to also reference the plugin path https://github.com/peixotorms/fast-velocity-minify/blob/f2dc31229eac0f68f7ce49a6a2927d9fc656b59d/fvm.php#L38-L44 resulting to a fatal error when enabling the plugin:

    example when using define( 'FVM_DIR', 'wp-content/uploads/' );

    
    Fatal error: require_once(): Failed opening required 'wp-content/uploads/inc/common.php' (include_path='.:/usr/share/pear:/usr/share/php') in wp-content/plugins/fast-velocity-minify/fvm.php on line 47
    

    Steps to reproduce:

    1. Add in the wp-config.php

    
    define( 'FVM_DIR', '/code/wp-content/uploads/' );
    define( 'FVM_URL', WP_SITEURL . '/wp-content/uploads/' );
    

    2. By enabling the plugin, you will get the error above

    Proposal:
    Add in the function fvm_get_cache_location() a specific CONSTANT that references the specific cache path but is also not used to reference the plugin path https://github.com/peixotorms/fast-velocity-minify/blob/f2dc31229eac0f68f7ce49a6a2927d9fc656b59d/fvm.php#L38-L44 example using FVM_CACHE_DIR & FVM_CACHE_URL

    
    	if (defined('FVM_CACHE_DIR') && defined('FVM_CACHE_URL')){
    	
    		# define paths and url
    		$sep = DIRECTORY_SEPARATOR;
    		$dir = trim(rtrim(FVM_CACHE_DIR, '/\\')). $sep . 'cache' . $sep . 'fvm'. $sep . 'min';
    		$durl = trim(rtrim(FVM_CACHE_URL, '/')). '/cache/fvm/min';
    		
    		# create and return
    		if(!is_dir($dir) && function_exists('wp_mkdir_p')) { wp_mkdir_p($dir); }
    		return array('ch_dir'=>$dir,'ch_url'=>$durl);
    		
    	}
    

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘FVM_DIR constant can’t be used to change cache location’ is closed to new replies.