Project

General

Profile

Bug #93572 » SimpleDataHandlerController.diff

Stefan L, 2023-11-20 09:13

View differences:

public/typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\Lock\Lock;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\FlockStore;
use Symfony\Component\Lock\Store\SemaphoreStore;
use Throwable;
use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
......
}
}
protected function lock(string $name): ?Lock
{
if (SemaphoreStore::isSupported()) {
$store = new SemaphoreStore();
} else {
$store = new FlockStore();
}
$lock = (new LockFactory($store))->createLock($name, 300);
if (!$lock->acquire(true)) {
$lock = null;
}
return $lock;
}
/**
* Executing the posted actions ...
*/
protected function processRequest(): void
{
$lock = $this->lock('TYPO3\CMS\Backend\Controller\SimpleDataHandlerController::processRequest');
// LOAD DataHandler with data and cmd arrays:
$this->tce->start($this->data, $this->cmd);
if ($this->mirror !== []) {
$this->tce->setMirror($this->mirror);
}
// Execute actions:
$this->tce->process_datamap();
$this->tce->process_cmdmap();
try {
// Execute actions:
$this->tce->process_datamap();
$this->tce->process_cmdmap();
} catch (Throwable $throwable) {
$lock?->release();
throw $throwable;
}
$lock?->release();
// Clearing cache:
if (!empty($this->cacheCmd)) {
$this->tce->clear_cacheCmd($this->cacheCmd);
(2-2/2)