Skip to content

Commit cf066ee

Browse files
committed
fix getmtime problem after fixing absolute path
1 parent 17cc3ca commit cf066ee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/LogFile.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function logs(): LogReader
5858

5959
public function size(): int
6060
{
61-
return LogViewer::getFilesystem($this->absolutePath)->size($this->path);
61+
return LogViewer::getFilesystem($this->absolutePath)->exists($this->path)
62+
? LogViewer::getFilesystem($this->absolutePath)->size($this->path)
63+
: 0;
6264
}
6365

6466
public function sizeInMB(): float
@@ -111,13 +113,13 @@ public function getLastScannedFilePositionForQuery(?string $query = ''): ?int
111113
public function earliestTimestamp(): int
112114
{
113115
return $this->getMetadata('earliest_timestamp')
114-
?? LogViewer::getFilesystem($this->absolutePath)->lastModified($this->path);
116+
?? LogViewer::getFilesystem($this->absolutePath)->exists($this->path) ? LogViewer::getFilesystem($this->absolutePath)->lastModified($this->path) : 0;
115117
}
116118

117119
public function latestTimestamp(): int
118120
{
119121
return $this->getMetadata('latest_timestamp')
120-
?? LogViewer::getFilesystem($this->absolutePath)->lastModified($this->path);
122+
?? LogViewer::getFilesystem($this->absolutePath)->exists($this->path) ? LogViewer::getFilesystem($this->absolutePath)->lastModified($this->path) : 0;
121123
}
122124

123125
public function scan(int $maxBytesToScan = null, bool $force = false): void

0 commit comments

Comments
 (0)