From 98407a7ab8cdc6e868009187f47cc7768449a3c9 Mon Sep 17 00:00:00 2001 From: andi Date: Sun, 26 Jun 2005 12:09:13 +0200 Subject: 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 --- inc/pageutils.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'inc/pageutils.php') 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 + * + * @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 : -- cgit v1.2.3