X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice.php;h=5a70f70b6461c16b888301fc53d1213590e57d57;hb=7cd0706aefd3d3eb4d70213d915651958faaadbc;hp=4646fc6aba2778fbb6511a826ca12fc87cf7f0d3;hpb=e2c90576c0e50ccaa2b70c4d72ad06f320842f73;p=quix0rs-gnu-social.git diff --git a/classes/Notice.php b/classes/Notice.php index 4646fc6aba..5a70f70b64 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(); @@ -245,6 +248,8 @@ class Notice extends Memcached_DataObject if (!empty($options)) { $options = $options + $defaults; extract($options); + } else { + extract($defaults); } if (!isset($is_local)) { @@ -485,7 +490,7 @@ class Notice extends Memcached_DataObject function saveKnownUrls($urls) { // @fixme validation? - foreach ($urls as $url) { + foreach (array_unique($urls) as $url) { File::processNew($url, $this->id); } } @@ -893,7 +898,7 @@ class Notice extends Memcached_DataObject } $groups = array(); - foreach ($group_ids as $id) { + foreach (array_unique($group_ids) as $id) { $group = User_group::staticGet('id', $id); if ($group) { common_log(LOG_ERR, "Local delivery to group id $id, $group->nickname"); @@ -1016,7 +1021,7 @@ class Notice extends Memcached_DataObject } $sender = Profile::staticGet($this->profile_id); - foreach ($uris as $uri) { + foreach (array_unique($uris) as $uri) { $user = User::staticGet('uri', $uri); @@ -1029,6 +1034,7 @@ class Notice extends Memcached_DataObject $reply->notice_id = $this->id; $reply->profile_id = $user->id; + common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $user->id"); $id = $reply->insert(); }