X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice.php;h=d520f4728f60d98758041aae7fce74a923a497a0;hb=39f8d2c72830d7bc3c08f60d1df38d19c846a74b;hp=a25991fa322fc779d17299fa5944ba2a7a9caaa8;hpb=0291c6f7cd07cfb6845215ab33f8a56b417c0d1c;p=quix0rs-gnu-social.git diff --git a/classes/Notice.php b/classes/Notice.php index a25991fa32..d520f4728f 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -72,6 +72,7 @@ class Notice extends Memcached_DataObject public $location_id; // int(4) public $location_ns; // int(4) public $repeat_of; // int(4) + public $object_type; // varchar(255) /* Static get */ function staticGet($k,$v=NULL) @@ -241,6 +242,7 @@ class Notice extends Memcached_DataObject * array 'urls' list of attached/referred URLs to save with the * notice in place of extracting links from content * boolean 'distribute' whether to distribute the notice, default true + * string 'object_type' URL of the associated object type (default ActivityObject::NOTE) * * @fixme tag override * @@ -360,6 +362,12 @@ class Notice extends Memcached_DataObject $notice->rendered = common_render_content($final, $notice); } + if (empty($object_type)) { + $notice->object_type = (empty($notice->reply_to)) ? ActivityObject::NOTE : ActivityObject::COMMENT; + } else { + $notice->object_type = $object_type; + } + if (Event::handle('StartNoticeSave', array(&$notice))) { // XXX: some of these functions write to the DB @@ -616,7 +624,7 @@ class Notice extends Memcached_DataObject function getStreamByIds($ids) { - $cache = common_memcache(); + $cache = Cache::instance(); if (!empty($cache)) { $notices = array(); @@ -782,7 +790,7 @@ class Notice extends Memcached_DataObject $c = self::memcache(); if (!empty($c)) { - $ni = $c->get(common_cache_key('notice:who_gets:'.$this->id)); + $ni = $c->get(Cache::key('notice:who_gets:'.$this->id)); if ($ni !== false) { return $ni; } @@ -843,7 +851,7 @@ class Notice extends Memcached_DataObject if (!empty($c)) { // XXX: pack this data better - $c->set(common_cache_key('notice:who_gets:'.$this->id), $ni); + $c->set(Cache::key('notice:who_gets:'.$this->id), $ni); } return $ni; @@ -1072,6 +1080,7 @@ class Notice extends Memcached_DataObject $reply->notice_id = $this->id; $reply->profile_id = $profile->id; + $reply->modified = $this->created; common_log(LOG_INFO, __METHOD__ . ": saving reply: notice $this->id to profile $profile->id"); @@ -1132,6 +1141,7 @@ class Notice extends Memcached_DataObject $reply->notice_id = $this->id; $reply->profile_id = $mentioned->id; + $reply->modified = $this->created; $id = $reply->insert(); @@ -1489,7 +1499,7 @@ class Notice extends Memcached_DataObject function stream($fn, $args, $cachekey, $offset=0, $limit=20, $since_id=0, $max_id=0) { - $cache = common_memcache(); + $cache = Cache::instance(); if (empty($cache) || $since_id != 0 || $max_id != 0 || @@ -1499,7 +1509,7 @@ class Notice extends Memcached_DataObject $max_id))); } - $idkey = common_cache_key($cachekey); + $idkey = Cache::key($cachekey); $idstr = $cache->get($idkey); @@ -1681,17 +1691,17 @@ class Notice extends Memcached_DataObject function repeatStream($limit=100) { - $cache = common_memcache(); + $cache = Cache::instance(); if (empty($cache)) { $ids = $this->_repeatStreamDirect($limit); } else { - $idstr = $cache->get(common_cache_key('notice:repeats:'.$this->id)); + $idstr = $cache->get(Cache::key('notice:repeats:'.$this->id)); if ($idstr !== false) { $ids = explode(',', $idstr); } else { $ids = $this->_repeatStreamDirect(100); - $cache->set(common_cache_key('notice:repeats:'.$this->id), implode(',', $ids)); + $cache->set(Cache::key('notice:repeats:'.$this->id), implode(',', $ids)); } if ($limit < 100) { // We do a max of 100, so slice down to limit @@ -1857,10 +1867,10 @@ class Notice extends Memcached_DataObject if ($tag->find()) { while ($tag->fetch()) { - self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, common_keyize($tag->tag)); - self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, common_keyize($tag->tag)); - self::blow('notice_tag:notice_ids:%s', common_keyize($tag->tag)); - self::blow('notice_tag:notice_ids:%s;last', common_keyize($tag->tag)); + self::blow('profile:notice_ids_tagged:%d:%s', $this->profile_id, Cache::keyize($tag->tag)); + self::blow('profile:notice_ids_tagged:%d:%s;last', $this->profile_id, Cache::keyize($tag->tag)); + self::blow('notice_tag:notice_ids:%s', Cache::keyize($tag->tag)); + self::blow('notice_tag:notice_ids:%s;last', Cache::keyize($tag->tag)); $tag->delete(); } }