fix(occ): Do not attempt to send headers on CLI

This avoids errors like 'Cannot modify header information - headers already sent',
 when using --debug-log with occ.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2026-02-24 10:22:13 +01:00
parent e61f0074f0
commit f885d7292f
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -766,9 +766,10 @@ class OC {
self::checkConfig();
self::checkInstalled($systemConfig);
self::addSecurityHeaders();
self::performSameSiteCookieProtection($config);
if (!self::$CLI) {
self::addSecurityHeaders();
self::performSameSiteCookieProtection($config);
}
if (!defined('OC_CONSOLE')) {
$eventLogger->start('check_server', 'Run a few configuration checks');