From dc4d3842e02487b00ae8419f76b3272cc3633121 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 28 Oct 2019 22:24:46 +0100 Subject: [PATCH 1/2] Fix wrong check for logfile in admin summary --- src/Module/Admin/Summary.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index e1952f294b..52b1380148 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -12,6 +12,7 @@ use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\Model\Register; use Friendica\Module\BaseAdminModule; +use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; use Friendica\Util\FileSystem; @@ -85,20 +86,27 @@ class Summary extends BaseAdminModule try { $stream = $fileSystem->createStream($file); - if (is_file($stream) && - !is_writeable($stream)) { - $warningtext[] = L10n::t('The logfile \'%s\' is not writable. No logging possible', $stream); + if (!isset($stream)) { + throw new InternalServerErrorException('Stream is null.'); } } catch (\Throwable $exception) { $warningtext[] = L10n::t('The logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage()); } - $stream = Config::get('system', 'dlogfile'); + $file = Config::get('system', 'dlogfile'); - if (is_file($stream) && - !is_writeable($stream)) { - $warningtext[] = L10n::t('The logfile \'%s\' is not writable. No logging possible', $stream); + try { + if (!empty($file)) { + $stream = $fileSystem->createStream($file); + + if (!isset($stream)) { + throw new InternalServerErrorException('Stream is null.'); + } + } + + } catch (\Throwable $exception) { + $warningtext[] = L10n::t('The developer logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage()); } } From f8e43ddf8d8c3f9a79270b6b258f7fd89ee79077 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Fri, 1 Nov 2019 15:59:00 +0100 Subject: [PATCH 2/2] rename developer to debug :-) --- src/Module/Admin/Summary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index 52b1380148..cfd9aa9840 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -106,7 +106,7 @@ class Summary extends BaseAdminModule } } catch (\Throwable $exception) { - $warningtext[] = L10n::t('The developer logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage()); + $warningtext[] = L10n::t('The debug logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage()); } }