summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r--inc/pageutils.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 884df9e96..8477792e0 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -231,4 +231,23 @@ function resolve_pageid($ns,&$page,&$exists){
if(!empty($hash)) $page .= '#'.$hash;
}
+/**
+ * Returns the name of a cachefile from given data
+ *
+ * The needed directory is created by this function!
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ *
+ * @param string $data This data is used to create a unique md5 name
+ * @param string $ext This is appended to the filename if given
+ * @return string The filename of the cachefile
+ */
+function getCacheName($data,$ext=''){
+ global $conf;
+ $md5 = md5($data);
+ $file = $conf['cachedir'].'/'.$md5{0}.'/'.$md5.$ext;
+ io_makeFileDir($file);
+ return $file;
+}
+
//Setup VIM: ex: et ts=2 enc=utf-8 :