From 53d6ccfe6aabe82c94115350d2f791f2e09d60d6 Mon Sep 17 00:00:00 2001 From: andi Date: Sun, 20 Mar 2005 19:21:50 +0100 Subject: remove empty namespaces on page deletion darcs-hash:20050320182150-9977f-34610c4d2cd518c1de891e098859e1aaa74355a8.gz --- inc/io.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'inc/io.php') diff --git a/inc/io.php b/inc/io.php index d59efbc78..ceb747ed9 100644 --- a/inc/io.php +++ b/inc/io.php @@ -56,6 +56,25 @@ function io_cacheParse($file){ return $parsed; } +/** + * Removes empty directories + * + * @todo use safemode hack + * @author Andreas Gohr + */ +function io_sweepNS($id){ + global $conf; + + //scan all namespaces + while(($id = getNS($id)) !== false){ + $dir = $conf['datadir'].'/'.str_replace(':','/',$id); + $dir = utf8_encodeFN($dir); + + //try to delete dir else return + if(!@rmdir($dir)) return; + } +} + /** * Returns content of $file as cleaned string. * -- cgit v1.2.3