summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-03-07 19:47:06 +0100
committerAndreas Gohr <andi@splitbrain.org>2006-03-07 19:47:06 +0100
commit755f1e037af25f25d5945d7f8d56d5b4b76e414d (patch)
tree30531948237e0873850a37a26baa0ce8057616cc
parent9f3cdec3cdadd771a7c5e6f65f00543954995940 (diff)
downloadrpg-755f1e037af25f25d5945d7f8d56d5b4b76e414d.tar.gz
rpg-755f1e037af25f25d5945d7f8d56d5b4b76e414d.tar.bz2
clean media directories after medeia deletion FS#734
darcs-hash:20060307184706-7ad00-c57e9e6c54879afaf17858fe642478fcb91af983.gz
-rw-r--r--inc/io.php4
-rw-r--r--lib/exe/media.php1
2 files changed, 3 insertions, 2 deletions
diff --git a/inc/io.php b/inc/io.php
index 9160f4718..1d458ace9 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -16,12 +16,12 @@
* @todo use safemode hack
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function io_sweepNS($id){
+function io_sweepNS($id,$basedir='datadir'){
global $conf;
//scan all namespaces
while(($id = getNS($id)) !== false){
- $dir = $conf['datadir'].'/'.utf8_encodeFN(str_replace(':','/',$id));
+ $dir = $conf[$basedir].'/'.utf8_encodeFN(str_replace(':','/',$id));
//try to delete dir else return
if(!@rmdir($dir)) return;
diff --git a/lib/exe/media.php b/lib/exe/media.php
index ae0b6efe7..144cd19f4 100644
--- a/lib/exe/media.php
+++ b/lib/exe/media.php
@@ -82,6 +82,7 @@ function media_delete($delid){
$file = mediaFN($delid);
if(@unlink($file)){
msg(str_replace('%s',noNS($delid),$lang['deletesucc']),1);
+ io_sweepNS($delid,'mediadir');
return true;
}
//something went wrong