From e8139a82d31b2ac97222711b4c3f60b102ae0851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Sat, 10 Apr 2021 10:27:28 +0200 Subject: [PATCH] Api: Add user notice error when required file does not exist. --- src/Api.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Api.php b/src/Api.php index 399c6a8..c1c7097 100644 --- a/src/Api.php +++ b/src/Api.php @@ -90,11 +90,15 @@ public function run(string $path): void $topModTime = 0; if ($data !== []) { // 3. foreach ($data[$format] ?? [] as $file) { - if (is_file($filePath = $this->basePath . '/' . trim($file, '/')) === true) { - if (($modificationTime = (int) filemtime($filePath)) > 0 && $modificationTime > $topModTime) { + $filePath = $this->basePath . '/' . trim($file, '/'); + if (is_file($filePath) === true) { + $modificationTime = (int) filemtime($filePath); + if ($modificationTime > 0 && $modificationTime > $topModTime) { $topModTime = $modificationTime; } $filePaths[$file] = $filePath; + } else { + trigger_error('File "' . $file . '" does not exist. Path: ' . $filePath); } } }