So I’ve spent most of this day at work playing around with WordPress, and various plugins that have been made for it.

For instance This Audioscrobbler plugin for WordPress made by Chris Coggburn. (Seen at the right under Recent Tracks) Unfortunately, Chris no longer updates that blog, and I can’t post the fix to a bug I found in his script.

I am not a PHP guru (by any means), but a bit of google goes a long way…

Anyway, here’s the fix, hopefully google will pick this up and it will help some other helpless soul out along the way:


Ok, i figured out why this thing is refreshing the cache file on each hit (at least on my site)

the function time() returns the number of seconds since the Unix Epoch and the function that is trying to figure out if the cache file needs to be updated uses it.

But it uses teh multiplier $rdfcachetime as if it’s for minutes because it only multiplies it by 60 instead of 3600 (the number of seconds in an hour).

So basically, change the following line (in audioscrobbler.php):
if (((!file_exists("cache_".$asusername.".rss")) || (time() - filemtime("cache_".$asusername.".rss")) > ($rdfcachetime * 60))) {

TO:
if (((!file_exists("cache_".$asusername.".rss")) || (time() - filemtime("cache_".$asusername.".rss")) > ($rdfcachetime * 3600))) {