From: Evan Prodromou Date: Tue, 28 Dec 2010 21:44:18 +0000 (-0800) Subject: Delete file links when Notice is deleted X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6ab46c70f7a7dcab6694ebd33af13c64b809ebd7;p=quix0rs-gnu-social.git Delete file links when Notice is deleted --- diff --git a/classes/Notice.php b/classes/Notice.php index 0e8bd3c691..561999966c 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -135,6 +135,7 @@ class Notice extends Memcached_DataObject $this->clearFaves(); $this->clearTags(); $this->clearGroupInboxes(); + $this->clearFiles(); // NOTE: we don't clear inboxes // NOTE: we don't clear queue items @@ -1785,6 +1786,21 @@ class Notice extends Memcached_DataObject $reply->free(); } + function clearFiles() + { + $f2p = new File_to_post(); + + $f2p->post_id = $this->id; + + if ($f2p->find()) { + while ($f2p->fetch()) { + $f2p->delete(); + } + } + // FIXME: decide whether to delete File objects + // ...and related (actual) files + } + function clearRepeats() { $repeatNotice = new Notice();