Merge pull request #7785 from nupplaphil/bug/7676-is_file_warning
Fix wrong check for logfile in admin summary
This commit is contained in:
commit
41261ba7e1
1 changed files with 15 additions and 7 deletions
|
@ -12,6 +12,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
use Friendica\Model\Register;
|
use Friendica\Model\Register;
|
||||||
use Friendica\Module\BaseAdminModule;
|
use Friendica\Module\BaseAdminModule;
|
||||||
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Util\ConfigFileLoader;
|
use Friendica\Util\ConfigFileLoader;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\FileSystem;
|
use Friendica\Util\FileSystem;
|
||||||
|
@ -85,20 +86,27 @@ class Summary extends BaseAdminModule
|
||||||
try {
|
try {
|
||||||
$stream = $fileSystem->createStream($file);
|
$stream = $fileSystem->createStream($file);
|
||||||
|
|
||||||
if (is_file($stream) &&
|
if (!isset($stream)) {
|
||||||
!is_writeable($stream)) {
|
throw new InternalServerErrorException('Stream is null.');
|
||||||
$warningtext[] = L10n::t('The logfile \'%s\' is not writable. No logging possible', $stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$warningtext[] = L10n::t('The logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage());
|
$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) &&
|
try {
|
||||||
!is_writeable($stream)) {
|
if (!empty($file)) {
|
||||||
$warningtext[] = L10n::t('The logfile \'%s\' is not writable. No logging possible', $stream);
|
$stream = $fileSystem->createStream($file);
|
||||||
|
|
||||||
|
if (!isset($stream)) {
|
||||||
|
throw new InternalServerErrorException('Stream is null.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Throwable $exception) {
|
||||||
|
$warningtext[] = L10n::t('The debug logfile \'%s\' is not usable. No logging possible (error: \'%s\')', $file, $exception->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue