]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Merge branch '0.9.x' of git@gitorious.org:laconica/mainline into 0.9.x
[quix0rs-gnu-social.git] / classes / Notice.php
index fc28f355882c3445932470e0d7a366830e7a2935..c6ad7d6c4568e912e314da8b4bfd9839d9aa579b 100644 (file)
@@ -74,7 +74,21 @@ class Notice extends Memcached_DataObject
         $this->blowFavesCache(true);
         $this->blowSubsCache(true);
 
+        // For auditing purposes, save a record that the notice
+        // was deleted.
+
+        $deleted = new Deleted_notice();
+
+        $deleted->id         = $this->id;
+        $deleted->profile_id = $this->profile_id;
+        $deleted->uri        = $this->uri;
+        $deleted->created    = $this->created;
+        $deleted->deleted    = common_sql_now();
+
         $this->query('BEGIN');
+
+        $deleted->insert();
+
         //Null any notices that are replies to this notice
         $this->query(sprintf("UPDATE notice set reply_to = null WHERE reply_to = %d", $this->id));
         $related = array('Reply',
@@ -875,6 +889,9 @@ class Notice extends Memcached_DataObject
                 }
                 $qry .= '('.$id.', '.$this->id.', '.$source.', "'.$this->created.'") ';
                 $cnt++;
+                if (rand() % NOTICE_INBOX_SOFT_LIMIT == 0) {
+                    Notice_inbox::gc($id);
+                }
                 if ($cnt >= MAX_BOXCARS) {
                     $inbox = new Notice_inbox();
                     $inbox->query($qry);
@@ -1170,7 +1187,7 @@ class Notice extends Memcached_DataObject
         $attachments = $this->attachments();
         if($attachments){
             foreach($attachments as $attachment){
-                if (isset($attachment->filename)) {
+                if ($attachment->isEnclosure()) {
                     $attributes = array('rel'=>'enclosure','href'=>$attachment->url,'type'=>$attachment->mimetype,'length'=>$attachment->size);
                     if($attachment->title){
                         $attributes['title']=$attachment->title;