From 81b6f2357da0870675af1bf9ca81b3dce17d292c Mon Sep 17 00:00:00 2001 From: SJ Date: Mon, 24 Feb 2014 10:10:28 +0100 Subject: [PATCH] added garbage collection to viewed images --- util/postinstall.sh.in | 2 +- webui/controller/message/view.php | 4 ++-- webui/model/mail/mail.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/util/postinstall.sh.in b/util/postinstall.sh.in index 93cfdec9..324f77ce 100755 --- a/util/postinstall.sh.in +++ b/util/postinstall.sh.in @@ -291,7 +291,7 @@ make_cron_entries() { echo "*/15 * * * * $INDEXER --quiet tag1 --rotate" >> $CRON_TMP echo "*/15 * * * * $INDEXER --quiet note1 --rotate" >> $CRON_TMP echo "30 6 * * * /usr/bin/php $LIBEXECDIR/piler/generate_stats.php --webui $DOCROOT" >> $CRON_TMP - + echo "*/5 * * * * /usr/bin/find $DOCROOT/tmp -type f -name i.\* -exec rm -f {} \;" >> $CRON_TMP echo "### PILEREND" >> $CRON_TMP } diff --git a/webui/controller/message/view.php b/webui/controller/message/view.php index 561f4bd1..d1d1264d 100644 --- a/webui/controller/message/view.php +++ b/webui/controller/message/view.php @@ -81,13 +81,13 @@ class ControllerMessageView extends Controller { foreach($this->data['attachments'] as $a) { if(preg_match("/image/", $a['type'])) { $attachment = $this->model_search_message->get_attachment_by_id($a['id']); - $fp = fopen(DIR_BASE . 'tmp/' . $a['id'], "w+"); + $fp = fopen(DIR_BASE . 'tmp/' . "i." . $a['id'], "w+"); if($fp) { fwrite($fp, $attachment['attachment']); fclose($fp); $this->data['images'][] = array( - 'name' => $a['id'] + 'name' => "i." . $a['id'] ); } } diff --git a/webui/model/mail/mail.php b/webui/model/mail/mail.php index ceaf5ba2..ef265a53 100644 --- a/webui/model/mail/mail.php +++ b/webui/model/mail/mail.php @@ -47,6 +47,8 @@ class ModelMailMail extends Model { fclose($r); + syslog(LOG_INFO, "sending mail from=$from, rcpt=" . implode(" ", $to) . ", status=$ok"); + return $ok; }