Fix wrong check for logfile in admin summary

This commit is contained in:
Philipp Holzer 2019-10-28 22:24:46 +01:00
parent f2c0877d70
commit dc4d3842e0
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90

View 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());
}
}