From 8cdef17f7fa034144cf545a382b9be29ce02507b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 3 Nov 2014 19:49:07 +0100 Subject: mfile->delete_id: Check for file before trying to unlink file->cron unlinks the file and then deletes the hash which causes an error in mfile->delete_id because the file no longer exists. Signed-off-by: Florian Pritz --- application/models/mfile.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/models/mfile.php b/application/models/mfile.php index eef37c4b3..c9827b6fd 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -240,7 +240,9 @@ class Mfile extends CI_Model { if ($filedata !== false) { assert(isset($filedata["hash"])); if ($this->unused_file($filedata['hash'])) { - unlink($this->file($filedata['hash'])); + if (file_exists($this->file($filedata['hash']))) { + unlink($this->file($filedata['hash'])); + } $dir = $this->folder($filedata['hash']); if (count(scandir($dir)) == 2) { rmdir($dir); -- cgit v1.2.3-24-g4f1b