• Resolved John Webber

    (@bilion)


    Hi,

    I have a suggestion for 2 options that would be useful:

    – Clear cache only for specific roles.

    – Load a new file only if it has been changed and cache all other files.

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mwale Kalenga

    (@mwalek)

    Hi @bilion,

    Thanks so much for your feedback and suggestions ??

    I think both features you mentioned would be really valuable and I will definitely add them to the to-do list for improving the plugin.

    And sorry for taking a while to respond.

    Kind regards,
    Mwale

    • This reply was modified 2 years, 5 months ago by Mwale Kalenga.
    Thread Starter John Webber

    (@bilion)

    @mwalek

    Great! Good news.

    I couldn’t wait for you and decided to implement one of those, to randomize the file version only for the admin.
    I use it in combination with this Chrome extension:
    Where da cache at?
    Because on their own, neither the randomized files or the Chrome extension will show a completely uncached page.

    So, I’m all set. But, your other users would appreciate having a button that ads a query string at the end of the url, so that they can see an uncached version. Just stick in the button in the admin toolbar.

    But, randomizing the version only of the file that has been edited… I don’t know how to do that.

    Regards,
    Jovan

    Plugin Author Mwale Kalenga

    (@mwalek)

    Awesome, thanks for sharing this Jovan!!

    Yeah, I think adding the button right in the admin bar menu makes sense.

    For updating the version number, I could possibly just use the timestamp instead of random numbers.

    So, if a file hasn’t been modified, its timestamp would be the same as the query string and wouldn’t need to be changed.

    Thread Starter John Webber

    (@bilion)

    Nice. Sounds like a good solution.

    Let me know when the update gets approved.
    Otherwise I’ll completely forget to install it again.

    I tried applying the idea to my custom code, but I can’t get the modified dates of the files.
    filemtime is equal to filectime
    But, if I try the clearstatcache() function, the date is 01/01/1970.

    add_action('wp_enqueue_scripts', 'engueue_custom_styles_4981254');
    function engueue_custom_styles_4981254() {
    		
    	wp_enqueue_style( 
    		'custom-global-styles', 
    		'/wp-content/custom-assets/css/all-global.css', 
    		array(), 
    		date("d/m/Y",filemtime(clearstatcache(true,'/home/2test.live/public_html/wp-content/custom-assets/css/'))));
    }

    The files are not stored in the theme folders, but in a custom folder.

    Plugin Author Mwale Kalenga

    (@mwalek)

    Hmmm seems to be on the right track .. Having a deeper look at it will definitely help. And I’ll keep you informed for sure. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Only for admin | Only for the new files’ is closed to new replies.