This function allows to purge all cached image lists and to let Thumblist regenerate them. It can be useful if thumbnails were somehow deleted, but the supercache wasn't. Add the following code to config.php:
$HandleActions['tlpurgecache'] = 'uThumbListPurgeCache'; function uThumbListPurgeCache($pagename) { global $UploadDir; echo "<pre>"; uThumbListPurgeCacheRecursive($UploadDir); echo "</pre>"; } function uThumbListPurgeCacheRecursive($dir) { echo "> entering $dir\n"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file == '.' || $file == '..') continue; if(is_dir("$dir/$file")) {uThumbListPurgeCacheRecursive("$dir/$file"); continue;} if(! preg_match("/(^\\.thumblist.*\\.cache|\\.mini-cache\\.txt)$/i", $file)) continue; @unlink("$dir/$file"); echo " unlinked $dir/$file\n"; } closedir($dh); } } echo "< exiting $dir\n"; }
Then call any page with the parameter ?action=tlpurgecache
- the finction will scan all upload directories, and will delete any *.cache image lists it finds.
Petko