added garbage collection to viewed images

This commit is contained in:
SJ 2014-02-24 10:10:28 +01:00
parent 190ce71af7
commit 81b6f2357d
3 changed files with 5 additions and 3 deletions

View File

@ -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
}

View File

@ -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']
);
}
}

View File

@ -47,6 +47,8 @@ class ModelMailMail extends Model {
fclose($r);
syslog(LOG_INFO, "sending mail from=$from, rcpt=" . implode(" ", $to) . ", status=$ok");
return $ok;
}