[CLEANUP] Simplify updating of timestamp in writeForeignField 54/51454/2
authorThomas Hohn <tho@systime.dk>
Thu, 15 Dec 2016 10:45:22 +0000 (11:45 +0100)
committerAndreas Fernandez <typo3@scripting-base.de>
Sun, 29 Jan 2017 11:16:21 +0000 (12:16 +0100)
There is no need to check the record we are updating -
since we update it anyway, update timestamp too and
save both a call to getRecord and a loop through fields,
casting and checking each field value comparing to DB.

Change-Id: Ic807030c5cea83d36e543ed0f75cf980c3872d1e
Releases: master, 7.6
Resolves: #79004
Reviewed-on: https://review.typo3.org/51454
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/core/Classes/Database/RelationHandler.php

index a19157f..ebb5932 100644 (file)
@@ -938,21 +938,7 @@ class RelationHandler
                 if (!empty($updateValues)) {
                     // Update tstamp if any foreign field value has changed
                     if (!empty($GLOBALS['TCA'][$table]['ctrl']['tstamp'])) {
-                        $currentRow = BackendUtility::getRecord($table, $uid, implode(',', array_keys($updateValues)), '', true);
-                        $needTstampUpdate = false;
-                        if (empty($currentRow)) {
-                            $needTstampUpdate = true;
-                        } else {
-                            foreach ($currentRow as $field => $curValue) {
-                                if ((string)$curValue !== (string)$updateValues[$field]) {
-                                    $needTstampUpdate = true;
-                                    break;
-                                }
-                            }
-                        }
-                        if ($needTstampUpdate) {
-                            $updateValues[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
-                        }
+                        $updateValues[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
                     }
 
                     $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . (int)$uid, $updateValues);