X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FFave.php;h=53d60b3a8202138ef58cf2cd6bbf6f8dbeb67444;hb=3cab5b36c14085617e41bbf1313593e4a1336906;hp=467465ba0544ab7bda036cc7dac29d77591a7dc2;hpb=9948523c33ea0d02681ff1e0cd4fcb839dc9df96;p=quix0rs-gnu-social.git diff --git a/classes/Fave.php b/classes/Fave.php index 467465ba05..53d60b3a82 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -15,10 +15,6 @@ class Fave extends Managed_DataObject public $uri; // varchar(255) public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP - /* Static get */ - function staticGet($k,$v=null) - { return Memcached_DataObject::staticGet('Fave',$k,$v); } - /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -74,6 +70,7 @@ class Fave extends Managed_DataObject return false; } self::blow('fave:list-ids:notice_id:%d', $fave->notice_id); + self::blow('popular'); Event::handle('EndFavorNotice', array($profile, $notice)); } @@ -83,8 +80,8 @@ class Fave extends Managed_DataObject function delete() { - $profile = Profile::staticGet('id', $this->user_id); - $notice = Notice::staticGet('id', $this->notice_id); + $profile = Profile::getKV('id', $this->user_id); + $notice = Notice::getKV('id', $this->notice_id); $result = null; @@ -92,6 +89,7 @@ class Fave extends Managed_DataObject $result = parent::delete(); self::blow('fave:list-ids:notice_id:%d', $this->notice_id); + self::blow('popular'); if ($result) { Event::handle('EndDisfavorNotice', array($profile, $notice)); @@ -101,11 +99,6 @@ class Fave extends Managed_DataObject return $result; } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Fave', $kv); - } - function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0) { $stream = new FaveNoticeStream($user_id, $own); @@ -122,8 +115,17 @@ class Fave extends Managed_DataObject function asActivity() { - $notice = Notice::staticGet('id', $this->notice_id); - $profile = Profile::staticGet('id', $this->user_id); + $notice = Notice::getKV('id', $this->notice_id); + + if (!$notice) { + throw new Exception("Fave for non-existent notice: " . $this->notice_id); + } + + $profile = Profile::getKV('id', $this->user_id); + + if (!$profile) { + throw new Exception("Fave by non-existent profile: " . $this->user_id); + } $act = new Activity();