summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EVENTS.txt2
-rw-r--r--classes/Notice.php19
2 files changed, 13 insertions, 8 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index bc3e0ea90..1a3b2594a 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -1064,3 +1064,5 @@ EndRssEntryArray: at the end of copying a notice to an array
- $notice: the notice being copied
- &$entry: the entry, with all the fields filled up
+NoticeDeleteRelated: at the beginning of deleting related fields to a notice
+- $notice: notice being deleted
diff --git a/classes/Notice.php b/classes/Notice.php
index 0eeebfadf..686dfc031 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -121,16 +121,19 @@ class Notice extends Memcached_DataObject
$deleted->insert();
}
- // Clear related records
+ if (Event::handle('NoticeDeleteRelated', array($this))) {
- $this->clearReplies();
- $this->clearRepeats();
- $this->clearFaves();
- $this->clearTags();
- $this->clearGroupInboxes();
+ // Clear related records
- // NOTE: we don't clear inboxes
- // NOTE: we don't clear queue items
+ $this->clearReplies();
+ $this->clearRepeats();
+ $this->clearFaves();
+ $this->clearTags();
+ $this->clearGroupInboxes();
+
+ // NOTE: we don't clear inboxes
+ // NOTE: we don't clear queue items
+ }
$result = parent::delete();