summaryrefslogtreecommitdiff
path: root/inc/pageutils.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-06-26 12:09:13 +0200
committerandi <andi@splitbrain.org>2005-06-26 12:09:13 +0200
commit98407a7ab8cdc6e868009187f47cc7768449a3c9 (patch)
tree81ff92e45a1ec0db93dadbbf24fbab1f17cea434 /inc/pageutils.php
parentd477fdcf1c8e21ef479942fe1d14acb7991d8a4a (diff)
downloadrpg-98407a7ab8cdc6e868009187f47cc7768449a3c9.tar.gz
rpg-98407a7ab8cdc6e868009187f47cc7768449a3c9.tar.bz2
directory cleanup
This cleans up the directory structure as discussed on the mailning list. Users should delete their previous _cache directories to recover diskspace. darcs-hash:20050626100913-9977f-83c0fdc32047db2090fc52a843ffae50cbf12248.gz
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 :