Commit 09d5bc0c authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[TASK] Drop workspace publish locking

The workspace 'publish' process is encapsulated in a lock
file to prevent dupblicate publish of the same record at
the same time.

This is bogus:
* Other operations like modify or discard are not covered
* A stalled lock file can only happen if a process crashes
* Nothing else in the DataHandler has similar locking strategies
* The only way to recover from a stalled lock file is "ask your admin",
  which is not helpful in any way.

If the DataHandler (and with that the workspace operations) should
have locking, it needs to be implemented in the DataHandler at a
central place and not within a fraction of the workspace sub set.

The patch drops the publish process locking.

Change-Id: I4004f46eb3dc47bb62347f5bf45a9ed0c6f5da1e
Resolves: #92240
Releases: master, 10.4

Tested-by: default avatarTYPO3com <>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Tested-by: Benni Mack's avatarBenni Mack <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
parent d24af0d0
......@@ -21,7 +21,6 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\WorkspaceAspect;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
......@@ -635,27 +634,7 @@ class DataHandlerHook
$dataHandler->newlog('In swap version, either t3ver_oid was not set or the t3ver_oid didn\'t match the id of the online version as it must!', SystemLogErrorClassification::SYSTEM_ERROR);
// Lock file name:
$lockFileName = Environment::getVarPath() . '/lock/workspaces_swap' . $table . '_' . $id . '.json';
if (@is_file($lockFileName)) {
$lockFileContents = file_get_contents($lockFileName);
$lockFileContents = json_decode($lockFileContents ?: '', true);
// Only skip if the lock file is newer than the last 1h (a publishing process should not be running longer than 60mins)
if (isset($lockFileContents['tstamp']) && $lockFileContents['tstamp'] > ($GLOBALS['EXEC_TIME']-3600)) {
$dataHandler->newlog('A swapping lock file was present. Either another swap process is already running or a previous swap process failed. Ask your administrator to handle the situation.', SystemLogErrorClassification::SYSTEM_ERROR);
// Now start to swap records by first creating the lock file
// Write lock-file:
GeneralUtility::writeFileToTypo3tempDir($lockFileName, (string)json_encode([
'tstamp' => $GLOBALS['EXEC_TIME'],
'user' => $dataHandler->BE_USER->user['username'],
'curVersion' => $curVersion,
'swapVersion' => $swapVersion
// Find fields to keep
$keepFields = $this->getUniqueFields($table);
if ($GLOBALS['TCA'][$table]['ctrl']['sortby']) {
......@@ -788,7 +767,6 @@ class DataHandlerHook
['uid' => (int)$swapWith],
} catch (DBALException $e) {
$sqlErrors[] = $e->getPrevious()->getMessage();
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