diff options
author | Mario <mario@mariovavti.com> | 2020-12-14 21:56:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-12-14 21:56:19 +0000 |
commit | 8e488e291347857407dbedaf05d63941701d82d2 (patch) | |
tree | 52b9ca66fb3a9d9934000aca4c4860770dad7bb2 /include | |
parent | e58e27ce2256ce4192c6ac7670ccb301fb40e60a (diff) | |
download | volse-hubzilla-8e488e291347857407dbedaf05d63941701d82d2.tar.gz volse-hubzilla-8e488e291347857407dbedaf05d63941701d82d2.tar.bz2 volse-hubzilla-8e488e291347857407dbedaf05d63941701d82d2.zip |
handle removal of terms in attach_delete() when deleting a ressource
Diffstat (limited to 'include')
-rw-r--r-- | include/attach.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/attach.php b/include/attach.php index 515de9b4d..7ef5c4d0e 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1432,7 +1432,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { $channel_address = (($c) ? $c[0]['channel_address'] : 'notfound'); $photo_sql = (($is_photo) ? " and is_photo = 1 " : ''); - $r = q("SELECT hash, os_storage, flags, is_dir, is_photo, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1", + $r = q("SELECT id, hash, os_storage, flags, is_dir, is_photo, folder FROM attach WHERE hash = '%s' AND uid = %d $photo_sql limit 1", dbesc($resource), intval($channel_id) ); @@ -1453,6 +1453,12 @@ function attach_delete($channel_id, $resource, $is_photo = 0) { return; } + q("DELETE FROM term WHERE uid = %d AND oid = %d AND otype = %d", + intval($channel_id), + intval($r[0]['id']), + intval(TERM_OBJ_FILE) + ); + // If resource is a directory delete everything in the directory recursive if(intval($r[0]['is_dir'])) { $x = q("SELECT hash, os_storage, is_dir, flags FROM attach WHERE folder = '%s' AND uid = %d", |