From 6eda8064449d154614345e9bd867dce2faba0deb Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 8 Jan 2014 18:06:52 -0800 Subject: This should be approaching completion for file OS storage. May be a few minor bugs remaining due to some late-breaking fixes but I've been testing it as I go. --- include/attach.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include/attach.php') diff --git a/include/attach.php b/include/attach.php index 93c9a5424..f2f889fd7 100644 --- a/include/attach.php +++ b/include/attach.php @@ -679,6 +679,12 @@ function attach_change_permissions($channel_id,$resource,$allow_cid,$allow_gid,$ function attach_delete($channel_id,$resource) { + $c = q("select channel_address from channel where channel_id = %d limit 1", + intval($channel_id) + ); + + $channel_address = (($c) ? $c[0]['channel_address'] : 'notfound'); + $r = q("select hash, flags from attach where hash = '%s' and uid = %d limit 1", dbesc($resource), intval($channel_id) @@ -705,10 +711,11 @@ function attach_delete($channel_id,$resource) { ); if($y) { - if(is_dir($y[0]['data'])) - @rmdir($y[0]['data']); - elseif(file_exists($y[0]['data'])) - unlink($y[0]['data']); + $f = 'store/' . $channel_address . '/' . $y[0]['data']; + if(is_dir($f)) + @rmdir($f); + elseif(file_exists($f)) + unlink($f); } } -- cgit v1.2.3