#91546Populate slugs upgrade wizard fails with SiteNotFoundException due to orphaned page
Description
I’m currently performing an upgrade from TYPO3 8.7 to 9.5.
I’ve set up a site configuration for the (only) root site.
When performing the Introduce URL parts (“slugs”) to all existing pages upgrade wizard, it fails with the following exception:
(1/1) #1534710048 TYPO3\CMS\Core\Exception\SiteNotFoundException
No pseudo-site found in root line of page <pageid>
in /html/typo3/typo3_src-9.5.18/typo3/sysext/core/Classes/Site/PseudoSiteFinder.php line 189
if (isset($this->pseudoSites[(int)$pageInRootLine['uid']])) {
return $this->pseudoSites[(int)$pageInRootLine['uid']];
}
}
throw new SiteNotFoundException('No pseudo-site found in root line of page ' . $pageId, 1534710048);
}
/**
* Find a site by given root page id
at TYPO3\CMS\Core\Site\PseudoSiteFinder->getSiteByPageId(<pageid>, array())
in /html/typo3/typo3_src-9.5.18/typo3/sysext/core/Classes/Routing/SiteMatcher.php line 229
try {
return $this->finder->getSiteByPageId($pageId, $rootLine);
} catch (SiteNotFoundException $e) {
// Check for a pseudo / null site
return $this->pseudoSiteFinder->getSiteByPageId($pageId, $rootLine);
}
}
/**
at TYPO3\CMS\Core\Routing\SiteMatcher->matchByPageId(<pageid>)
in /html/typo3/typo3_src-9.5.18/typo3/sysext/core/Classes/DataHandling/SlugHelper.php line 305
// The installation contains at least ONE other record with the same slug
// Now find out if it is the same root page ID
$siteMatcher = GeneralUtility::makeInstance(SiteMatcher::class);
$siteMatcher->refresh();
$siteOfCurrentRecord = $siteMatcher->matchByPageId($pageId);
// TODO: Rather than silently ignoring this misconfiguration
// (when getting a PseudoSite or NullSite), a warning should
// be thrown here, or maybe even let the exception bubble up
// and catch it in places that uses this API
at TYPO3\CMS\Core\DataHandling\SlugHelper->isUniqueInSite('<slug>', object(TYPO3\CMS\Core\DataHandling\Model\RecordState))
in /html/typo3/typo3_src-9.5.18/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php line 176
$state = RecordStateFactory::forName($this->table)
->fromArray($record, $pid, $recordId);
if ($hasToBeUniqueInSite && !$slugHelper->isUniqueInSite($slug, $state)) {
$slug = $slugHelper->buildSlugForUniqueInSite($slug, $state);
}
at TYPO3\CMS\Install\Updates\PopulatePageSlugs->populateSlugs()
in /html/typo3/typo3_src-9.5.18/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php line 101
* @return bool Whether everything went smoothly or not
*/
public function executeUpdate(): bool
{
$this->populateSlugs();
return true;
}
/**
at TYPO3\CMS\Install\Updates\PopulatePageSlugs->executeUpdate()
in /html/typo3/typo3_src-9.5.18/typo3/sysext/install/Classes/Service/UpgradeWizardsService.php line 397
$performResult = true;
}
} else {
// confirmation yes or non-confirmable
$performResult = $updateObject->executeUpdate();
}
}
$stream = $this->output->getStream();
at TYPO3\CMS\Install\Service\UpgradeWizardsService->executeWizard('pagesSlugs')
in /html/typo3/typo3_src-9.5.18/typo3/sysext/install/Classes/Controller/UpgradeController.php line 1000
// ext_localconf, db and ext_tables must be loaded for the updates :(
$this->loadExtLocalconfDatabaseAndExtTables();
$upgradeWizardsService = new UpgradeWizardsService();
$identifier = $request->getParsedBody()['install']['identifier'];
$messages = $upgradeWizardsService->executeWizard($identifier);
return new JsonResponse([
'success' => true,
'status' => $messages,
]);
at TYPO3\CMS\Install\Controller\UpgradeController->upgradeWizardsExecuteAction(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/typo3/typo3_src-9.5.18/typo3/sysext/install/Classes/Http/RequestHandler.php line 221
'Unknown action method ' . $action . ' in controller ' . $controllerName,
1505216027
);
}
$response = $controller->$action($request);
}
return $response;
}
at TYPO3\CMS\Install\Http\RequestHandler->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/typo3/typo3_src-9.5.18/typo3/sysext/install/Classes/Http/Application.php line 65
{
$this->initializeContext();
foreach ($this->availableRequestHandlers as $handler) {
if ($handler->canHandleRequest($request)) {
return $handler->handle($request)
->withHeader('X-Frame-Options', 'SAMEORIGIN');
}
}
throw new \TYPO3\CMS\Core\Exception('No suitable request handler found.', 1518448686);
at TYPO3\CMS\Install\Http\Application->handle(object(TYPO3\CMS\Core\Http\ServerRequest))
in /html/typo3/typo3_src-9.5.18/typo3/sysext/core/Classes/Http/AbstractApplication.php line 120
final public function run(callable $execute = null)
{
try {
$response = $this->handle(
\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals()
);
if ($execute !== null) {
call_user_func($execute);
}
at TYPO3\CMS\Core\Http\AbstractApplication->run()
in /html/typo3/typo3_src-9.5.18/typo3/install.php line 104
call_user_func(function () {
$classLoader = require dirname(__DIR__).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run();
});
at {closure}()
in /html/typo3/typo3_src-9.5.18/typo3/install.php line 105
call_user_func(function () {
$classLoader = require dirname(__DIR__).'/vendor/autoload.php';
\TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL);
\TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run();
});
<pageid></pageid> has the following properties: It is marked as deleted=0, but its parent page is marked as deleted=1.
This affects TYPO3 9.5. It seems this is already fixed in TYPO3 10 and later: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61778/3/typo3/sysext/core/Classes/DataHandling/SlugHelper.php#25