summaryrefslogtreecommitdiff
path: root/inc/io.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/io.php')
-rw-r--r--inc/io.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/inc/io.php b/inc/io.php
index aaf71091f..405786cc2 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -21,6 +21,9 @@
* $data[1] ns_type: 'pages' or 'media' namespace tree.
*
* @todo use safemode hack
+ * @param string $id - a pageid, the namespace of that id will be tried to deleted
+ * @param string $basadir - the config name of the type to delete (datadir or mediadir usally)
+ * @returns bool - true if at least one namespace was deleted
* @author Andreas Gohr <andi@splitbrain.org>
* @author Ben Coburn <btcoburn@silicodon.net>
*/
@@ -29,6 +32,8 @@ function io_sweepNS($id,$basedir='datadir'){
$types = array ('datadir'=>'pages', 'mediadir'=>'media');
$ns_type = (isset($types[$basedir])?$types[$basedir]:false);
+ $delone = false;
+
//scan all namespaces
while(($id = getNS($id)) !== false){
$dir = $conf[$basedir].'/'.utf8_encodeFN(str_replace(':','/',$id));
@@ -37,10 +42,12 @@ function io_sweepNS($id,$basedir='datadir'){
if(@rmdir($dir)) {
if ($ns_type!==false) {
$data = array($id, $ns_type);
+ $delone = true; // we deleted at least one dir
trigger_event('IO_NAMESPACE_DELETED', $data);
}
- } else { return; }
+ } else { return $delone; }
}
+ return $delone;
}
/**