Commit 6a3ee818 authored by Marc Willmann's avatar Marc Willmann Committed by Anja Leichsenring
Browse files

[BUGFIX] Don't set resource storages permanently offline automatically

When the storage drive coudn't be initialized correctly the storage is
only put offline for the current request. The error thrown by the driver
is logged to database table sys_log as well.

Resolves: #75184
Releases: master, 7.6
Change-Id: I4b05b732f887c0679e9cdda77793e4b304ac3fdb
Reviewed-on: https://review.typo3.org/50371

Reviewed-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader's avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 1eca31f3
...@@ -180,9 +180,17 @@ class ResourceStorage implements ResourceStorageInterface ...@@ -180,9 +180,17 @@ class ResourceStorage implements ResourceStorageInterface
try { try {
$this->driver->processConfiguration(); $this->driver->processConfiguration();
} catch (Exception\InvalidConfigurationException $e) { } catch (Exception\InvalidConfigurationException $e) {
// configuration error // Configuration error
// mark this storage as permanently unusable $this->isOnline = false;
$this->markAsPermanentlyOffline();
$message = sprintf(
'Failed initializing storage [%d] "%s", error: %s',
$this->getUid(),
$this->getName(),
$e->getMessage()
);
$this->getLogger()->error($message);
} }
$this->driver->initialize(); $this->driver->initialize();
$this->capabilities = $this->driver->getCapabilities(); $this->capabilities = $this->driver->getCapabilities();
...@@ -3012,4 +3020,26 @@ class ResourceStorage implements ResourceStorageInterface ...@@ -3012,4 +3020,26 @@ class ResourceStorage implements ResourceStorageInterface
{ {
return $this->isDefault; return $this->isDefault;
} }
/**
* Returns the current BE user.
*
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
*/
protected function getBackendUser()
{
return $GLOBALS['BE_USER'];
}
/**
* @return \TYPO3\CMS\Core\Log\Logger
*/
protected function getLogger()
{
/** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
$logManager = GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Log\LogManager::class
);
return $logManager->getLogger(get_class($this));
}
} }
...@@ -1159,6 +1159,21 @@ return [ ...@@ -1159,6 +1159,21 @@ return [
\TYPO3\CMS\Core\Log\LogLevel::WARNING => [ \TYPO3\CMS\Core\Log\LogLevel::WARNING => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [] \TYPO3\CMS\Core\Log\Writer\FileWriter::class => []
] ]
],
'TYPO3' => [
'CMS' => [
'Core' => [
'Resource' => [
'ResourceStorage' => [
'writerConfiguration' => [
\TYPO3\CMS\Core\Log\LogLevel::ERROR => [
\TYPO3\CMS\Core\Log\Writer\DatabaseWriter::class => []
]
]
]
]
]
]
] ]
], ],
'USER' => [], 'USER' => [],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment