From bbac6e8ff530a394e9f61286738cc554e62fbd09 Mon Sep 17 00:00:00 2001
From: Thomas Hohn <tho@systime.dk>
Date: Tue, 13 Dec 2016 21:08:07 +0100
Subject: [PATCH] [BUGFIX] Avoid live ID processing if EXT:version not loaded

DataHandler does not need to force "live ID" processing to
be enabled on RelationHandler when EXT:version is not loaded.

Avoiding this saves some semi-expensive operations inside
the RelationHandler class.

Resolves: #78998
Releases: master
Change-Id: If53cdd73db15352d6f4854a5aef4b407836cb6ce
Reviewed-on: https://review.typo3.org/50970
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Claus Due <claus@phpmind.net>
Tested-by: Thomas Hohn <thomas@hohn.dk>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
---
 typo3/sysext/core/Classes/DataHandling/DataHandler.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 4790f0dff3aa..16811a8904b5 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -40,6 +40,7 @@ use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Service\OpcodeCacheService;
 use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\File\BasicFileUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
@@ -9065,8 +9066,11 @@ class DataHandler
      */
     protected function createRelationHandlerInstance()
     {
+        $isVersionLoaded = ExtensionManagementUtility::isLoaded('version');
         $relationHandler = GeneralUtility::makeInstance(RelationHandler::class);
         $relationHandler->setWorkspaceId($this->BE_USER->workspace);
+        $relationHandler->setUseLiveReferenceIds($isVersionLoaded);
+        $relationHandler->setUseLiveParentIds($isVersionLoaded);
         return $relationHandler;
     }
 
-- 
GitLab