From 99f26e6742a2f8176ed5999054a7ad30e5ed6b59 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Fri, 25 May 2018 10:40:05 +0200 Subject: [PATCH] [TASK] Deprecate PageRepository->versioningPreview PageRepository has two public properties regarding fetching records for versioned records: - versioningPreview (bool) - versioningWorkspaceId (int) In order to allow previews of versions, a workspace ID has to be set - otherwise it fetches live records. Basically things like: $versioningPreview=false, $versioningWorkspaceId=3 will make things more confusing. Instead, versioningPreview is not in use anymore, and PageRepository solely relies on the parameter of the workspaceId set. Resolves: #85078 Releases: master Change-Id: I70f028854ebc1a83d6d5af18de507284ae89b2ac Reviewed-on: https://review.typo3.org/57047 Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: Wouter Wolters <typo3@wouterwolters.nl> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../FrontendWorkspaceRestriction.php | 4 +- .../core/Classes/Utility/RootlineUtility.php | 9 +-- ...-85078-PageRepositoryVersioningPreview.rst | 37 +++++++++ .../FrontendRestrictionContainerTest.php | 12 --- .../FrontendWorkspaceRestrictionTest.php | 10 +-- .../Unit/Utility/RootlineUtilityTest.php | 9 +-- .../Functional/Persistence/RelationTest.php | 1 + .../Generic/Storage/Typo3DbBackendTest.php | 1 - .../ContentObject/ContentObjectRenderer.php | 2 +- .../TypoScriptFrontendController.php | 2 - .../frontend/Classes/Page/PageRepository.php | 79 ++++++++++--------- .../Functional/Page/PageRepositoryTest.php | 29 +------ .../Php/PropertyPublicMatcher.php | 5 ++ 13 files changed, 99 insertions(+), 101 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst diff --git a/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendWorkspaceRestriction.php b/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendWorkspaceRestriction.php index 4465c07474a5..dc724a8f20fa 100644 --- a/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendWorkspaceRestriction.php +++ b/typo3/sysext/core/Classes/Database/Query/Restriction/FrontendWorkspaceRestriction.php @@ -41,13 +41,13 @@ class FrontendWorkspaceRestriction implements QueryRestrictionInterface /** * @param int $workspaceId (PageRepository::$versioningWorkspaceId property) - * @param bool $includeRowsForWorkspacePreview (PageRepository::$versioningPreview property) + * @param bool $includeRowsForWorkspacePreview (PageRepository::$versioningWorkspaceId > 0 property) * @param bool $enforceLiveRowsOnly (!$noVersionPreview argument from PageRepository::enableFields()) This is ONLY for use in PageRepository class and most likely will be removed */ public function __construct(int $workspaceId = null, bool $includeRowsForWorkspacePreview = null, bool $enforceLiveRowsOnly = true) { $this->workspaceId = $workspaceId ?? $GLOBALS['TSFE']->sys_page->versioningWorkspaceId; - $this->includeRowsForWorkspacePreview = $includeRowsForWorkspacePreview ?? $GLOBALS['TSFE']->sys_page->versioningPreview; + $this->includeRowsForWorkspacePreview = $includeRowsForWorkspacePreview ?? $GLOBALS['TSFE']->sys_page->versioningWorkspaceId > 0; $this->enforceLiveRowsOnly = $enforceLiveRowsOnly; } diff --git a/typo3/sysext/core/Classes/Utility/RootlineUtility.php b/typo3/sysext/core/Classes/Utility/RootlineUtility.php index e948a95b8e63..5c8b7fda3371 100644 --- a/typo3/sysext/core/Classes/Utility/RootlineUtility.php +++ b/typo3/sysext/core/Classes/Utility/RootlineUtility.php @@ -50,11 +50,6 @@ class RootlineUtility */ protected $workspaceUid = 0; - /** - * @var bool - */ - protected $versionPreview = false; - /** * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */ @@ -144,7 +139,6 @@ class RootlineUtility { $this->languageUid = (int)$this->pageContext->sys_language_uid; $this->workspaceUid = (int)$this->pageContext->versioningWorkspaceId; - $this->versionPreview = $this->pageContext->versioningPreview; if ($this->mountPointParameter !== '') { if (!$GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids']) { throw new \RuntimeException('Mount-Point Pages are disabled for this installation. Cannot resolve a Rootline for a page with Mount-Points', 1343462896); @@ -188,8 +182,7 @@ class RootlineUtility $otherUid !== null ? (int)$otherUid : $this->pageUid, $mountPointParameter, $this->languageUid, - $this->workspaceUid, - $this->versionPreview ? 1 : 0 + $this->workspaceUid ]); } diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst new file mode 100644 index 000000000000..25da684564fb --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85078-PageRepositoryVersioningPreview.rst @@ -0,0 +1,37 @@ +.. include:: ../../Includes.txt + +======================================================= +Deprecation: #85078 - PageRepository->versioningPreview +======================================================= + +See :issue:`85078` + +Description +=========== + +The public property :php:`$versioningPreview` in :php:`TYPO3\CMS\Frontend\Page\PageRepository` has been marked +as deprecated. The property was used in conjunction with :php:`$versioningWorkspaceId` which is set to a workspace +ID, in order to preview records of a workspace. + +In order to ease the functionality for developers, only :php:`$versioningWorkspaceId` is taken into account now, +without needing to set :php:`$versioningPreview` anymore. + + +Impact +====== + +Setting or reading this option will trigger a deprecation entry. + + +Affected Installations +====================== + +TYPO3 installations with extensions using this property. + + +Migration +========= + +Just set `$versioningWorkspaceId` and remove any calls to the property. + +.. index:: Frontend, PHP-API, FullyScanned \ No newline at end of file diff --git a/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php b/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php index 45be6d00801c..35214f0f3f46 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendRestrictionContainerTest.php @@ -27,7 +27,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'aTable', 'tableAlias' => 'aTable', 'workspaceId' => 0, - 'workspacePreview' => false, 'hiddenPagePreview' => false, 'hiddenRecordPreview' => false, 'feGroupList' => '0,-1', @@ -37,7 +36,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'aTable', 'tableAlias' => 'aTable', 'workspaceId' => 0, - 'workspacePreview' => false, 'hiddenPagePreview' => true, 'hiddenRecordPreview' => true, 'feGroupList' => '0,-1', @@ -47,7 +45,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'aTable', 'tableAlias' => 'aTable', 'workspaceId' => 1, - 'workspacePreview' => true, 'hiddenPagePreview' => false, 'hiddenRecordPreview' => false, 'feGroupList' => '0,-1', @@ -57,7 +54,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'aTable', 'tableAlias' => 'aTable', 'workspaceId' => 1, - 'workspacePreview' => true, 'hiddenPagePreview' => true, 'hiddenRecordPreview' => true, 'feGroupList' => '0,-1', @@ -67,7 +63,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'pages', 'tableAlias' => 'pages', 'workspaceId' => 0, - 'workspacePreview' => false, 'hiddenPagePreview' => false, 'hiddenRecordPreview' => false, 'feGroupList' => '0,-1', @@ -77,7 +72,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'pages', 'tableAlias' => 'pages', 'workspaceId' => 0, - 'workspacePreview' => false, 'hiddenPagePreview' => true, 'hiddenRecordPreview' => true, 'feGroupList' => '0,-1', @@ -87,7 +81,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'pages', 'tableAlias' => 'pages', 'workspaceId' => 1, - 'workspacePreview' => true, 'hiddenPagePreview' => false, 'hiddenRecordPreview' => false, 'feGroupList' => '0,-1', @@ -97,7 +90,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'pages', 'tableAlias' => 'pages', 'workspaceId' => 1, - 'workspacePreview' => true, 'hiddenPagePreview' => true, 'hiddenRecordPreview' => true, 'feGroupList' => '0,-1', @@ -107,7 +99,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase 'tableName' => 'aTable', 'tableAlias' => 'a', 'workspaceId' => 0, - 'workspacePreview' => false, 'hiddenPagePreview' => false, 'hiddenRecordPreview' => false, 'feGroupList' => '0,-1', @@ -120,7 +111,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase * @param string $tableName * @param string $tableAlias * @param int $workspaceId - * @param bool $workspacePreview * @param bool $hiddenPagePreview * @param bool $hiddenRecordPreview * @param string $feGroupList @@ -133,7 +123,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase string $tableName, string $tableAlias, int $workspaceId, - bool $workspacePreview, bool $hiddenPagePreview, bool $hiddenRecordPreview, string $feGroupList, @@ -174,7 +163,6 @@ class FrontendRestrictionContainerTest extends AbstractRestrictionTestCase $pageRepository = $this->createMock(PageRepository::class); $pageRepository->versioningWorkspaceId = $workspaceId; - $pageRepository->versioningPreview = $workspacePreview; $typoScriptFrontendController = new \stdClass(); $typoScriptFrontendController->showHiddenPage = $hiddenPagePreview; diff --git a/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendWorkspaceRestrictionTest.php b/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendWorkspaceRestrictionTest.php index 19a8932f0b9c..1f2a73248b0c 100644 --- a/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendWorkspaceRestrictionTest.php +++ b/typo3/sysext/core/Tests/Unit/Database/Query/Restriction/FrontendWorkspaceRestrictionTest.php @@ -28,13 +28,13 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase $GLOBALS['TCA'] = [ 'aTable' => [ 'ctrl' => [ - 'versioningWS' => 2, + 'versioningWS' => true, ], ] ]; $pageRepository = $this->createMock(PageRepository::class); - $pageRepository->versioningPreview = false; + $pageRepository->versioningWorkspaceId = 0; $GLOBALS['TSFE'] = new \stdClass(); $GLOBALS['TSFE']->sys_page = $pageRepository; @@ -52,13 +52,12 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase $GLOBALS['TCA'] = [ 'aTable' => [ 'ctrl' => [ - 'versioningWS' => 2, + 'versioningWS' => true, ], ] ]; $pageRepository = $this->createMock(PageRepository::class); - $pageRepository->versioningPreview = true; $pageRepository->versioningWorkspaceId = 42; $subject = new FrontendWorkspaceRestriction(42, true); @@ -74,13 +73,12 @@ class FrontendWorkspaceRestrictionTest extends AbstractRestrictionTestCase $GLOBALS['TCA'] = [ 'aTable' => [ 'ctrl' => [ - 'versioningWS' => 2, + 'versioningWS' => true, ], ] ]; $pageRepository = $this->createMock(PageRepository::class); - $pageRepository->versioningPreview = true; $pageRepository->versioningWorkspaceId = 42; $subject = new FrontendWorkspaceRestriction(42, true, false); diff --git a/typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php index 07fa74ed001d..681fbc6056b0 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/RootlineUtilityTest.php @@ -310,15 +310,13 @@ class RootlineUtilityTest extends UnitTestCase { $this->pageContextMock->sys_language_uid = 8; $this->pageContextMock->versioningWorkspaceId = 15; - $this->pageContextMock->versioningPreview = true; $this->subject->__construct(42, '47-11', $this->pageContextMock); - $this->assertSame('42_47-11_8_15_1', $this->subject->getCacheIdentifier()); - $this->pageContextMock->versioningPreview = false; + $this->assertSame('42_47-11_8_15', $this->subject->getCacheIdentifier()); $this->subject->__construct(42, '47-11', $this->pageContextMock); - $this->assertSame('42_47-11_8_15_0', $this->subject->getCacheIdentifier()); + $this->assertSame('42_47-11_8_15', $this->subject->getCacheIdentifier()); $this->pageContextMock->versioningWorkspaceId = 0; $this->subject->__construct(42, '47-11', $this->pageContextMock); - $this->assertSame('42_47-11_8_0_0', $this->subject->getCacheIdentifier()); + $this->assertSame('42_47-11_8_0', $this->subject->getCacheIdentifier()); } /** @@ -336,7 +334,6 @@ class RootlineUtilityTest extends UnitTestCase ); $this->pageContextMock->sys_language_uid = 8; $this->pageContextMock->versioningWorkspaceId = 15; - $this->pageContextMock->versioningPreview = true; $this->subject->__construct(42, '47-11,48-12', $this->pageContextMock); $this->assertTrue($cacheFrontendMock->isValidEntryIdentifier($this->subject->getCacheIdentifier())); } diff --git a/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php b/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php index 2e752f14cacf..266a7bde4786 100644 --- a/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php +++ b/typo3/sysext/extbase/Tests/Functional/Persistence/RelationTest.php @@ -73,6 +73,7 @@ class RelationTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTes $this->blog = $blogRepository->findByUid(1); $GLOBALS['BE_USER'] = new BackendUserAuthentication(); + $GLOBALS['BE_USER']->workspace = 0; } /** diff --git a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php index 91fb65bf5b20..12e76a651138 100644 --- a/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbBackendTest.php @@ -152,7 +152,6 @@ class Typo3DbBackendTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase $pageRepositoryMock = $this->getMockBuilder(\TYPO3\CMS\Frontend\Page\PageRepository::class) ->setMethods(['movePlhOL', 'getWorkspaceVersionOfRecord']) ->getMock(); - $pageRepositoryMock->versioningPreview = true; $pageRepositoryMock->expects($this->once())->method('getWorkspaceVersionOfRecord')->with($workspaceUid, 'tx_foo', '42')->will($this->returnValue($workspaceVersion)); $mockTypo3DbBackend = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::class, ['dummy'], [], '', false); $mockTypo3DbBackend->_set('pageRepository', $pageRepositoryMock); diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index f1d5292a35f5..d1cf44e80d0e 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -6716,7 +6716,7 @@ class ContentObjectRenderer implements LoggerAwareInterface ]; $considerMovePlaceholders = ( - $tsfe->sys_page->versioningPreview && $table !== 'pages' + $tsfe->sys_page->versioningWorkspaceId > 0 && $table !== 'pages' && !empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) ); diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 55d96deeac0f..8f1e89b2dc73 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -1191,7 +1191,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface if ($this->whichWorkspace() > 0) { // Fetch overlay of page if in workspace and check if it is hidden $pageSelectObject = GeneralUtility::makeInstance(PageRepository::class); - $pageSelectObject->versioningPreview = true; $pageSelectObject->init(false); $targetPage = $pageSelectObject->getWorkspaceVersionOfRecord($this->whichWorkspace(), 'pages', $page['uid']); $result = $targetPage === -1 || $targetPage === -2; @@ -1269,7 +1268,6 @@ class TypoScriptFrontendController implements LoggerAwareInterface $timeTracker->push('fetch_the_id initialize/'); // Initialize the page-select functions. $this->sys_page = GeneralUtility::makeInstance(PageRepository::class); - $this->sys_page->versioningPreview = $this->whichWorkspace() > 0 || (bool)GeneralUtility::_GP('ADMCMD_view'); $this->sys_page->versioningWorkspaceId = $this->whichWorkspace(); $this->sys_page->init($this->showHiddenPage); // Set the valid usergroups for FE diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php index a468b878adda..48e2fe8bc7b9 100644 --- a/typo3/sysext/frontend/Classes/Page/PageRepository.php +++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php @@ -48,6 +48,7 @@ class PageRepository implements LoggerAwareInterface * @var array */ protected $deprecatedPublicProperties = [ + 'versioningPreview' => 'Using $versioningPreview of class PageRepository is discouraged, just use versioningWorkspaceId to determine if a workspace should be previewed.', 'workspaceCache' => 'Using $workspaceCache of class PageRepository from the outside is discouraged, as this only reflects a local runtime cache.', 'error_getRootLine' => 'Using $error_getRootLine of class PageRepository from the outside is deprecated as this property only exists for legacy reasons.', 'error_getRootLine_failPid' => 'Using $error_getRootLine_failPid of class PageRepository from the outside is deprecated as this property only exists for legacy reasons.', @@ -80,11 +81,15 @@ class PageRepository implements LoggerAwareInterface * user!!! * * @var bool + * @deprecated since TYPO3 v9.3, will be removed in TYPO3 v10. As $versioningWorkspaceId now indicates what records to fetch. */ - public $versioningPreview = false; + protected $versioningPreview = false; /** * Workspace ID for preview + * If > 0, versioning preview of other record versions is allowed. THIS MUST + * ONLY BE SET IF the page is not cached and truly previewed by a backend + * user! * * @var int */ @@ -185,7 +190,7 @@ class PageRepository implements LoggerAwareInterface { $this->where_groupAccess = ''; - if ($this->versioningPreview) { + if ($this->versioningWorkspaceId) { // 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. @@ -1339,7 +1344,7 @@ class PageRepository implements LoggerAwareInterface $constraints[] = $expressionBuilder->eq($table . '.' . $ctrl['delete'], 0); } if ($ctrl['versioningWS']) { - if (!$this->versioningPreview) { + if (!$this->versioningWorkspaceId) { // Filter out placeholder records (new/moved/deleted items) // in case we are NOT in a versioning preview (that means we are online!) $constraints[] = $expressionBuilder->lte( @@ -1365,7 +1370,7 @@ class PageRepository implements LoggerAwareInterface if (is_array($ctrl['enablecolumns'])) { // In case of versioning-preview, enableFields are ignored (checked in // versionOL()) - if (!$this->versioningPreview || !$ctrl['versioningWS'] || $noVersionPreview) { + if (!$this->versioningWorkspaceId || !$ctrl['versioningWS'] || $noVersionPreview) { if (($ctrl['enablecolumns']['disabled'] ?? false) && !$show_hidden && !($ignore_array['disabled'] ?? false)) { $field = $table . '.' . $ctrl['enablecolumns']['disabled']; $constraints[] = $expressionBuilder->eq($field, 0); @@ -1465,7 +1470,7 @@ class PageRepository implements LoggerAwareInterface */ public function fixVersioningPid($table, &$rr) { - if ($this->versioningPreview && is_array($rr) && (int)$rr['pid'] === -1 && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { + if ($this->versioningWorkspaceId && is_array($rr) && (int)$rr['pid'] === -1 && $GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { $oid = 0; $wsid = 0; // Check values for t3ver_oid and t3ver_wsid: @@ -1545,7 +1550,7 @@ class PageRepository implements LoggerAwareInterface */ public function versionOL($table, &$row, $unsetMovePointers = false, $bypassEnableFieldsCheck = false) { - if ($this->versioningPreview && is_array($row)) { + if ($this->versioningWorkspaceId && is_array($row)) { // will overlay any movePlhOL found with the real record, which in turn // will be overlaid with its workspace version if any. $movePldSwap = $this->movePlhOL($table, $row); @@ -1683,42 +1688,40 @@ class PageRepository implements LoggerAwareInterface */ public function getMovePlaceholder($table, $uid, $fields = '*') { - if ($this->versioningPreview) { - $workspace = (int)$this->versioningWorkspaceId; - if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && $workspace !== 0) { - // Select workspace version of record: - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); - $queryBuilder->getRestrictions() - ->removeAll() - ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); + $workspace = (int)$this->versioningWorkspaceId; + if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && $workspace !== 0) { + // Select workspace version of record: + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table); + $queryBuilder->getRestrictions() + ->removeAll() + ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); - $row = $queryBuilder->select(...GeneralUtility::trimExplode(',', $fields, true)) - ->from($table) - ->where( - $queryBuilder->expr()->neq('pid', $queryBuilder->createNamedParameter(-1, \PDO::PARAM_INT)), - $queryBuilder->expr()->eq( - 't3ver_state', - $queryBuilder->createNamedParameter( - (string)VersionState::cast(VersionState::MOVE_PLACEHOLDER), - \PDO::PARAM_INT - ) - ), - $queryBuilder->expr()->eq( - 't3ver_move_id', - $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT) - ), - $queryBuilder->expr()->eq( - 't3ver_wsid', - $queryBuilder->createNamedParameter($workspace, \PDO::PARAM_INT) + $row = $queryBuilder->select(...GeneralUtility::trimExplode(',', $fields, true)) + ->from($table) + ->where( + $queryBuilder->expr()->neq('pid', $queryBuilder->createNamedParameter(-1, \PDO::PARAM_INT)), + $queryBuilder->expr()->eq( + 't3ver_state', + $queryBuilder->createNamedParameter( + (string)VersionState::cast(VersionState::MOVE_PLACEHOLDER), + \PDO::PARAM_INT ) + ), + $queryBuilder->expr()->eq( + 't3ver_move_id', + $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT) + ), + $queryBuilder->expr()->eq( + 't3ver_wsid', + $queryBuilder->createNamedParameter($workspace, \PDO::PARAM_INT) ) - ->setMaxResults(1) - ->execute() - ->fetch(); + ) + ->setMaxResults(1) + ->execute() + ->fetch(); - if (is_array($row)) { - return $row; - } + if (is_array($row)) { + return $row; } } return false; diff --git a/typo3/sysext/frontend/Tests/Functional/Page/PageRepositoryTest.php b/typo3/sysext/frontend/Tests/Functional/Page/PageRepositoryTest.php index af41fda9f0a3..b24b527a6a5e 100644 --- a/typo3/sysext/frontend/Tests/Functional/Page/PageRepositoryTest.php +++ b/typo3/sysext/frontend/Tests/Functional/Page/PageRepositoryTest.php @@ -310,7 +310,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio */ public function initSetsPublicPropertyCorrectlyForWorkspacePreview() { - $this->pageRepo->versioningPreview = true; $this->pageRepo->versioningWorkspaceId = 2; $this->pageRepo->init(false); @@ -333,7 +332,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio { $GLOBALS['SIM_ACCESS_TIME'] = 123; - $this->pageRepo->versioningPreview = false; $this->pageRepo->versioningWorkspaceId = 0; $this->pageRepo->init(false); @@ -355,22 +353,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio // Tests concerning workspaces //////////////////////////////// - /** - * @test - */ - public function noPagesFromWorkspaceAreShownLive() - { - // initialization - $wsid = 987654321; - - // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id() - $this->pageRepo->versioningPreview = false; - $this->pageRepo->versioningWorkspaceId = $wsid; - $this->pageRepo->init(false); - - $this->assertSame([], $this->pageRepo->getPage(11)); - } - /** * @test */ @@ -380,7 +362,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio $wsid = 987654321; // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id() - $this->pageRepo->versioningPreview = true; $this->pageRepo->versioningWorkspaceId = $wsid; $this->pageRepo->init(false); @@ -402,7 +383,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio $wsid = 987654321; // simulate calls from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->fetch_the_id() - $this->pageRepo->versioningPreview = true; $this->pageRepo->versioningWorkspaceId = $wsid; $this->pageRepo->init(false); @@ -431,7 +411,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio ] ]; - $this->pageRepo->versioningPreview = false; + $this->pageRepo->versioningWorkspaceId = 0; $this->pageRepo->init(false); $conditions = $this->pageRepo->enableFields($table); @@ -461,7 +441,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio ] ]; - $this->pageRepo->versioningPreview = true; + $this->pageRepo->versioningWorkspaceId = 13; $this->pageRepo->init(false); $conditions = $this->pageRepo->enableFields($table); @@ -491,7 +471,6 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio ] ]; - $this->pageRepo->versioningPreview = true; $this->pageRepo->versioningWorkspaceId = 2; $this->pageRepo->init(false); @@ -517,7 +496,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio ] ]; - $this->pageRepo->versioningPreview = true; + $this->pageRepo->versioningWorkspaceId = 23; $this->pageRepo->init(false); $conditions = $this->pageRepo->enableFields($table, -1, [], true); @@ -531,7 +510,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio $this->assertThat( $conditions, $this->logicalNot($this->stringContains(' AND (' . $connection->quoteIdentifier($table . '.pid') . ' <> -1)')), - 'No necords from page -1' + 'No records from page -1' ); } diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php index 5404f9365e30..b1a32f51aaa7 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyPublicMatcher.php @@ -396,4 +396,9 @@ return [ 'Deprecation-85122-FunctionalityInCharsetConverter.rst' ], ], + 'TYPO3\CMS\Frontend\Page\PageRepository->versioningPreview' => [ + 'restFiles' => [ + 'Deprecation-85078-PageRepositoryVersioningPreview.rst', + ], + ], ]; -- GitLab