Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions components/ILIAS/Logging/classes/public/class.ilLoggerFactory.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,7 @@
*
*********************************************************************/

declare(strict_types=1);

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
Expand Down Expand Up @@ -127,31 +126,31 @@ public function initUser(string $a_login): void
*/
protected function isConsoleAvailable(): bool
{
if (ilContext::getType() != ilContext::CONTEXT_WEB) {
if (ilContext::getType() !== ilContext::CONTEXT_WEB) {
return false;
}
if (
$this->dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch() ||

if (($this->dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch()) ||
(
$this->dic->isDependencyAvailable('http') &&
strtolower($this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? '') === 'xmlhttprequest'
strtolower(
$this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? ''
) === 'xmlhttprequest'
)
) {
return false;
}

if (
$this->dic->isDependencyAvailable('http') &&
strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'text/html') !== false
) {
if ($this->dic->isDependencyAvailable('http') &&
str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'text/html')) {
return true;
}
if (
$this->dic->isDependencyAvailable('http') &&
strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'application/json') !== false
) {

if ($this->dic->isDependencyAvailable('http') &&
str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'application/json')) {
return false;
}

return true;
}

Expand Down
Loading