Commit 0b58a8af authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Daniel Goerz
Browse files

[TASK] Introduce constants for sys log writer method arguments

There are several places in the core where messages are written
to the database table sys_log. Said table has the following
columns that hold unique integer values:

- type
- action
- error

Until now, those integer values had been directly put into the
log method calls which made the method calls quite unreadable.
All those integer values are now replaced with meaningful
constants.

Releases: master
Resolves: #89483
Change-Id: I808c5f9060967bca4502070cc4d412167eacefa6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62048


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Manuel Selbach's avatarManuel Selbach <manuel_selbach@yahoo.de>
Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Manuel Selbach's avatarManuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
parent b5828dd8
......@@ -20,6 +20,9 @@ use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\SysLog\Action\Login as SystemLogLoginAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -59,7 +62,7 @@ class LogoutController
return;
}
// Logout written to log
$this->getBackendUser()->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', [$this->getBackendUser()->user['username']]);
$this->getBackendUser()->writelog(SystemLogType::LOGIN, SystemLogLoginAction::LOGOUT, SystemLogErrorClassification::MESSAGE, 1, 'User %s logged out from TYPO3 Backend', [$this->getBackendUser()->user['username']]);
/** @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection $backendFormProtection */
$backendFormProtection = FormProtectionFactory::get();
$backendFormProtection->removeSessionTokenFromRegistry();
......
......@@ -31,6 +31,9 @@ use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Session\Backend\Exception\SessionNotFoundException;
use TYPO3\CMS\Core\Session\Backend\SessionBackendInterface;
use TYPO3\CMS\Core\Session\SessionManager;
use TYPO3\CMS\Core\SysLog\Action\Login as SystemLogLoginAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -553,7 +556,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
if ($loginData['status'] === LoginType::LOGOUT) {
if ($this->writeStdLog) {
// $type,$action,$error,$details_nr,$details,$data,$tablename,$recuid,$recpid
$this->writelog(255, 2, 0, 2, 'User %s logged out', [$this->user['username']], '', 0, 0);
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::LOGOUT, SystemLogErrorClassification::MESSAGE, 2, 'User %s logged out', [$this->user['username']], '', 0, 0);
}
$this->logger->info('User logged out. Id: ' . $this->id);
$this->logoff();
......@@ -727,7 +730,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface
// User logged in - write that to the log!
if ($this->writeStdLog && $activeLogin) {
$this->writelog(255, 1, 0, 1, 'User %s logged in from ###IP###', [$tempuser[$this->username_column]], '', '', '');
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::LOGIN, SystemLogErrorClassification::MESSAGE, 1, 'User %s logged in from ###IP###', [$tempuser[$this->username_column]], '', '', '');
}
if ($activeLogin) {
$this->logger->info('User ' . $tempuser[$this->username_column] . ' logged in from ' . GeneralUtility::getIndpEnv('REMOTE_ADDR'));
......
......@@ -19,6 +19,9 @@ use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
use TYPO3\CMS\Core\SysLog\Action\Login as SystemLogLoginAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\TimeTracker\TimeTracker;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -57,7 +60,7 @@ class AuthenticationService extends AbstractAuthenticationService
}
if ((string)$this->login['uident_text'] === '') {
// Failed Login attempt (no password given)
$this->writelog(255, 3, 3, 2, 'Login-attempt from ###IP### for username \'%s\' with an empty password!', [
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::ATTEMPT, SystemLogErrorClassification::SECURITY_NOTICE, 2, 'Login-attempt from ###IP### for username \'%s\' with an empty password!', [
$this->login['uname']
]);
$this->logger->warning(sprintf('Login-attempt from %s, for username \'%s\' with an empty password!', $this->authInfo['REMOTE_ADDR'], $this->login['uname']));
......@@ -67,7 +70,7 @@ class AuthenticationService extends AbstractAuthenticationService
$user = $this->fetchUserRecord($this->login['uname']);
if (!is_array($user)) {
// Failed login attempt (no username found)
$this->writelog(255, 3, 3, 2, 'Login-attempt from ###IP###, username \'%s\' not found!!', [$this->login['uname']]);
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::ATTEMPT, SystemLogErrorClassification::SECURITY_NOTICE, 2, 'Login-attempt from ###IP###, username \'%s\' not found!!', [$this->login['uname']]);
$this->logger->info('Login-attempt from username \'' . $this->login['uname'] . '\' not found!', [
'REMOTE_ADDR' => $this->authInfo['REMOTE_ADDR']
]);
......@@ -127,7 +130,7 @@ class AuthenticationService extends AbstractAuthenticationService
// the failed login but still return '100' to proceed with other services that may follow.
$message = 'Login-attempt from ###IP###, username \'%s\', no suitable hash method found!';
$this->writeLogMessage($message, $submittedUsername);
$this->writelog(255, 3, 3, 1, $message, [$submittedUsername]);
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::ATTEMPT, SystemLogErrorClassification::SECURITY_NOTICE, 1, $message, [$submittedUsername]);
$this->logger->info(sprintf($message, $submittedUsername));
// Not responsible, check other services
return 100;
......@@ -160,7 +163,7 @@ class AuthenticationService extends AbstractAuthenticationService
// Failed login attempt - wrong password
$this->writeLogMessage(TYPO3_MODE . ' Authentication failed - wrong password for username \'%s\'', $submittedUsername);
$message = 'Login-attempt from ###IP###, username \'%s\', password not accepted!';
$this->writelog(255, 3, 3, 1, $message, [$submittedUsername]);
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::ATTEMPT, SystemLogErrorClassification::SECURITY_NOTICE, 1, $message, [$submittedUsername]);
$this->logger->info(sprintf($message, $submittedUsername));
// Responsible, authentication failed, do NOT check other services
return 0;
......@@ -170,7 +173,7 @@ class AuthenticationService extends AbstractAuthenticationService
// Password ok, but configured domain lock not met
$errorMessage = 'Login-attempt from ###IP###, username \'%s\', locked domain \'%s\' did not match \'%s\'!';
$this->writeLogMessage($errorMessage, $user[$this->db_user['username_column']], $configuredDomainLock, $queriedDomain);
$this->writelog(255, 3, 3, 1, $errorMessage, [$user[$this->db_user['username_column']], $configuredDomainLock, $queriedDomain]);
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::ATTEMPT, SystemLogErrorClassification::SECURITY_NOTICE, 1, $errorMessage, [$user[$this->db_user['username_column']], $configuredDomainLock, $queriedDomain]);
$this->logger->info(sprintf($errorMessage, $user[$this->db_user['username_column']], $configuredDomainLock, $queriedDomain));
// Responsible, authentication ok, but domain lock not ok, do NOT check other services
return 0;
......
......@@ -26,6 +26,10 @@ use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\RootLevelRestriction;
use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
use TYPO3\CMS\Core\Resource\ResourceStorage;
use TYPO3\CMS\Core\SysLog\Action as SystemLogGenericAction;
use TYPO3\CMS\Core\SysLog\Action\Login as SystemLogLoginAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Type\Exception\InvalidEnumerationValueException;
......@@ -2143,7 +2147,7 @@ class BackendUserAuthentication extends AbstractUserAuthentication
['workspace_id' => $this->user['workspace_id']],
['uid' => (int)$this->user['uid']]
);
$this->writelog(4, 0, 0, 0, 'User changed workspace to "' . $this->workspace . '"', []);
$this->writelog(SystemLogType::EXTENSION, SystemLogGenericAction::UNDEFINED, SystemLogErrorClassification::MESSAGE, 0, 'User changed workspace to "' . $this->workspace . '"', []);
}
}
......@@ -2374,7 +2378,7 @@ This is a dump of the failures:
$mail->setTo($email)->subject($subject)->text($email_body);
$mail->send();
// Logout written to log
$this->writelog(255, 4, 0, 3, 'Failure warning (%s failures within %s seconds) sent by email to %s', [$rowCount, $secondsBack, $email]);
$this->writelog(SystemLogType::LOGIN, SystemLogLoginAction::SEND_FAILURE_WARNING_EMAIL, SystemLogErrorClassification::MESSAGE, 3, 'Failure warning (%s failures within %s seconds) sent by email to %s', [$rowCount, $secondsBack, $email]);
}
}
}
......
......@@ -18,6 +18,9 @@ use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\SysLog\Action as SystemLogGenericAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\HttpUtility;
......@@ -120,9 +123,9 @@ abstract class AbstractExceptionHandler implements ExceptionHandlerInterface, Si
'sys_log',
[
'userid' => $userId,
'type' => 5,
'action' => 0,
'error' => 2,
'type' => SystemLogType::ERROR,
'action' => SystemLogGenericAction::UNDEFINED,
'error' => SystemLogErrorClassification::SYSTEM_ERROR,
'details_nr' => 0,
'details' => str_replace('%', '%%', $logMessage),
'log_data' => empty($data) ? '' : serialize($data),
......
......@@ -20,6 +20,9 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Log\LogLevel;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\SysLog\Action as SystemLogGenericAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\TimeTracker\TimeTracker;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -216,9 +219,10 @@ class ErrorHandler implements ErrorHandlerInterface, LoggerAwareInterface
'sys_log',
[
'userid' => $userId,
'type' => 5,
'action' => 0,
'error' => $severity,
'type' => SystemLogType::ERROR,
'action' => SystemLogGenericAction::UNDEFINED,
'error' => SystemLogErrorClassification::SYSTEM_ERROR,
'level' => $severity,
'details_nr' => 0,
'details' => str_replace('%', '%%', $logMessage),
'log_data' => empty($data) ? '' : serialize($data),
......
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining non type specific actions
*/
class Action
{
public const UNDEFINED = 0;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog\Action;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible Cache actions
*/
class Cache
{
public const CLEAR = 1;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog\Action;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible Database actions
*/
class Database
{
public const INSERT = 1;
public const UPDATE = 2;
public const DELETE = 3;
public const MOVE = 4;
public const CHECK = 5;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog\Action;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible File actions
*/
class File
{
public const UPLOAD = 1;
public const COPY = 2;
public const MOVE = 3;
public const DELETE = 4;
public const RENAME = 5;
public const NEW_FOLDER = 6;
/*
* The constant is not in use but the xlf file tells that 7 represents unzip
* @see https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/belog/Resources/Private/Language/locallang.xlf#L267
*/
public const UNZIP = 7;
public const NEW_FILE = 8;
public const EDIT = 9;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog\Action;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible Login actions
*/
class Login
{
public const LOGIN = 1;
public const LOGOUT = 2;
public const ATTEMPT = 3;
public const SEND_FAILURE_WARNING_EMAIL = 4;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog\Action;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible Setting actions
*/
class Setting
{
public const CHANGE = 1;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible error types
*/
class Error
{
public const MESSAGE = 0;
public const USER_ERROR = 1;
public const SYSTEM_ERROR = 2;
public const SECURITY_NOTICE = 3;
public const WARNING = 4;
/*
* 100 is a code, which has been introduced by Kasper in his "Todays special" commit:
* @see https://github.com/TYPO3/TYPO3.CMS/commit/7496d6d033
*
* @todo The constant should either be renamed or replaced completely in the future
*/
public const TODAYS_SPECIAL = 100;
}
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Core\SysLog;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* A class defining possible logging types
*/
class Type
{
public const DB = 1;
public const FILE = 2;
public const CACHE = 3;
public const EXTENSION = 4;
public const ERROR = 5;
public const SETTING = 254;
public const LOGIN = 255;
}
......@@ -21,6 +21,8 @@ use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\SysLog\Action as SystemLogGenericAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\AllowAccessHookFixture;
use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\InvalidHookFixture;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -525,7 +527,7 @@ class DataHandlerTest extends UnitTestCase
$backendUser->expects(self::once())->method('writelog');
$this->subject->enableLogging = true;
$this->subject->BE_USER = $backendUser;
$this->subject->log('', 23, 0, 42, 0, 'details');
$this->subject->log('', 23, SystemLogGenericAction::UNDEFINED, 42, SystemLogErrorClassification::MESSAGE, 'details');
}
/**
......@@ -537,7 +539,7 @@ class DataHandlerTest extends UnitTestCase
$backendUser->expects(self::never())->method('writelog');
$this->subject->enableLogging = false;
$this->subject->BE_USER = $backendUser;
$this->subject->log('', 23, 0, 42, 0, 'details');
$this->subject->log('', 23, SystemLogGenericAction::UNDEFINED, 42, SystemLogErrorClassification::MESSAGE, 'details');
}
/**
......@@ -550,7 +552,7 @@ class DataHandlerTest extends UnitTestCase
$this->subject->enableLogging = true;
$this->subject->errorLog = [];
$logDetailsUnique = $this->getUniqueId('details');
$this->subject->log('', 23, 0, 42, 1, $logDetailsUnique);
$this->subject->log('', 23, SystemLogGenericAction::UNDEFINED, 42, SystemLogErrorClassification::USER_ERROR, $logDetailsUnique);
self::assertStringEndsWith($logDetailsUnique, $this->subject->errorLog[0]);
}
......@@ -564,7 +566,7 @@ class DataHandlerTest extends UnitTestCase
$this->subject->enableLogging = true;
$this->subject->errorLog = [];
$logDetails = $this->getUniqueId('details');
$this->subject->log('', 23, 0, 42, 1, '%1$s' . $logDetails . '%2$s', -1, ['foo', 'bar']);
$this->subject->log('', 23, SystemLogGenericAction::UNDEFINED, 42, SystemLogErrorClassification::USER_ERROR, '%1$s' . $logDetails . '%2$s', -1, ['foo', 'bar']);
$expected = 'foo' . $logDetails . 'bar';
self::assertStringEndsWith($expected, $this->subject->errorLog[0]);
}
......
......@@ -31,6 +31,9 @@ use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\SysLog\Action as SystemLogGenericAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -419,7 +422,7 @@ class SchedulerModuleController
$this->addMessage($this->getLanguageService()->getLL('msg.maynotDeleteRunningTask'), FlashMessage::ERROR);
} else {
if ($this->scheduler->removeTask($task)) {
$this->getBackendUser()->writelog(4, 0, 0, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was deleted', [$task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()]);
$this->getBackendUser()->writelog(SystemLogType::EXTENSION, SystemLogGenericAction::UNDEFINED, SystemLogErrorClassification::MESSAGE, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was deleted', [$task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()]);
$this->addMessage($this->getLanguageService()->getLL('msg.deleteSuccess'));
} else {
$this->addMessage($this->getLanguageService()->getLL('msg.deleteError'), FlashMessage::ERROR);
......@@ -1060,7 +1063,7 @@ class SchedulerModuleController
// Save to database
$result = $this->scheduler->saveTask($task);
if ($result) {
$this->getBackendUser()->writelog(4, 0, 0, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was updated', [$task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()]);
$this->getBackendUser()->writelog(SystemLogType::EXTENSION, SystemLogGenericAction::UNDEFINED, SystemLogErrorClassification::MESSAGE, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was updated', [$task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()]);
$this->addMessage($this->getLanguageService()->getLL('msg.updateSuccess'));
} else {
$this->addMessage($this->getLanguageService()->getLL('msg.updateError'), FlashMessage::ERROR);
......@@ -1094,7 +1097,7 @@ class SchedulerModuleController
// Add to database
$result = $this->scheduler->addTask($task);
if ($result) {
$this->getBackendUser()->writelog(4, 0, 0, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was added', [$task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()]);
$this->getBackendUser()->writelog(SystemLogType::EXTENSION, SystemLogGenericAction::UNDEFINED, SystemLogErrorClassification::MESSAGE, 0, 'Scheduler task "%s" (UID: %s, Class: "%s") was added', [$task->getTaskTitle(), $task->getTaskUid(), $task->getTaskClassName()]);
$this->addMessage($this->getLanguageService()->getLL('msg.addSuccess'));
// set the uid of the just created task so that we
......
......@@ -37,6 +37,9 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
use TYPO3\CMS\Core\Resource\ResourceFactory;
use TYPO3\CMS\Core\SysLog\Action\Setting as SystemLogSettingAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\SysLog\Type as SystemLogType;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......@@ -284,7 +287,7 @@ class SetupModuleController
// If something in the uc-array of the user has changed, we save the array...
if ($save_before != $save_after) {
$backendUser->writeUC($backendUser->uc);
$backendUser->writelog(254, 1, 0, 1, 'Personal settings changed', []);
$backendUser->writelog(SystemLogType::SETTING, SystemLogSettingAction::CHANGE, SystemLogErrorClassification::MESSAGE, 1, 'Personal settings changed', []);
$this->setupIsUpdated = true;
}
// Persist data if something has changed:
......
......@@ -31,6 +31,9 @@ use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Mail\MailMessage;
use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
use TYPO3\CMS\Core\SysLog\Action as SystemLogGenericAction;
use TYPO3\CMS\Core\SysLog\Action\Database as DatabaseAction;
use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -231,10 +234,10 @@ class DataHandlerHook
$this->version_clearWSID($table, (int)$id, false, $dataHandler);
}
} else {
$dataHandler->newlog('Tried to delete record from another workspace', 1);
$dataHandler->newlog('Tried to delete record from another workspace', SystemLogErrorClassification::USER_ERROR);
}
} else {
$dataHandler->newlog('Versioning not enabled for record with an online ID (t3ver_oid) given', 2);
$dataHandler->newlog('Versioning not enabled for record with an online ID (t3ver_oid) given', SystemLogErrorClassification::SYSTEM_ERROR);
}
} elseif ($dataHandler->BE_USER->workspaceAllowsLiveEditingInTable($table)) {
// Look, if record is "online" then delete directly.
......@@ -377,7 +380,7 @@ class DataHandlerHook
$recordWasMoved = false;
}
} else {
$dataHandler->newlog('Move attempt failed due to workspace restrictions: ' . implode(' // ', $workspaceAccessBlocked), 1);
$dataHandler->newlog('Move attempt failed due to workspace restrictions: ' . implode(' // ', $workspaceAccessBlocked), SystemLogErrorClassification::USER_ERROR);
}
}
......@@ -660,7 +663,7 @@ class DataHandlerHook
if ($dataHandler->enableLogging) {
$propertyArray = $dataHandler->getRecordProperties($table, $id);
$pid = $propertyArray['pid'];
$dataHandler->log($table, $id, 0, 0, 0, 'Notification email for stage change was sent to "' . $emailRecipients . '"', -1, [], $dataHandler->eventPid($table, $id, $pid));
$dataHandler->log($table, $id, SystemLogGenericAction::UNDEFINED, 0, SystemLogErrorClassification::MESSAGE, 'Notification email for stage change was sent to "' . $emailRecipients . '"', -1, [], $dataHandler->eventPid($table, $id, $pid));
}
}
}
......@@ -711,7 +714,7 @@ class DataHandlerHook
protected function version_setStage($table, $id, $stageId, string $comment, DataHandler $dataHandler, array $notificationAlternativeRecipients = [])
{
if ($errorCode = $dataHandler->BE_USER->workspaceCannotEditOfflineVersion($table, $id)) {
$dataHandler->newlog('Attempt to set stage for record failed: ' . $errorCode, 1);
$dataHandler->newlog('Attempt to set stage for record failed: ' . $errorCode, SystemLogErrorClassification::USER_ERROR);