[!!!][TASK] Workspaces: Always consider references 19/54319/5
authorBenni Mack <benni@typo3.org>
Sun, 8 Oct 2017 12:33:06 +0000 (14:33 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Tue, 10 Oct 2017 10:16:41 +0000 (12:16 +0200)
Previously, it was possible to disable the handling
of references / child-parent relations in workspaces
on publishing, due to legacy functionality this was
an option introduced back in v4.

The behaviour (option switch via TSconfig) was
enabled by default on all installations.

It automatically resolves dependencies
(= publishing dependencies in relations automatically),
having this option disabled could lead to side effects
in the past.

Resolves: #82701
Releases: master
Change-Id: I4f152fd337e4c405eaa0f1386601629a688a05d4
Reviewed-on: https://review.typo3.org/54319
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Henning Liebe <h.liebe@neusta.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Documentation/Changelog/master/Breaking-82701-AlwaysConsiderPublishingReferencesInWorkspaces.rst [new file with mode: 0644]
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/version/Classes/DataHandler/CommandMap.php
typo3/sysext/workspaces/Documentation/Administration/Configuration/Index.rst
typo3/sysext/workspaces/ext_localconf.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82701-AlwaysConsiderPublishingReferencesInWorkspaces.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82701-AlwaysConsiderPublishingReferencesInWorkspaces.rst
new file mode 100644 (file)
index 0000000..9959695
--- /dev/null
@@ -0,0 +1,39 @@
+.. include:: ../../Includes.txt
+
+======================================================================
+Breaking: #82701 - Always consider publishing references in workspaces
+======================================================================
+
+See :issue:`82701`
+
+Description
+===========
+
+The TSconfig option `options.workspaces.considerReferences` to disable references when publishing
+records from a workspace has been removed.
+
+The according method `TYPO3\CMS\Version\DataHandler\CommandMap::setWorkspacesConsiderReferences()`
+has been removed.
+
+
+Impact
+======
+
+Disabling this setting will have no effect anymore, thus publishing records will always
+publish relations e.g. in IRRE relations as well.
+
+Calling the removed PHP method will throw a PHP fatal error.
+
+
+Affected Installations
+======================
+
+Installations with workspaces enabled, having the TSconfig option explicitly disabled.
+
+
+Migration
+=========
+
+Remove any calls to the method, as it has no effect anymore.
+
+.. index:: TSConfig, PartiallyScanned
index 5d8a5c4..6da30b7 100644 (file)
@@ -1261,4 +1261,11 @@ return [
             'Breaking-80700-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
+    'TYPO3\CMS\Version\DataHandler\CommandMap->setWorkspacesConsiderReferences' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Breaking-82701-AlwaysConsiderPublishingReferencesInWorkspaces.rst',
+        ],
+    ],
 ];
index d4197f2..3f2315f 100644 (file)
@@ -27,14 +27,11 @@ class CommandMap
     const SCOPE_WorkspacesSwap = 'SCOPE_WorkspacesSwap';
     const SCOPE_WorkspacesSetStage = 'SCOPE_WorkspacesSetStage';
     const SCOPE_WorkspacesClear = 'SCOPE_WorkspacesClear';
-    const KEY_ScopeErrorMessage = 'KEY_ScopeErrorMessage';
-    const KEY_ScopeErrorCode = 'KEY_ScopeErrorCode';
     const KEY_GetElementPropertiesCallback = 'KEY_GetElementPropertiesCallback';
     const KEY_GetCommonPropertiesCallback = 'KEY_GetCommonPropertiesCallback';
     const KEY_ElementConstructCallback = 'KEY_EventConstructCallback';
     const KEY_ElementCreateChildReferenceCallback = 'KEY_ElementCreateChildReferenceCallback';
     const KEY_ElementCreateParentReferenceCallback = 'KEY_ElementCreateParentReferenceCallback';
-    const KEY_PurgeWithErrorMessageGetIdCallback = 'KEY_PurgeWithErrorMessageGetIdCallback';
     const KEY_UpdateGetIdCallback = 'KEY_UpdateGetIdCallback';
     const KEY_TransformDependentElementsToUseLiveId = 'KEY_TransformDependentElementsToUseLiveId';
 
@@ -68,11 +65,6 @@ class CommandMap
      */
     protected $workspacesChangeStageMode;
 
-    /**
-     * @var bool
-     */
-    protected $workspacesConsiderReferences;
-
     /**
      * @var array
      */
@@ -99,7 +91,6 @@ class CommandMap
         $this->setWorkspace($workspace);
         $this->setWorkspacesSwapMode($this->getTceMain()->BE_USER->getTSConfigVal('options.workspaces.swapMode'));
         $this->setWorkspacesChangeStageMode($this->getTceMain()->BE_USER->getTSConfigVal('options.workspaces.changeStageMode'));
-        $this->setWorkspacesConsiderReferences($this->getTceMain()->BE_USER->getTSConfigVal('options.workspaces.considerReferences'));
         $this->constructScopes();
     }
 
@@ -215,19 +206,6 @@ class CommandMap
         return $this;
     }
 
-    /**
-     * Sets the workspace behaviour to automatically consider references
-     * (see options.workspaces.considerReferences)
-     *
-     * @param bool $workspacesConsiderReferences
-     * @return \TYPO3\CMS\Version\DataHandler\CommandMap
-     */
-    public function setWorkspacesConsiderReferences($workspacesConsiderReferences)
-    {
-        $this->workspacesConsiderReferences = (bool)$workspacesConsiderReferences;
-        return $this;
-    }
-
     /**
      * Gets the element entity processor.
      *
@@ -488,7 +466,7 @@ class CommandMap
 
     /**
      * Applies the workspaces dependencies and removes incomplete structures or automatically
-     * completes them, depending on the options.workspaces.considerReferences setting
+     * completes them
      *
      * @param \TYPO3\CMS\Version\Dependency\DependencyResolver $dependency
      * @param string $scope
@@ -512,37 +490,11 @@ class CommandMap
             // and the evaluation of all dependent records that should be used for this action instead:
             $intersectingElements = array_intersect_key($dependentElements, $elementsToBeVersioned);
             if (!empty($intersectingElements)) {
-                // If at least one element intersects but not all, throw away all elements of the depdendent structure:
-                if (count($intersectingElements) !== count($dependentElements) && $this->workspacesConsiderReferences === false) {
-                    $this->purgeWithErrorMessage($intersectingElements, $scope);
-                } else {
-                    $this->update(current($intersectingElements), $dependentElements, $scope);
-                }
+                $this->update(current($intersectingElements), $dependentElements, $scope);
             }
         }
     }
 
-    /**
-     * Purges incomplete structures from the command map and triggers an error message.
-     *
-     * @param array $elements
-     * @param string $scope
-     */
-    protected function purgeWithErrorMessage(array $elements, $scope)
-    {
-        /** @var $element ElementEntity */
-        foreach ($elements as $element) {
-            $table = $element->getTable();
-            $id = $this->processCallback($this->getScopeData($scope, self::KEY_PurgeWithErrorMessageGetIdCallback), [$element]);
-            $this->remove($table, $id, 'version');
-            $this->getTceMain()->log($table, $id, 5, 0, 1, $this->getScopeData($scope, self::KEY_ScopeErrorMessage), $this->getScopeData($scope, self::KEY_ScopeErrorCode), [
-                BackendUtility::getRecordTitle($table, BackendUtility::getRecord($table, $id)),
-                $table,
-                $id
-            ]);
-        }
-    }
-
     /**
      * Updates the command map accordant to valid structures and takes care of the correct order.
      *
@@ -757,9 +709,6 @@ class CommandMap
         $this->scopes = [
             // settings for publishing and swapping:
             self::SCOPE_WorkspacesSwap => [
-                // error message and error code
-                self::KEY_ScopeErrorMessage => 'Record "%s" (%s:%s) cannot be swapped or published independently, because it is related to other new or modified records.',
-                self::KEY_ScopeErrorCode => 1288283630,
                 // callback functons used to modify the commandMap
                 // + element properties are specific for each element
                 // + common properties are the same for all elements
@@ -770,8 +719,6 @@ class CommandMap
                 // callback function used to determine whether an element is a valid child or parent reference (e.g. IRRE)
                 self::KEY_ElementCreateChildReferenceCallback => 'createNewDependentElementChildReferenceCallback',
                 self::KEY_ElementCreateParentReferenceCallback => 'createNewDependentElementParentReferenceCallback',
-                // callback function used to get the correct record uid to be used in the error message
-                self::KEY_PurgeWithErrorMessageGetIdCallback => 'getElementLiveIdCallback',
                 // callback function used to fetch the correct record uid on modifying the commandMap
                 self::KEY_UpdateGetIdCallback => 'getElementLiveIdCallback',
                 // setting whether to use the uid of the live record instead of the workspace record
@@ -779,9 +726,6 @@ class CommandMap
             ],
             // settings for modifying the stage:
             self::SCOPE_WorkspacesSetStage => [
-                // error message and error code
-                self::KEY_ScopeErrorMessage => 'Record "%s" (%s:%s) cannot be sent to another stage independently, because it is related to other new or modified records.',
-                self::KEY_ScopeErrorCode => 1289342524,
                 // callback functons used to modify the commandMap
                 // + element properties are specific for each element
                 // + common properties are the same for all elements
@@ -792,8 +736,6 @@ class CommandMap
                 // callback function used to determine whether an element is a valid child or parent reference (e.g. IRRE)
                 self::KEY_ElementCreateChildReferenceCallback => 'createNewDependentElementChildReferenceCallback',
                 self::KEY_ElementCreateParentReferenceCallback => 'createNewDependentElementParentReferenceCallback',
-                // callback function used to get the correct record uid to be used in the error message
-                self::KEY_PurgeWithErrorMessageGetIdCallback => 'getElementIdCallback',
                 // callback function used to fetch the correct record uid on modifying the commandMap
                 self::KEY_UpdateGetIdCallback => 'getElementIdCallback',
                 // setting whether to use the uid of the live record instead of the workspace record
@@ -801,9 +743,6 @@ class CommandMap
             ],
             // settings for clearing and flushing:
             self::SCOPE_WorkspacesClear => [
-                // error message and error code
-                self::KEY_ScopeErrorMessage => 'Record "%s" (%s:%s) cannot be flushed independently, because it is related to other new or modified records.',
-                self::KEY_ScopeErrorCode => 1300467990,
                 // callback functons used to modify the commandMap
                 // + element properties are specific for each element
                 // + common properties are the same for all elements
@@ -814,8 +753,6 @@ class CommandMap
                 // callback function used to determine whether an element is a valid child or parent reference (e.g. IRRE)
                 self::KEY_ElementCreateChildReferenceCallback => 'createClearDependentElementChildReferenceCallback',
                 self::KEY_ElementCreateParentReferenceCallback => 'createClearDependentElementParentReferenceCallback',
-                // callback function used to get the correct record uid to be used in the error message
-                self::KEY_PurgeWithErrorMessageGetIdCallback => 'getElementIdCallback',
                 // callback function used to fetch the correct record uid on modifying the commandMap
                 self::KEY_UpdateGetIdCallback => 'getElementIdCallback',
                 // setting whether to use the uid of the live record instead of the workspace record
index 01fc0b3..91fc8c0 100644 (file)
@@ -243,21 +243,6 @@ Description
 
 .. _usertsconfig-options-workspaces-considerreferences:
 
-considerReferences
-******************
-
-Data type
-  Boolean
-
-Description
-  If elements which are part of an interdependent structure (e.g. Inline
-  Relational Record Editing) are swapped, published or sent to a stage
-  alone, the whole related parent/child structure is taken into account
-  automatically.
-
-Default
-  1
-
 allowed\_languages
 ******************
 
index 4005ec7..3b119dc 100644 (file)
@@ -34,10 +34,7 @@ if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations
 }
 
 if (TYPO3_MODE === 'BE') {
-    // If publishing/swapping dependent parent-child references, consider all parents and children
-    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('options.workspaces.considerReferences = 1');
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'][] = \TYPO3\CMS\Workspaces\Hooks\PagetreeCollectionsProcessor::class;
-
     $GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'][1435433114] = \TYPO3\CMS\Workspaces\Backend\ToolbarItems\WorkspaceSelectorToolbarItem::class;
 
     // Registers preview link icon