X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice.php;h=c6ad7d6c4568e912e314da8b4bfd9839d9aa579b;hb=a7ad37f83fcdf611f9a65d38b35ac1874979198c;hp=fc28f355882c3445932470e0d7a366830e7a2935;hpb=e047ba52c7c3f5953336d46fd22715d880002720;p=quix0rs-gnu-social.git diff --git a/classes/Notice.php b/classes/Notice.php index fc28f35588..c6ad7d6c45 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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;