mirror of
https://github.com/getgrav/grav.git
synced 2026-02-28 09:31:32 +01:00
Fixed Path cannot be empty when viewing non-existent log file [#3270]
This commit is contained in:
@@ -17,12 +17,13 @@
|
||||
* Fixed Grav using blueprints and form fields from disabled plugins
|
||||
* Fixed `FlexIndex::sortBy(['key' => 'ASC'])` having no effect
|
||||
* Fixed default Flex Pages collection ordering to order by filesystem path
|
||||
* Fixed disappearing pages on save if `pages://` stream resolves to multiple folders where the preferred folder doesn't exist
|
||||
* Fixed disappearing pages on save if `pages://` stream resolves to multiple folders where the preferred folder doesn't exist
|
||||
* Fixed Markdown image attribute `loading` [#3251](https://github.com/getgrav/grav/pull/3251)
|
||||
* Fixed `Uri::isValidExtension()` returning false positives
|
||||
* Fixed `page.html` returning duplicated content with `system.pages.redirect_default_route` turned on [#3130](https://github.com/getgrav/grav/issues/3130)
|
||||
* Fixed site redirect with redirect code failing when redirecting to sub-pages [#3035](https://github.com/getgrav/grav/pull/3035/files)
|
||||
* Fixed `Uncaught ValueError: Path cannot be empty` when failing to upload a file [#3265](https://github.com/getgrav/grav/issues/3265)
|
||||
* Fixed `Path cannot be empty` when viewing non-existent log file [#3270](https://github.com/getgrav/grav/issues/3270)
|
||||
|
||||
# v1.7.7
|
||||
## 02/23/2021
|
||||
|
||||
@@ -34,7 +34,7 @@ class LogViewer
|
||||
public function objectTail($filepath, $lines = 1, $desc = true)
|
||||
{
|
||||
$data = $this->tail($filepath, $lines);
|
||||
$tailed_log = explode(PHP_EOL, $data);
|
||||
$tailed_log = $data ? explode(PHP_EOL, $data) : [];
|
||||
$line_objects = [];
|
||||
|
||||
foreach ($tailed_log as $line) {
|
||||
@@ -54,13 +54,13 @@ class LogViewer
|
||||
public function tail($filepath, $lines = 1)
|
||||
{
|
||||
|
||||
$f = @fopen($filepath, "rb");
|
||||
$f = $filepath ? @fopen($filepath, 'rb') : false;
|
||||
if ($f === false) {
|
||||
return false;
|
||||
} else {
|
||||
$buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096));
|
||||
}
|
||||
|
||||
$buffer = ($lines < 2 ? 64 : ($lines < 10 ? 512 : 4096));
|
||||
|
||||
fseek($f, -1, SEEK_END);
|
||||
if (fread($f, 1) != "\n") {
|
||||
$lines -= 1;
|
||||
|
||||
Reference in New Issue
Block a user