summaryrefslogtreecommitdiff
path: root/inc/io.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-03-20 19:21:50 +0100
committerandi <andi@splitbrain.org>2005-03-20 19:21:50 +0100
commit53d6ccfe6aabe82c94115350d2f791f2e09d60d6 (patch)
treef058acedde548940333d6b84cc74f943c026ec9a /inc/io.php
parent81aafed45def19b4c7ddd3065daa294c142365a5 (diff)
downloadrpg-53d6ccfe6aabe82c94115350d2f791f2e09d60d6.tar.gz
rpg-53d6ccfe6aabe82c94115350d2f791f2e09d60d6.tar.bz2
remove empty namespaces on page deletion
darcs-hash:20050320182150-9977f-34610c4d2cd518c1de891e098859e1aaa74355a8.gz
Diffstat (limited to 'inc/io.php')
-rw-r--r--inc/io.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/inc/io.php b/inc/io.php
index d59efbc78..ceb747ed9 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -57,6 +57,25 @@ function io_cacheParse($file){
}
/**
+ * Removes empty directories
+ *
+ * @todo use safemode hack
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+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.
*
* Uses gzip if extension is .gz