]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
cache frequently-used subscriber, subscription, notice and fave count values
[quix0rs-gnu-social.git] / classes / Notice.php
index d0ee1d9250a726d55e01dceaa22a89c0a1deed9d..75044cf638ae1b5218a08863ceed01f2a59a4191 100644 (file)
@@ -356,6 +356,8 @@ class Notice extends Memcached_DataObject
         $this->blowTagCache($blowLast);
         $this->blowGroupCache($blowLast);
         $this->blowConversationCache($blowLast);
+        $profile = Profile::staticGet($this->profile_id);
+        $profile->blowNoticeCount();
     }
 
     function blowConversationCache($blowLast=false)
@@ -795,7 +797,7 @@ class Notice extends Memcached_DataObject
         $notice->selectAdd(); // clears it
         $notice->selectAdd('id');
 
-        $notice->whereAdd('conversation = '.$id);
+        $notice->conversation = $id;
 
         $notice->orderBy('id DESC');
 
@@ -874,7 +876,6 @@ class Notice extends Memcached_DataObject
                 $qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") ';
                 $cnt++;
                 if ($cnt >= MAX_BOXCARS) {
-                    common_debug($qry);
                     $inbox = new Notice_inbox();
                     $inbox->query($qry);
                     $qry = $qryhdr;
@@ -883,7 +884,6 @@ class Notice extends Memcached_DataObject
             }
 
             if ($cnt > 0) {
-                common_debug($qry);
                 $inbox = new Notice_inbox();
                 $inbox->query($qry);
             }
@@ -1166,6 +1166,18 @@ class Notice extends Memcached_DataObject
         }
         $tag->free();
 
+        # Enclosures
+        $attachments = $this->attachments();
+        if($attachments){
+            foreach($attachments as $attachment){
+                $attributes = array('rel'=>'enclosure','href'=>$attachment->url,'type'=>$attachment->mimetype,'length'=>$attachment->size);
+                if($attachment->title){
+                    $attributes['title']=$attachment->title;
+                }
+                $xs->element('link', $attributes, null);
+            }
+        }
+
         $xs->elementEnd('entry');
 
         return $xs->getString();
@@ -1189,6 +1201,7 @@ class Notice extends Memcached_DataObject
 
         if (empty($cache) ||
             $since_id != 0 || $max_id != 0 || (!is_null($since) && $since > 0) ||
+            is_null($limit) ||
             ($offset + $limit) > NOTICE_CACHE_WINDOW) {
             return call_user_func_array($fn, array_merge($args, array($offset, $limit, $since_id,
                                                                       $max_id, $since)));
@@ -1211,7 +1224,7 @@ class Notice extends Memcached_DataObject
             $window = explode(',', $laststr);
             $last_id = $window[0];
             $new_ids = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
-                                                                          $last_id, 0, null, $tag)));
+                                                                          $last_id, 0, null)));
 
             $new_window = array_merge($new_ids, $window);
 
@@ -1226,7 +1239,7 @@ class Notice extends Memcached_DataObject
         }
 
         $window = call_user_func_array($fn, array_merge($args, array(0, NOTICE_CACHE_WINDOW,
-                                                                     0, 0, null, $tag)));
+                                                                     0, 0, null)));
 
         $windowstr = implode(',', $window);