aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-16 17:50:15 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-16 17:50:15 -0700
commitd84b3cfc3c42c2d62813ff78ccfc9b9c34afc92d (patch)
tree759706f50be72e07c1a2fc5a3c615c0672af61f9 /include
parentbc72d3fd2659326e223120c337a59090d97985fe (diff)
downloadvolse-hubzilla-d84b3cfc3c42c2d62813ff78ccfc9b9c34afc92d.tar.gz
volse-hubzilla-d84b3cfc3c42c2d62813ff78ccfc9b9c34afc92d.tar.bz2
volse-hubzilla-d84b3cfc3c42c2d62813ff78ccfc9b9c34afc92d.zip
remove file/attachments when their associated photos are removed
Diffstat (limited to 'include')
-rw-r--r--include/attach.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/attach.php b/include/attach.php
index cf463785e..6cd3249cf 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -818,15 +818,16 @@ function attach_change_permissions($channel_id, $resource, $allow_cid, $allow_gi
* The hash to delete
* @return void
*/
-function attach_delete($channel_id, $resource) {
+function attach_delete($channel_id, $resource, $is_photo = 0) {
$c = q("SELECT channel_address FROM channel WHERE channel_id = %d LIMIT 1",
intval($channel_id)
);
$channel_address = (($c) ? $c[0]['channel_address'] : 'notfound');
+ $photo_sql = (($is_photo) ? " and is_photo = 1 " : '');
- $r = q("SELECT hash, flags, folder FROM attach WHERE hash = '%s' AND uid = %d limit 1",
+ $r = q("SELECT hash, flags, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1",
dbesc($resource),
intval($channel_id)
);