From 2ce1dffbfb6f03a5a28589233c23c76bdfda54fa Mon Sep 17 00:00:00 2001 From: Thomas Hohn <tho@systime.dk> Date: Mon, 19 Dec 2016 06:48:49 +0100 Subject: [PATCH] [TASK] Implement runtime_cache for DataHandler->recUpdateAccessCache Removes "public internal" cache variable and implements runtime_cache instead. Change-Id: I8262a699d60db9e9eb04f23c3f7da78ef7e1149d Resolves: #79071 Releases: master Reviewed-on: https://review.typo3.org/51019 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com> Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Benni Mack <benni@typo3.org> --- .../core/Classes/DataHandling/DataHandler.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 766cdf806701..df1ea262c426 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -6500,19 +6500,19 @@ class DataHandler implements LoggerAwareInterface $res = false; if ($GLOBALS['TCA'][$table] && (int)$id > 0) { + $cacheId = 'checkRecordUpdateAccess' . '_' . $table . '_' . $id; + // If information is cached, return it - if (isset($this->recUpdateAccessCache[$table][$id])) { - return $this->recUpdateAccessCache[$table][$id]; + $cachedValue = $this->runtimeCache->get($cacheId); + if (!empty($cachedValue)) { + return $cachedValue; } - // permissions check for page translations need to be done on the parent page - if ($table === 'pages') { - $defaultLanguagePageId = $this->getDefaultLanguagePageId($id); - $res = $this->doesRecordExist($table, $defaultLanguagePageId, 'edit'); - } else { - $res = $this->doesRecordExist($table, $id, 'edit'); + + if ($this->doesRecordExist($table, $id, 'edit')) { + $res = 1; } // Cache the result - $this->recUpdateAccessCache[$table][$id] = $res; + $this->runtimeCache->set($cacheId, $res); } return $res; } -- GitLab