clearCache() is Over Zealous

I've just found another bug (#3 logged) in phpSmug that you should be aware of. The clearCache() function is over zealous when using the filesystem as the cache location. The function deletes ALL files in the specified directory, not just it's own.

This isn't a problem if you've specified a unique directory for caching, but if you're using a shared caching directory, like you may do if including phpSmug in an application, then all the cache files are removed.

In order to rectify this, I'm going to have to change the caching filename or directory scheme to uniquely identify the phpSmug specific cache files so phpSmug can quickly and easily identify them when clearing the cache.

I'm considering changing phpSmug such that it creates it's own dedicated directory in the location specified in the enableCache() method call. The DB caching method creates it's own table, so it only makes sense that the FS method creates it's own directory.

This bug does not affect database caching as phpSmug creates it's own table for the cache entries.

I'll fix this in the next release.


  1. Erik Spaan

    Good to be aware of indeed. I have a separate cache directory in my module in development, so no problems there. It seems to my that it is always a good idea to keep filesystem caches apart in a directory for different modules. In that way you have easier control over the content.

Leave a Comment

Some HTML is OK but please escape your code accordingly | Your comment may be edited or marked as spam if it appears intended for SEO purposes





  

Support SmugMug

Help SmugMug get onto StackExchange by clicking the image below, clicking "Commit" and then confirming your email address.

Support SmugMug get onto StackExchange

SmugMug Discount



2ZxFXMC19qOxU Use the above code to get $5 off your 1st year at SmugMug.
Register here.

phpSmug Users

  • SmugMug Media Silo

    The SmugMug Media Silo is a plugin for Habari that uses phpSmug to interact with SmugMug and present a "silo" for access to a users photos for easy insertion into posts.

If you're using phpSmug and wish to let the world know, drop me a line and I'll add a link and short description here