Bug #87949

Upgrade v8 LTS to v9 LTS - PopulatePageSlugs Update not work with Workspaces

Added by Markus Pircher 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
Start date:
2019-03-19
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

trace:

(1/1) #1534710048 TYPO3\CMS\Core\Exception\SiteNotFoundException
No pseudo-site found in root line of page 1386

in /public/typo3/sysext/core/Classes/Site/PseudoSiteFinder.php line 179

at TYPO3\CMS\Core\Site\PseudoSiteFinder->getSiteByPageId(1386, array(array('pid' => -1, 'uid' => 1386, 't3ver_oid' => 148, 't3ver_wsid' => 0, 't3ver_state' => 0, 'title' => '', 'alias' => '', 'nav_title' => '', 'media' => '', 'layout' => 1, 'hidden' => 0, 'starttime' => 0, 'endtime' => 0, 'fe_group' => '', 'extendToSubpages' => 0, 'doktype' => 1, 'TSconfig' => null, 'tsconfig_includes' => null, 'is_siteroot' => 0, 'mount_pid' => 0, 'mount_pid_ol' => 0, 'fe_login_mode' => 0, 'backend_layout_next_level' => '')))
in /public/typo3/sysext/core/Classes/Routing/SiteMatcher.php line 210

at TYPO3\CMS\Core\Routing\SiteMatcher->matchByPageId(1386)
in /public/typo3/sysext/core/Classes/DataHandling/SlugHelper.php line 290

at TYPO3\CMS\Core\DataHandling\SlugHelper->isUniqueInSite('/page-title', object(TYPO3\CMS\Core\DataHandling\Model\RecordState))
in /public/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php line 172

at TYPO3\CMS\Install\Updates\PopulatePageSlugs->populateSlugs()
in /public/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php line 99

at TYPO3\CMS\Install\Updates\PopulatePageSlugs->executeUpdate()
in /public/typo3/sysext/install/Classes/Service/UpgradeWizardsService.php line 397

at TYPO3\CMS\Install\Service\UpgradeWizardsService->executeWizard('pagesSlugs')
in /public/typo3/sysext/install/Classes/Controller/UpgradeController.php line 967

at TYPO3\CMS\Install\Controller\UpgradeController->upgradeWizardsExecuteAction(object(TYPO3\CMS\Core\Http\ServerRequest))
in /public/typo3/sysext/install/Classes/Http/RequestHandler.php line 205

at TYPO3\CMS\Install\Http\RequestHandler->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /public/typo3/sysext/install/Classes/Http/Application.php line 65

at TYPO3\CMS\Install\Http\Application->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /public/typo3/sysext/core/Classes/Http/AbstractApplication.php line 110

at TYPO3\CMS\Core\Http\AbstractApplication->run()
in /public/typo3/install.php line 104

at {closure}()
in /public/typo3/install.php line 105

Associated revisions

Revision 082de0c6 (diff)
Added by Benni Mack about 2 months ago

[BUGFIX] Have RecordState support versioning

In the initial implementation a "versioning" state was missing
in the record state for TYPO3 v9.5.

If now an editor edits an existing root page (pid=0) in a workspace,
this results in a fatal error when accessing DataHandler.

The patch adds the versionized functionality.

Resolves: #88167
Resolves: #87949
Releases: master, 9.5
Change-Id: I0c69518ecd20aafc5481eea482832c020c01f662
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60500
Tested-by: TYPO3com <>
Tested-by: Achim Fritz <>
Tested-by: Susanne Moog <>
Reviewed-by: Achim Fritz <>
Reviewed-by: Susanne Moog <>

Revision 7d4397c5 (diff)
Added by Benni Mack about 2 months ago

[BUGFIX] Have RecordState support versioning

In the initial implementation a "versioning" state was missing
in the record state for TYPO3 v9.5.

If now an editor edits an existing root page (pid=0) in a workspace,
this results in a fatal error when accessing DataHandler.

The patch adds the versionized functionality.

Resolves: #88167
Resolves: #87949
Releases: master, 9.5
Change-Id: I0c69518ecd20aafc5481eea482832c020c01f662
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60626
Tested-by: TYPO3com <>
Tested-by: Susanne Moog <>
Reviewed-by: Susanne Moog <>

History

#1 Updated by Benni Mack 3 months ago

This is somehow related to https://review.typo3.org/c/Packages/TYPO3.CMS/+/59955 and

Where you need a matchbyPageId() and need to put in the online version of the record in.

#2 Updated by Markus Pircher 3 months ago

It works if i changed TYPO3\CMS\Install\Updates\PopulatePageSlugs->populateSlugs()
I add $liveRecordId;

while ($record = $statement->fetch()) {
            $recordId = (int)$record['uid'];
            $liveRecordId = $recordId;
            $pid = (int)$record['pid'];
            $languageId = (int)$record['sys_language_uid'];
            $pageIdInDefaultLanguage = $languageId > 0 ? (int)$record['l10n_parent'] : $recordId;
            $slug = $suggestedSlugs[$pageIdInDefaultLanguage][$languageId] ?? '';

            // see if an alias field was used, then let's build a slug out of that.
            if (!empty($record['alias'])) {
                $slug = $slugHelper->sanitize('/' . $record['alias']);
            }

            if (empty($slug)) {
                if ($pid === -1) {
                    $queryBuilder = $connection->createQueryBuilder();
                    $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
                    $liveVersion = $queryBuilder
                        ->select('pid')
                        ->from('pages')
                        ->where(
                            $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($record['t3ver_oid'], \PDO::PARAM_INT))
                        )->execute()->fetch();
                    $pid = (int)$liveVersion['pid'];
                    $liveRecordId = (int)$liveVersion['uid'];
                }
                $slug = $slugHelper->generate($record, $pid);
            }

            $state = RecordStateFactory::forName($this->table)
                ->fromArray($record, $pid, $liveRecordId);
            if ($hasToBeUniqueInSite && !$slugHelper->isUniqueInSite($slug, $state)) {
                $slug = $slugHelper->buildSlugForUniqueInSite($slug, $state);
            }
            if ($hasToBeUniqueInPid && !$slugHelper->isUniqueInPid($slug, $state)) {
                $slug = $slugHelper->buildSlugForUniqueInPid($slug, $state);
            }

            $connection->update(
                $this->table,
                [$this->fieldName => $slug],
                ['uid' => $recordId]
            );
        }

#3 Updated by Gerrit Code Review 2 months ago

  • Status changed from New to Under Review

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60500

#4 Updated by Oliver Hader 2 months ago

That's (from my POV) how it should behave - according changes and tests still missing.

--- a/typo3/sysext/core/Classes/DataHandling/Model/RecordState.php
+++ b/typo3/sysext/core/Classes/DataHandling/Model/RecordState.php
@@ -174,23 +174,27 @@ class RecordState
      * the `pid` of the current subject.
      *
      * Example:
-     * + pages: uid: 10, pid: 5, sys_language_uid: 0, l10n_parent: 0  -> returns 10
-     * + pages: uid: 11, pid: 5, sys_language_uid: 1, l10n_parent: 10 -> returns 10
-     * + other: uid: 12, pid: 10 -> returns 10
+     * + pages: uid: 10, pid:  5, sys_language_uid: 0, l10n_parent:  0, t3ver_oid:  0 -> returns 10
+     * + pages: uid: 11, pid:  5, sys_language_uid: 1, l10n_parent: 10, t3ver_oid:  0 -> returns 10
+     * + pages: uid: 12, pid: -1, sys_language_uid: 0, l10n_parent:  0, t3ver_oid: 10 -> returns 10
+     * + pages: uid: 13, pid: -1, sys_language_uid: 1, l10n_parent: 12, t3ver_oid: 11 -> returns 10
+     * + other: uid: 21, pid: 10, t3ver_oid: 0  -> returns 10
+     * + other: uid: 22, pid: -1, t3ver_oid: 21 -> returns 10
      *
      * @return string
      */
     public function resolveNodeAggregateIdentifier(): string
     {

#5 Updated by Gerrit Code Review about 2 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60500

#6 Updated by Benni Mack about 2 months ago

  • Target version changed from Candidate for patchlevel to next-patchlevel

#7 Updated by Gerrit Code Review about 2 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60626

#8 Updated by Benni Mack about 2 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#9 Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF