cache plugin

cache plugin by Ikuo Obataya
Cache helper class

Last updated on 2008-05-14. Provides Helper.
Compatible with DokuWiki 2006-11-06, 2008-05-05.

Tagged with cache, helper.

This plugin provides a cache mechanism to plugins which needs to store cache files for its own.

Downloadcache.zip(1.2KB)2008-05-14

plugin_cache class

properties

namespace Namespace to store cache files
mediaDir Media directory path
mediaFormatString format to make a cache path
linkFormat String format to make a link (Dokuwiki ID)
prefix Prefix for cache files
extension Extension for cache files

functions

GetMediaPath($id)Get a media path for cache ID
GetMediaLink($id)Get a link URL to fetch a cache
GetMediaText($id)Get a text of cache file
CheckDir()Check and make a cache directory called in constructor
ClearCache()Clear all cache files in a namespace
RemoveDir()Clear and remove cache directory

History

  • 2008.5.14
    • Bug fix for incorrect media directory path creation.
  • 2008.4.18
    • Bug fix for some incorrect media links with ‘:’
  • 2008.3.22
    • First version was uploaded.

Discussion

Thanks for your work. I still have a problem with url and path with the 2008.4.18 release. I'm using $conf['useslash'] = 0 and file are create in data/media:namespace:filename and not in data/media/namespace/filename. I made the following change :

--- plugin_cache.php.orig    2008-04-18 20:19:54.000000000 +0200
+++ plugin_cache.php        2008-04-27 00:48:59.000000000 +0200
@@ -25,8 +25,8 @@
       $this->prefix = $_prefix.'_';
     }
     $delimiter = ($conf['useslash'])?'/':':';
-    $this->mediaDir    = $conf['mediadir'].$delimiter.$this->namespace;
-    $this->mediaFormat = $this->mediaDir.$delimiter.$this->prefix.'%s.'.$this->extension;
+    $this->mediaDir    = $conf['mediadir']."/".$this->namespace;
+    $this->mediaFormat = $this->mediaDir."/".$this->prefix.'%s.'.$this->extension;
     $this->linkFormat  = $this->namespace.$delimiter.$this->prefix.'%s.'.$this->extension;
 
     $this->CheckDir();

Macfly 2008/04/27 00:51

Thank you, Macfly. I updated the file and uploaded.

Ikuo Obataya 2008/05/14 17:02

 
plugin/cache.txt · Last modified: 2008/05/14 17:05 by iobataya
 
Imprint Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsTranslate