From e4310a57cdc335d287d13efce24814c5829a5f78 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 8 Mar 2016 19:56:25 +0100 Subject: [PATCH] Profile->noticeCount minor change --- classes/Profile.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index 3dbd883dd8..87168ace4a 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -833,19 +833,21 @@ class Profile extends Managed_DataObject $c = Cache::instance(); if (!empty($c)) { - $cnt = $c->get(Cache::key('profile:notice_count:'.$this->id)); + $cnt = $c->get(Cache::key('profile:notice_count:'.$this->getID())); if (is_integer($cnt)) { return (int) $cnt; } } $notices = new Notice(); - $notices->profile_id = $this->id; - $notices->verb = ActivityVerb::POST; - $cnt = (int) $notices->count('distinct id'); + $notices->profile_id = $this->getID(); + $notices->whereAddIn('verb', + [ActivityUtils::resolveUri(ActivityVerb::POST, true), ActivityVerb::POST], + $notices->columnType('verb')); + $cnt = (int) $notices->count(); // we don't have to provide anything as Notice is key'd if (!empty($c)) { - $c->set(Cache::key('profile:notice_count:'.$this->id), $cnt); + $c->set(Cache::key('profile:notice_count:'.$this->getID()), $cnt); } return $cnt;