Skip to content

Commit a5fd589

Browse files
committed
Merge branch 'fix-getmtime' of https://github.com/Florisbosch/log-viewer into fix-getmtime
2 parents cf066ee + 734cfe2 commit a5fd589

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

config/log-viewer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@
6666
|--------------------------------------------------------------------------
6767
|
6868
*/
69-
'disable_absolute_filepaths' => env('LOG_VIEWER_DISABLE_ABSOLUTE_FILEPATHS', false),
69+
'disable_absolute_filepaths' => env('LOG_VIEWER_DISABLE_ABSOLUTE_FILEPATHS', false),
7070

7171
'filesystem' => [
72-
'root' => env('LOG_VIEWER_FILESYSTEM_ROOT',''),
72+
'root' => env('LOG_VIEWER_FILESYSTEM_ROOT', ''),
7373
'disk' => env('LOG_VIEWER_FILESYSTEM_DISK', 'log-viewer-local'),
7474
],
7575

src/LogFile.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Opcodes\LogViewer\Exceptions\InvalidRegularExpression;
99
use Opcodes\LogViewer\Facades\LogViewer;
1010
use Opcodes\LogViewer\Utils\Utils;
11-
use Symfony\Component\HttpFoundation\BinaryFileResponse;
1211
use Symfony\Component\HttpFoundation\StreamedResponse;
1312

1413
class LogFile
@@ -17,10 +16,15 @@ class LogFile
1716
use Concerns\LogFile\CanCacheData;
1817

1918
public string $path;
19+
2020
public string $name;
21+
2122
public string $identifier;
23+
2224
public string $absolutePath = '';
25+
2326
public string $subFolder = '';
27+
2428
private array $_logIndexCache;
2529

2630
public function __construct(string $path)
@@ -36,7 +40,7 @@ public function __construct(string $path)
3640

3741
if (str_starts_with($path, DIRECTORY_SEPARATOR)) {
3842
$this->absolutePath = pathinfo($path)['dirname'];
39-
$this->path = pathinfo($path)['basename'];
43+
$this->path = pathinfo($path)['basename'];
4044
}
4145

4246
$this->loadMetadata();

src/LogViewerService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function getFilePathsMatchingPattern($pattern, $absolute = false): arr
6464
{
6565
$files = [];
6666

67-
if (!$absolute) {
67+
if (! $absolute) {
6868
$scannedFiles = $this->getFilesystem()->allFiles($this->basePathForLogs());
6969
} else {
7070
$pathInfo = pathinfo($pattern);
@@ -74,11 +74,10 @@ protected function getFilePathsMatchingPattern($pattern, $absolute = false): arr
7474
$scannedFiles = $this->getFilesystem($dirname)->allFiles();
7575
}
7676

77-
foreach($scannedFiles as $file)
78-
{
77+
foreach ($scannedFiles as $file) {
7978
if (preg_match(pattern: Glob::toRegex(glob: $pattern), subject: $file)) {
8079
$files[] = isset($dirname)
81-
? $dirname . DIRECTORY_SEPARATOR . $file
80+
? $dirname.DIRECTORY_SEPARATOR.$file
8281
: $file;
8382
}
8483
}
@@ -89,6 +88,7 @@ protected function getFilePathsMatchingPattern($pattern, $absolute = false): arr
8988
public function basePathForLogs(): string
9089
{
9190
$rootFolder = Str::of(config('log-viewer.filesystem.root'));
91+
9292
return empty($rootFolder)
9393
? $rootFolder->finish('/')
9494
: $rootFolder;
@@ -171,7 +171,7 @@ public function getRouteMiddleware(): array
171171

172172
public function getFilesystem($absolutePath = ''): Filesystem
173173
{
174-
if (!config('disable_absolute_filepaths') && ($absolutePath !== '') && is_dir($absolutePath)) {
174+
if (! config('disable_absolute_filepaths') && ($absolutePath !== '') && is_dir($absolutePath)) {
175175
config()->set('filesystems.disks.log-viewer-absolute', [
176176
'driver' => 'local',
177177
'root' => $absolutePath,

0 commit comments

Comments
 (0)