From af183b60e1745c3768a08e78b5db487a785cc44a Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Tue, 16 Apr 2019 05:46:11 +0200 Subject: [PATCH] [!!!][TASK] Remove auto-unpublishing of workspaces Workspaces had a field called "unpublish_time" which was not accessible for TYPO3 Core since TYPO3 4.5. The field was still processed, but never in use due to side-effects. The functionality has therefore been removed without substitution. Resolves: #81950 Releases: master Change-Id: I6d79b78246103ef485a4d9d0de791b03d10d08a5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60482 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> --- ...verWorkspacesUnpublishingFunctionality.rst | 41 +++++++++++++++++++ .../Private/Language/locallang_tca.xlf | 3 -- .../Classes/Command/AutoPublishCommand.php | 40 ++++-------------- .../Configuration/TCA/sys_workspace.php | 12 ------ typo3/sysext/workspaces/ext_tables.sql | 1 - 5 files changed, 50 insertions(+), 47 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-81950-RemoveLeftoverWorkspacesUnpublishingFunctionality.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-81950-RemoveLeftoverWorkspacesUnpublishingFunctionality.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-81950-RemoveLeftoverWorkspacesUnpublishingFunctionality.rst new file mode 100644 index 000000000000..e785ca970214 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-81950-RemoveLeftoverWorkspacesUnpublishingFunctionality.rst @@ -0,0 +1,41 @@ +.. include:: ../../Includes.txt + +======================================================================== +Breaking: #81950 - Remove leftover workspaces unpublishing functionality +======================================================================== + +See :issue:`81950` + +Description +=========== + +A property within workspaces for "unpublishing" published records has been disabled since TYPO3 4.5. + +This functionality allowed to restore a published workspace which was published at a given time, to revert the changes on another +time, but had side-effects if changes were made between publishing and unpublishing. + +However, this functionality was not visible to TYPO3 out of the box, but only available with a possible third-party integration +since TYPO3 4.5. The feature was therefore removed from TYPO3 Core. + +The (hidden) database field `sys_workspace.unpublish_time` was removed. + + +Impact +====== + +Using the functionality will not work anymore, operating on the database with this field will result in a SQL error. + + +Affected Installations +====================== + +Any installation using the workspace functionality with automatic publishing and a third-party extension for unpublishing. + + +Migration +========= + +If this feature is required for an installation, the field should be re-added by the third-party extension in TCA (which was missing) +and the database which was using the functionality. On top, a custom auto-unpublishing CLI command should be created. + +.. index:: Database, NotScanned, ext:workspaces \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Private/Language/locallang_tca.xlf b/typo3/sysext/core/Resources/Private/Language/locallang_tca.xlf index 7c2e0e9209a7..16e6b72c57f7 100644 --- a/typo3/sysext/core/Resources/Private/Language/locallang_tca.xlf +++ b/typo3/sysext/core/Resources/Private/Language/locallang_tca.xlf @@ -315,9 +315,6 @@ <trans-unit id="sys_workspace.publish_time"> <source>Publish</source> </trans-unit> - <trans-unit id="sys_workspace.unpublish_time"> - <source>Un-Publish</source> - </trans-unit> <trans-unit id="sys_workspace.freeze"> <source>Freeze Editing</source> </trans-unit> diff --git a/typo3/sysext/workspaces/Classes/Command/AutoPublishCommand.php b/typo3/sysext/workspaces/Classes/Command/AutoPublishCommand.php index 15cafe1e663a..a85c775d26ee 100644 --- a/typo3/sysext/workspaces/Classes/Command/AutoPublishCommand.php +++ b/typo3/sysext/workspaces/Classes/Command/AutoPublishCommand.php @@ -62,15 +62,11 @@ class AutoPublishCommand extends Command $affectedWorkspaces = 0; while ($workspaceRecord = $statement->fetch()) { // First, clear start/end time so it doesn't get selected once again - $fieldArray = (int)$workspaceRecord['publish_time'] !== 0 - ? ['publish_time' => 0] - : ['unpublish_time' => 0]; - GeneralUtility::makeInstance(ConnectionPool::class) ->getConnectionForTable('sys_workspace') ->update( 'sys_workspace', - $fieldArray, + ['publish_time' => 0], ['uid' => (int)$workspaceRecord['uid']] ); @@ -106,38 +102,20 @@ class AutoPublishCommand extends Command ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); return $queryBuilder - ->select('uid', 'swap_modes', 'publish_time', 'unpublish_time') + ->select('uid', 'swap_modes', 'publish_time') ->from('sys_workspace') ->where( $queryBuilder->expr()->eq( 'pid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) ), - $queryBuilder->expr()->orX( - $queryBuilder->expr()->andX( - $queryBuilder->expr()->neq( - 'publish_time', - $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) - ), - $queryBuilder->expr()->lte( - 'publish_time', - $queryBuilder->createNamedParameter($GLOBALS['EXEC_TIME'], \PDO::PARAM_INT) - ) - ), - $queryBuilder->expr()->andX( - $queryBuilder->expr()->eq( - 'publish_time', - $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) - ), - $queryBuilder->expr()->neq( - 'unpublish_time', - $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) - ), - $queryBuilder->expr()->lte( - 'unpublish_time', - $queryBuilder->createNamedParameter($GLOBALS['EXEC_TIME'], \PDO::PARAM_INT) - ) - ) + $queryBuilder->expr()->neq( + 'publish_time', + $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT) + ), + $queryBuilder->expr()->lte( + 'publish_time', + $queryBuilder->createNamedParameter($GLOBALS['EXEC_TIME'], \PDO::PARAM_INT) ) ) ->execute(); diff --git a/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php b/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php index c0c61b0b154e..eb17fc9cee41 100644 --- a/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php +++ b/typo3/sysext/workspaces/Configuration/TCA/sys_workspace.php @@ -87,18 +87,6 @@ return [ 'default' => 0, ] ], - 'unpublish_time' => [ - 'label' => 'LLL:EXT:workspaces/Resources/Private/Language/locallang_db.xlf:sys_workspace.unpublish_time', - 'config' => [ - 'type' => 'input', - 'renderType' => 'inputDateTime', - 'eval' => 'datetime,int', - 'default' => 0, - 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038) - ] - ], - ], 'freeze' => [ 'label' => 'LLL:EXT:workspaces/Resources/Private/Language/locallang_db.xlf:sys_workspace.freeze', 'config' => [ diff --git a/typo3/sysext/workspaces/ext_tables.sql b/typo3/sysext/workspaces/ext_tables.sql index 0d737f660fc3..03b5eb59fc8f 100644 --- a/typo3/sysext/workspaces/ext_tables.sql +++ b/typo3/sysext/workspaces/ext_tables.sql @@ -20,7 +20,6 @@ CREATE TABLE sys_workspace ( db_mountpoints varchar(255) DEFAULT '' NOT NULL, file_mountpoints varchar(255) DEFAULT '' NOT NULL, publish_time int(11) DEFAULT '0' NOT NULL, - unpublish_time int(11) DEFAULT '0' NOT NULL, freeze tinyint(3) DEFAULT '0' NOT NULL, live_edit tinyint(3) DEFAULT '0' NOT NULL, vtypes tinyint(3) DEFAULT '0' NOT NULL, -- GitLab