Commit a6b66436 authored by Sascha Egerer's avatar Sascha Egerer Committed by Christian Kuhn
Browse files

[TASK] Introduce Enum constants for t3ver_state

Currently the t3ver_state field can have 6
different integer values.
To clean up the code and make it better
understandable a Enum object is implemented.

Resolves: #52551
Releases: 6.2
Change-Id: I2f41d6bbf6575aec4a5c2b6d86495700d61bf5b7
Reviewed-on: https://review.typo3.org/24410
Reviewed-by: Sebastian Fischer
Tested-by: Sebastian Fischer
Reviewed-by: Thorsten Kahler
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent 62b9eda0
......@@ -31,6 +31,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* Page Tree and Context Menu Commands
......@@ -363,10 +364,17 @@ class Commands {
$spriteIconCode = IconUtility::getSpriteIcon('apps-pagetree-root');
}
$subNode->setSpriteIconCode($spriteIconCode);
if (!$subNode->canCreateNewPages() || intval($record['t3ver_state']) === 2) {
if (
!$subNode->canCreateNewPages()
|| VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
) {
$subNode->setIsDropTarget(FALSE);
}
if (!$subNode->canBeEdited() || !$subNode->canBeRemoved() || intval($record['t3ver_state']) === 2) {
if (
!$subNode->canBeEdited()
|| !$subNode->canBeRemoved()
|| VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
) {
$subNode->setDraggable(FALSE);
}
return $subNode;
......
......@@ -26,7 +26,10 @@ namespace TYPO3\CMS\Backend\Tree\Pagetree;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* Node designated for the page tree
*
* @author Stefan Galinski <stefan.galinski@gmail.com>
......@@ -224,7 +227,11 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
* @return boolean
*/
public function canBeCut() {
return $this->canEdit($this->record) && intval($this->record['t3ver_state']) !== 2 && $GLOBALS['BE_USER']->checkLanguageAccess(0);
return (
$this->canEdit($this->record)
&& !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
&& $GLOBALS['BE_USER']->checkLanguageAccess(0)
);
}
/**
......@@ -242,7 +249,12 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
* @return boolean
*/
public function canBeCopied() {
return $this->canCreate($this->record) && intval($this->record['t3ver_state']) !== 2 && $GLOBALS['BE_USER']->checkLanguageAccess(0);
return (
$this->canCreate($this->record)
&& !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
&& $GLOBALS['BE_USER']->checkLanguageAccess(0)
);
}
/**
......@@ -260,7 +272,11 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
* @return boolean
*/
public function canBeRemoved() {
return $this->canRemove($this->record) && intval($this->record['t3ver_state']) !== 2 && $GLOBALS['BE_USER']->checkLanguageAccess(0);
return (
$this->canRemove($this->record)
&& !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
&& $GLOBALS['BE_USER']->checkLanguageAccess(0)
);
}
/**
......@@ -269,7 +285,11 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
* @return boolean
*/
public function canBePastedInto() {
return $this->canCreate($this->record) && intval($this->record['t3ver_state']) !== 2 && $GLOBALS['BE_USER']->checkLanguageAccess(0);
return (
$this->canCreate($this->record)
&& !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
&& $GLOBALS['BE_USER']->checkLanguageAccess(0)
);
}
/**
......@@ -278,7 +298,11 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
* @return boolean
*/
public function canBePastedAfter() {
return $this->canCreate($this->record) && intval($this->record['t3ver_state']) !== 2 && $GLOBALS['BE_USER']->checkLanguageAccess(0);
return (
$this->canCreate($this->record)
&& !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
&& $GLOBALS['BE_USER']->checkLanguageAccess(0)
);
}
/**
......
......@@ -67,7 +67,7 @@ class BrowseTreeView extends \TYPO3\CMS\Backend\Tree\View\AbstractTreeView {
$hideList = explode(',', $pidList);
$this->MOUNTS = array_diff($this->MOUNTS, $hideList);
}
$this->fieldArray = array_merge($this->fieldArray, array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_state', 't3ver_move_id'));
$this->fieldArray = array_merge($this->fieldArray, array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_move_id'));
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
$this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'is_siteroot', 'nav_hide'));
}
......
......@@ -35,6 +35,7 @@ use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Frontend\Page\PageRepository;
/**
......@@ -1649,20 +1650,20 @@ class BackendUtility {
if ($row['pid'] < 0) {
$parts[] = 'v#1.' . $row['t3ver_id'];
}
switch ($row['t3ver_state']) {
case 1:
switch (VersionState::cast($row['t3ver_state'])) {
case new VersionState(VersionState::NEW_PLACEHOLDER):
$parts[] = 'PLH WSID#' . $row['t3ver_wsid'];
break;
case 2:
case new VersionState(VersionState::DELETE_PLACEHOLDER):
$parts[] = 'Deleted element!';
break;
case 3:
case new VersionState(VersionState::MOVE_PLACEHOLDER):
$parts[] = 'NEW LOCATION (PLH) WSID#' . $row['t3ver_wsid'];
break;
case 4:
case new VersionState(VersionState::MOVE_POINTER):
$parts[] = 'OLD LOCATION (PNT) WSID#' . $row['t3ver_wsid'];
break;
case -1:
case new VersionState(VersionState::NEW_PLACEHOLDER_VERSION):
$parts[] = 'New element!';
break;
}
......@@ -1744,20 +1745,20 @@ class BackendUtility {
$out .= ' - v#1.' . $row['t3ver_id'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
switch ($row['t3ver_state']) {
case 1:
switch (VersionState::cast($row['t3ver_state'])) {
case new VersionState(VersionState::NEW_PLACEHOLDER):
$out .= ' - PLH WSID#' . $row['t3ver_wsid'];
break;
case 2:
case new VersionState(VersionState::DELETE_PLACEHOLDER):
$out .= ' - Deleted element!';
break;
case 3:
case new VersionState(VersionState::MOVE_PLACEHOLDER):
$out .= ' - NEW LOCATION (PLH) WSID#' . $row['t3ver_wsid'];
break;
case 4:
case new VersionState(VersionState::MOVE_POINTER):
$out .= ' - OLD LOCATION (PNT) WSID#' . $row['t3ver_wsid'];
break;
case -1:
case new VersionState(VersionState::NEW_PLACEHOLDER_VERSION):
$out .= ' - New element!';
break;
}
......@@ -3670,11 +3671,11 @@ class BackendUtility {
// If t3ver_state is not found, then find it... (but we like best if it is here...)
if (!isset($wsAlt['t3ver_state'])) {
$stateRec = self::getRecord($table, $wsAlt['uid'], 't3ver_state');
$state = $stateRec['t3ver_state'];
$versionState = VersionState::cast($stateRec['t3ver_state']);
} else {
$state = $wsAlt['t3ver_state'];
$versionState = VersionState::cast($wsAlt['t3ver_state']);
}
if ((int) $state === 4) {
if ($versionState->equals(VersionState::MOVE_POINTER)) {
// TODO: Same problem as frontend in versionOL(). See TODO point there.
$row = FALSE;
return;
......@@ -3701,14 +3702,15 @@ class BackendUtility {
$row['_MOVE_PLH_uid'] = $orig_uid;
$row['_MOVE_PLH_pid'] = $orig_pid;
// For display; To make the icon right for the placeholder vs. the original
$row['t3ver_state'] = 3;
$row['t3ver_state'] = (string)new VersionState(VersionState::MOVE_PLACEHOLDER);
}
}
}
}
/**
* Checks if record is a move-placeholder (t3ver_state==3) and if so it will set $row to be the pointed-to live record (and return TRUE)
* Checks if record is a move-placeholder (t3ver_state==VersionState::MOVE_PLACEHOLDER) and if so
* it will set $row to be the pointed-to live record (and return TRUE)
*
* @param string $table Table name
* @param array $row Row (passed by reference) - must be online record!
......@@ -3722,13 +3724,13 @@ class BackendUtility {
if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
$moveIDRec = self::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
$moveID = $moveIDRec['t3ver_move_id'];
$state = $moveIDRec['t3ver_state'];
$versionState = VersionState::cast($moveIDRec['t3ver_state']);
} else {
$moveID = $row['t3ver_move_id'];
$state = $row['t3ver_state'];
$versionState = VersionState::cast($row['t3ver_state']);
}
// Find pointed-to record.
if ((int) $state === 3 && $moveID) {
if ($versionState->equals(VersionState::MOVE_PLACEHOLDER) && $moveID) {
if ($origRow = self::getRecord($table, $moveID, implode(',', array_keys($row)))) {
$row = $origRow;
return TRUE;
......@@ -3803,7 +3805,7 @@ class BackendUtility {
static public function versioningPlaceholderClause($table) {
if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
$currentWorkspace = intval($GLOBALS['BE_USER']->workspace);
return ' AND (' . $table . '.t3ver_state <= 0 OR ' . $table . '.t3ver_wsid = ' . $currentWorkspace . ')';
return ' AND (' . $table . '.t3ver_state <= ' . new VersionState(VersionState::DEFAULT_STATE) . ' OR ' . $table . '.t3ver_wsid = ' . $currentWorkspace . ')';
}
}
......@@ -3878,7 +3880,12 @@ class BackendUtility {
$workspace = $GLOBALS['BE_USER']->workspace;
if ($workspace !== 0 && $GLOBALS['TCA'][$table] && (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
// Select workspace version of record:
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($fields, $table, 'pid<>-1 AND ' . 't3ver_state=3 AND ' . 't3ver_move_id=' . intval($uid) . ' AND ' . 't3ver_wsid=' . intval($workspace) . self::deleteClause($table));
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
$fields,
$table,
'pid<>-1 AND t3ver_state=' . new VersionState(VersionState::MOVE_PLACEHOLDER) . ' AND t3ver_move_id='
. intval($uid) . ' AND t3ver_wsid=' . intval($workspace) . self::deleteClause($table)
);
if (is_array($row)) {
return $row;
}
......
......@@ -28,6 +28,7 @@ namespace TYPO3\CMS\Backend\Utility;
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* Contains class for icon generation in the backend
......@@ -155,17 +156,17 @@ class IconUtility {
$doNotRenderUserGroupNumber = TRUE;
// Shadow
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
switch ((int) $row['t3ver_state']) {
case 1:
switch (VersionState::cast($row['t3ver_state'])) {
case new VersionState(VersionState::NEW_PLACEHOLDER):
return 'gfx/i/shadow_hide.png';
break;
case 2:
case new VersionState(VersionState::DELETE_PLACEHOLDER):
return 'gfx/i/shadow_delete.png';
break;
case 3:
case new VersionState(VersionState::MOVE_PLACEHOLDER):
return 'gfx/i/shadow_moveto_plh.png';
break;
case 4:
case new VersionState(VersionState::MOVE_POINTER):
return 'gfx/i/shadow_moveto_pointer.png';
break;
}
......
......@@ -31,6 +31,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* Child class for the Web > Page module
......@@ -450,7 +451,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
$languageColumn[$key][$lP] .= '<br /><br />' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP);
}
}
if (is_array($row) && (int) $row['t3ver_state'] != 2) {
if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$singleElementHTML = '';
if (!$lP && ($this->defLangBinding || $row['sys_language_uid'] != -1)) {
$defLanguageCount[$key][] = $row['uid'];
......@@ -696,7 +697,7 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
}
// Traverse any selected elements:
foreach ($rowArr as $rKey => $row) {
if (is_array($row) && (int) $row['t3ver_state'] != 2) {
if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
$c++;
$editUidList .= $row['uid'] . ',';
$isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
......
......@@ -26,9 +26,9 @@ namespace TYPO3\CMS\Core\DataHandling;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* The main data handler class which takes care of correctly updating and inserting records.
......@@ -1193,7 +1193,7 @@ class DataHandler {
if ($createNewVersion) {
$newVersion_placeholderFieldArray['t3ver_label'] = 'INITIAL PLACEHOLDER';
// Setting placeholder state value for temporary record
$newVersion_placeholderFieldArray['t3ver_state'] = 1;
$newVersion_placeholderFieldArray['t3ver_state'] = (string)new VersionState(VersionState::NEW_PLACEHOLDER);
// Setting workspace - only so display of place holders can filter out those from other workspaces.
$newVersion_placeholderFieldArray['t3ver_wsid'] = $this->BE_USER->workspace;
$newVersion_placeholderFieldArray[$GLOBALS['TCA'][$table]['ctrl']['label']] = '[PLACEHOLDER, WS#' . $this->BE_USER->workspace . ']';
......@@ -1204,7 +1204,7 @@ class DataHandler {
$fieldArray['t3ver_oid'] = $this->substNEWwithIDs[$id];
$fieldArray['t3ver_id'] = 1;
// Setting placeholder state value for version (so it can know it is currently a new version...)
$fieldArray['t3ver_state'] = -1;
$fieldArray['t3ver_state'] = (string)new VersionState(VersionState::NEW_PLACEHOLDER_VERSION);
$fieldArray['t3ver_label'] = 'First draft version';
$fieldArray['t3ver_wsid'] = $this->BE_USER->workspace;
// When inserted, $this->substNEWwithIDs[$id] will be changed to the uid of THIS version and so the interface will pick it up just nice!
......@@ -1258,7 +1258,7 @@ class DataHandler {
*/
public function placeholderShadowing($table, $id) {
if ($liveRec = BackendUtility::getLiveVersionOfRecord($table, $id, '*')) {
if ((int) $liveRec['t3ver_state'] > 0) {
if (VersionState::cast($liveRec['t3ver_state'])->indicatesPlaceholder()) {
$justStoredRecord = BackendUtility::getRecord($table, $id);
$newRecord = array();
$shadowCols = $GLOBALS['TCA'][$table]['ctrl']['shadowColumnsForNewPlaceholders'];
......@@ -4664,7 +4664,7 @@ class DataHandler {
// Record must be online record
if ($row['pid'] >= 0) {
// Record must not be placeholder for moving.
if ($row['t3ver_state'] != 3) {
if (!VersionState::cast($row['t3ver_state'])->equals(VersionState::MOVE_PLACEHOLDER)) {
if (!$delete || !$this->cannotDeleteRecord($table, $id)) {
// Look for next version number:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('t3ver_id', $table, '((pid=-1 && t3ver_oid=' . $id . ') OR uid=' . $id . ')' . $this->deleteClause($table), '', 't3ver_id DESC', '1');
......@@ -4678,7 +4678,7 @@ class DataHandler {
't3ver_oid' => $id,
't3ver_label' => $label ? $label : $subVer . ' / ' . date('d-m-Y H:m:s'),
't3ver_wsid' => $this->BE_USER->workspace,
't3ver_state' => $delete ? 2 : 0,
't3ver_state' => (string)($delete ? new VersionState(VersionState::DELETE_PLACEHOLDER) : new VersionState(VersionState::DEFAULT_STATE)),
't3ver_count' => 0,
't3ver_stage' => 0,
't3ver_tstamp' => 0
......
......@@ -28,6 +28,7 @@ namespace TYPO3\CMS\Core\Database;
***************************************************************/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* Load database groups (relations)
......@@ -772,7 +773,11 @@ class RelationHandler {
}
// Update accordant fields in the database for workspaces overlays/placeholders:
if (count($workspaceValues) && $considerWorkspaces) {
if (isset($row['t3ver_oid']) && $row['t3ver_oid'] && $row['t3ver_state'] == -1) {
if (
isset($row['t3ver_oid'])
&& $row['t3ver_oid']
&& VersionState::cast($row['t3ver_state'])->equals(VersionState::NEW_PLACEHOLDER_VERSION)
) {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($row['t3ver_oid']), $workspaceValues);
}
}
......
......@@ -150,6 +150,20 @@ abstract class Enumeration {
return $enumConstants;
}
/**
* Compare if the value of the current object value equals the given value
*
* @param mixed $value default
* @return boolean
*/
public function equals($value) {
$currentClass = get_class($this);
if (!is_object($value) || get_class($value) !== $currentClass) {
$value = new $currentClass($value);
}
return $this === $value;
}
/**
* @return string
*/
......
<?php
namespace TYPO3\CMS\Core\Versioning;
/***************************************************************
* Copyright notice
*
* (c) 2013 Sascha Egerer <sascha.egerer@dkd.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Enumeration object for VersionState
*
* @package TYPO3\CMS\Core\Versioning
*/
class VersionState extends \TYPO3\CMS\Core\Type\Enumeration {
const __default = self::DEFAULT_STATE;
/**
* If a new record is created in a workspace a version
* with t3ver_state -1 is created with pid=-1. This
* record is the version of the "live" record
* (t3ver_state=1) where changes are stored.
*/
const NEW_PLACEHOLDER_VERSION = -1;
/**
* The t3ver_state 0 is used for the live version
* of a record and for draft records with pid -1
*/
const DEFAULT_STATE = 0;
/**
* Creating elements is done by first creating a
* placeholder element which is in fact live but
* carrying a flag (t3ver_state=1) that makes it
* invisible online.
*/
const NEW_PLACEHOLDER = 1;
/**
* Deleting elements is done by actually creating a
* new version of the element and setting t3ver_state=2
* that indicates the live element must be deleted upon
* swapping the versions.
*/
const DELETE_PLACEHOLDER = 2;
/**
* Moving elements is done by first creating a placeholder
* element which is in fact live but carrying a flag
* (t3ver_state=3) that makes it invisible online.
* It also has a field, "t3ver_move_id", holding the
* uid of the record to move (source record).
* In addition, a new version of the source record is made
* and has "t3ver_state" = 4 (move-to pointer). This version
* is simply necessary in order for the versioning system to
* have something to publish for the move operation. So in
* summary, two records are created for a move operation in
* a workspace: The placeholder (online, with state=3 and
* t3ver_move_id set) and a new version (state=4) of the
* online source record (the one being moved).
*/
const MOVE_PLACEHOLDER = 3;
const MOVE_POINTER = 4;
/**
* @param mixed $value
*/
public function __construct($value = NULL) {
if($value !== NULL) {
$value = (int)$value;
}
parent::__construct($value);
}
/**
* Cast value to VersionState Object
*
* @param mixed $versionState A value that is casted to a VersionState or a VersionState object that is returned
* @return VersionState
*/
public static function cast($versionState) {
if (!$versionState instanceof VersionState) {
$versionState = new VersionState($versionState);
}
return $versionState;
}
/**
* @return boolean
*/
public function indicatesPlaceholder() {
return intval($this->__toString()) > self::DEFAULT_STATE;
}
}
......@@ -29,6 +29,7 @@ namespace TYPO3\CMS\Frontend\ContentObject;
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* This class contains all main TypoScript features.
......@@ -7416,10 +7417,11 @@ class ContentObjectRenderer {
);
if (is_array($rows)) {
foreach ($rows as $row) {
$versionState = VersionState::cast($row['t3ver_state']);
$GLOBALS['TSFE']->sys_page->versionOL('pages', $row);
if ($row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER
|| $row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION
|| $row['t3ver_state'] > 0
|| $versionState->indicatesPlaceholder()
) {
// Doing this after the overlay to make sure changes
// in the overlay are respected.
......@@ -7443,7 +7445,7 @@ class ContentObjectRenderer {
$GLOBALS['TSFE']->sys_page->versionOL('pages', $row);
if ($row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER
|| $row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION
|| $row['t3ver_state'] > 0
|| $versionState->indicatesPlaceholder()
) {
// Doing this after the overlay to make sure
// changes in the overlay are respected.
......
......@@ -28,6 +28,7 @@ namespace TYPO3\CMS\Frontend\Page;
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
/**
* Page functions, a lot of sql/pages-related functions
......@@ -139,7 +140,7 @@ class PageRepository {
$this->where_hid_del .= 'AND pages.starttime<=' . $GLOBALS['SIM_ACCESS_TIME'] . ' AND (pages.endtime=0 OR pages.endtime>' . $GLOBALS['SIM_ACCESS_TIME'] . ') ';
// Filter out new/deleted place-holder pages in case we are NOT in a versioning preview (that means we are online!)
if (!$this->versioningPreview) {
$this->where_hid_del .= ' AND NOT pages.t3ver_state>0';
$this->where_hid_del .= ' AND NOT pages.t3ver_state>' . new VersionState(VersionState::DEFAULT_STATE);
} else {
// For version previewing, make sure that enable-fields are not de-selecting hidden
// pages - we need versionOL() to unset them only if the overlay record instructs us to.
......@@ -874,7 +875,7 @@ class PageRepository {
if (!$this->versioningPreview) {
// Filter out placeholder records (new/moved/deleted items)
// in case we are NOT in a versioning preview (that means we are online!)
$query .= ' AND ' . $table . '.t3ver_state<=0';
$query .= ' AND ' . $table . '.t3ver_state<=' . new VersionState(VersionState::DEFAULT_STATE);
} else {