- $notices = $this->getNoticesBetween(0, $end);
- foreach ($notices as $noticeAct) {
- $noticeAct->asActivity()->outputTo($this, false, false);
+ try {
+ if (!empty($this->after)) {
+ $notices = $this->getNoticesBetween($this->after, $end);
+ } else {
+ $notices = $this->getNoticesBetween(0, $end);
+ }
+ foreach ($notices as $noticeAct) {
+ try {
+ $nact = $noticeAct->asActivity($this->user);
+ if ($format == Feed::ATOM) {
+ $nact->outputTo($this, false, false);
+ } else {
+ if ($haveOne) {
+ fwrite($handle, ",");
+ }
+ fwrite($handle, json_encode($nact->asArray()));
+ $haveOne = true;
+ }
+ } catch (Exception $e) {
+ common_log(LOG_ERR, $e->getMessage());
+ continue;
+ }
+ }
+ } catch (Exception $e) {
+ common_log(LOG_ERR, $e->getMessage());
+ }
+ }
+
+ if (empty($this->after) || strtotime($this->user->created) > $this->after) {
+ // We always add the registration activity at the end, even if
+ // they have older activities (from restored backups) in their stream.
+
+ try {
+ $ract = $this->user->registrationActivity();
+ if ($format == Feed::ATOM) {
+ $ract->outputTo($this, false, false);
+ } else {
+ if ($haveOne) {
+ fwrite($handle, ",");
+ }
+ fwrite($handle, json_encode($ract->asArray()));
+ $haveOne = true;
+ }
+ } catch (Exception $e) {
+ common_log(LOG_ERR, $e->getMessage());
+ continue;