]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Profile->noticeCount minor change
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 8 Mar 2016 18:56:25 +0000 (19:56 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 8 Mar 2016 19:00:58 +0000 (20:00 +0100)
classes/Profile.php

index 3dbd883dd821ec89e8ea086caec31753c41d6e43..87168ace4a612b8f03591b30b5a81ee834e07344 100644 (file)
@@ -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;