Skip to content

Commit

Permalink
Api: Add user notice error when required file does not exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored Apr 10, 2021
1 parent 826fb21 commit e8139a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit e8139a8

Please sign in to comment.