From 407df19d7aeda8ace4de28820766be512e734459 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Tue, 23 Feb 2016 15:35:21 +0100 Subject: [PATCH] remove temp file only when all edit instances are closed --- controller/documentcontroller.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/documentcontroller.php b/controller/documentcontroller.php index 42f162c1..e8e0c404 100644 --- a/controller/documentcontroller.php +++ b/controller/documentcontroller.php @@ -209,7 +209,11 @@ class DocumentController extends Controller{ $filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . $basename; - unlink($filename); + // remove temp file only when all edit instances are closed + $stat = stat($filename); + if ($stat['nlink'] == 1){ + unlink($filename); + } return array( 'status' => 'success'