[BUGFIX] SYS_LASTCHANGED is only updated if page is viewed in live or no 59/40259/4
authorRomain L <rolel@smile.fr>
Mon, 15 Jun 2015 16:29:34 +0000 (18:29 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 30 Jun 2015 16:33:27 +0000 (18:33 +0200)
workspace

The SYS_LASTCHANGED field was updated whenever which workspace was loaded,
leading to SYS_LASTCHANGED being updated while no content was
published yet.
This patch changes this behavior by updating SYS_LASTCHANGED only if
page is viewed from the live workspace or no workspace at all.

Resolves: #42158
Releases: master
Change-Id: I09aca547a7b22ba1699f521ea7609053991fed4c
Reviewed-on: http://review.typo3.org/40259
Reviewed-by: Jan Helke <typo3@helke.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Tested-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index e503ea0..0e50347 100644 (file)
@@ -3188,7 +3188,8 @@ class TypoScriptFrontendController {
         * @see ContentObjectRenderer::lastChanged()
         */
        public function setSysLastChanged() {
-               if ($this->page['SYS_LASTCHANGED'] < (int)$this->register['SYS_LASTCHANGED']) {
+               // Draft workspaces are always uid 1 or more. We do not update SYS_LASTCHANGED if we are browsing page from one of theses workspaces
+               if ((int)$this->whichWorkspace() < 1 && $this->page['SYS_LASTCHANGED'] < (int)$this->register['SYS_LASTCHANGED']) {
                        $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid=' . (int)$this->id, array('SYS_LASTCHANGED' => (int)$this->register['SYS_LASTCHANGED']));
                }
        }