• Resolved Steven Vachon

    (@prometh)


    function apl_get_plugin_data( $cache ) {
    
    	// Attempt to get plugin list from cache
    
    	if ( !$cache ) { $cache = 'no'; }
    
    	$plugins = false;
    	$cache_key = 'artiss_plugins_list';
    	if ( !is_numeric( $cache ) ) { $plugins = get_transient( $cache_key ); }
    
    	// If not using cache, generate a new list and cache that
    
    	if ( !$plugins ) {
    		$plugins = get_plugins();
    		if ( ( '' != $plugins ) && ( !is_numeric( $cache ) ) ) { set_transient( $cache_key, $plugins, 3600 * $cache ); }
    	}
    
    	return $plugins;
    
    }

    Because of if ( !is_numeric( $cache ) ), cache is always used.

    https://www.ads-software.com/extend/plugins/plugins-list/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author David Artiss

    (@dartiss)

    The cache should either be false (or “no”) or a number (to indicate length of cache).

    The first line of the function changes $cache to “no” of it’s false. At this point it should either now be “no” or a number. Therefore, the line you’re referring to only gets the cache if a number has been specified. This is correct.

    David.

    Thread Starter Steven Vachon

    (@prometh)

    With cache="no", !is_numeric() will always be true because you’re checking if it’s false.

    I have cache="no" and it skips more recent plugins. With that !is_numeric() line commented out, the list loads in full.

    Plugin Author David Artiss

    (@dartiss)

    Yes, you’re correct – I’ve seen my mistake now. I’ll get it corrected in the next few days.

    David.

    Thread Starter Steven Vachon

    (@prometh)

    Cool, thanks. I consider this plugin to be important to plugin devs like us

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘cache="no" ignored’ is closed to new replies.