From 325224d40d3739ef368c092a42863b30483fd97a Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Fri, 15 Sep 2017 23:35:34 +0200 Subject: [PATCH] Fixed octal .ics permissions + tesseract before unlink() image --- build/service/CalendarExtractor.php | 12 +++++++----- build/service/Updater.php | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build/service/CalendarExtractor.php b/build/service/CalendarExtractor.php index aa995a0..7fa8ab2 100644 --- a/build/service/CalendarExtractor.php +++ b/build/service/CalendarExtractor.php @@ -296,10 +296,6 @@ } - /* Remove file */ - unlink($link); - - /* [2] Apply Tesseract =========================================================*/ { @@ -313,6 +309,9 @@ /* (2) Manage error */ }catch(\Exception $e){ + // Remove file // + unlink($link); + return [ 'name' => null, 'location' => null ]; } @@ -324,7 +323,10 @@ /* [3] End procedure =========================================================*/ - /* (1) Return read value */ + /* (1) Remove file */ + unlink($link); + + /* (2) Return read value */ return $read; } diff --git a/build/service/Updater.php b/build/service/Updater.php index 3512f18..84b824f 100644 --- a/build/service/Updater.php +++ b/build/service/Updater.php @@ -60,7 +60,7 @@ $d_name = $this->d_data[1]; file_put_contents(__ROOT__."/tmp/$d_id.ics", "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//xdrm.io//NONSGML v1.0//EN\nMETHOD:PUBLISH\nX-WR-CALNAME: UPPA $d_name\n"); - \chmod(__ROOT__."/tmp/$d_id.ics", 0775); + \chmod(__ROOT__."/tmp/$d_id.ics", 00775); /* (1) Browse each date ---------------------------------------------------------*/ @@ -97,7 +97,7 @@ foreach($this->config->getDiplomes() as $d_id=>$d_name){ file_put_contents(__ROOT__."/tmp/$d_id.ics", "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//xdrm.io//NONSGML v1.0//EN\nMETHOD:PUBLISH\nX-WR-CALNAME:UPPA $d_name\n"); - \chmod(__ROOT__."/tmp/$d_id.ics", 775); + \chmod(__ROOT__."/tmp/$d_id.ics", 0775); /* (1) Browse each date ---------------------------------------------------------*/ @@ -114,10 +114,12 @@ /* (4) Add to file */ file_put_contents(__ROOT__."/tmp/$d_id.ics", $EVENTS, FILE_APPEND); + \chmod(__ROOT__."/tmp/$d_id.ics", 0775); } file_put_contents(__ROOT__."/tmp/$d_id.ics", "END:VCALENDAR", FILE_APPEND); + \chmod(__ROOT__."/tmp/$d_id.ics", 0775); /* (2) Register update ---------------------------------------------------------*/