diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-01-24 19:38:40 +0100 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-01-24 19:38:40 +0100 |
commit | 0d34cd24abc0329aae7d408b3bab3d692caaa045 (patch) | |
tree | ff0751391eeb3023d4a9eda4168c30b596449255 /classes | |
parent | 1f4edd70cbe28783784c41eda6c93008bbf86a78 (diff) |
Update notice deletion
Changed the errors in notice deletion so it now works. Also,
consistently delete records from related tables that refer
to the notice.
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Notice.php | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/classes/Notice.php b/classes/Notice.php index 4a06c9258..c597137fe 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -63,8 +63,24 @@ class Notice extends Memcached_DataObject { $this->blowCaches(true); $this->blowFavesCache(true); - $this->blowInboxes(); - return parent::delete(); + $this->blowSubsCache(true); + + $this->query('BEGIN'); + $related = array('Reply', + 'Fave', + 'Notice_tag', + 'Group_inbox', + 'Queue_item'); + if (common_config('inboxes', 'enabled')) { + $related[] = 'Notice_inbox'; + } + foreach ($related as $cls) { + $inst = new $cls(); + $inst->notice_id = $this->id; + $inst->delete(); + } + $result = parent::delete(); + $this->query('COMMIT'); } function saveTags() @@ -568,22 +584,6 @@ class Notice extends Memcached_DataObject return; } - # Delete from inboxes if we're deleted. - - function blowInboxes() - { - - $enabled = common_config('inboxes', 'enabled'); - - if ($enabled === true || $enabled === 'transitional') { - $inbox = new Notice_inbox(); - $inbox->notice_id = $this->id; - $inbox->delete(); - } - - return; - } - function saveGroups() { $enabled = common_config('inboxes', 'enabled'); |