[BUGFIX] Use correct runtime cache identifier for locked records 29/54729/2
authorBenni Mack <benni@typo3.org>
Wed, 22 Nov 2017 22:44:52 +0000 (23:44 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 23 Nov 2017 10:19:45 +0000 (11:19 +0100)
The runtime cache was re-built wrong by using
a custom identifer, thus being called EVERY time a
record is checked. This puts the pagetree DB queries in half.

A simple check (like done previously with $GLOBALS['LOCKED_RECORDS'])
to a simple identifier solves this issue.

Related: #79345
Resolves: #83068
Releases: master, 8.7
Change-Id: Id422fbc81b145db3559c194774334692863b4699
Reviewed-on: https://review.typo3.org/54729
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index c7fdfb3..ac10456 100644 (file)
@@ -3787,13 +3787,13 @@ class BackendUtility
      *
      * @param string $table Table name
      * @param int $uid Record uid
-     * @return array
+     * @return array|bool
      * @internal
      */
     public static function isRecordLocked($table, $uid)
     {
         $runtimeCache = self::getRuntimeCache();
-        $cacheId = 'backend-recordLocked-' . md5($table . '_' . $uid);
+        $cacheId = 'backend-recordLocked';
         $recordLockedCache = $runtimeCache->get($cacheId);
         if ($recordLockedCache !== false) {
             $lockedRecords = $recordLockedCache;
@@ -3864,7 +3864,7 @@ class BackendUtility
             $runtimeCache->set($cacheId, $lockedRecords);
         }
 
-        return $lockedRecords[$table . ':' . $uid];
+        return $lockedRecords[$table . ':' . $uid] ?? false;
     }
 
     /**