]> git.mxchange.org Git - friendica.git/commitdiff
Fix wrong check for logfile in admin summary
authorPhilipp Holzer <admin+github@philipp.info>
Mon, 28 Oct 2019 21:24:46 +0000 (22:24 +0100)
committerPhilipp Holzer <admin+github@philipp.info>
Mon, 28 Oct 2019 21:26:34 +0000 (22:26 +0100)
src/Module/Admin/Summary.php

index e1952f294b0207b7a98ad1b62878e88d8c5a9b9e..52b1380148cf996e40c18c3e2e319e6ce6857de3 100644 (file)
@@ -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());
                        }
                }