summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-11-03 19:49:07 +0100
committerFlorian Pritz <bluewind@xinu.at>2014-11-03 19:49:07 +0100
commit8cdef17f7fa034144cf545a382b9be29ce02507b (patch)
treee9cb2372a8e42dd07bc9fa0c9d5e08f6ebf6ee66
parente6e622b8889424e844d027cb687e5f949157b19c (diff)
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 <bluewind@xinu.at>
-rw-r--r--application/models/mfile.php4
1 files changed, 3 insertions, 1 deletions
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);