Skip to content

Commit

Permalink
Merge pull request #439 from b13/issue-396
Browse files Browse the repository at this point in the history
[BUGFIX] upgrade wizards for TYPO3 12
  • Loading branch information
achimfritz committed Sep 4, 2023
2 parents b30aa88 + c21c6cd commit 7a5481b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Build/phpstan10.neon
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ parameters:
-
message: '#Call to protected method getTypoScriptFrontendController\(\) of class TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer.#'
path: %currentWorkingDirectory%/Classes/DataProcessing/ContainerProcessor.php
-
message: '#Static method TYPO3\\CMS\\Core\\Core\\Bootstrap::initializeBackendUser\(\) invoked with 2 parameters.*#'
path: %currentWorkingDirectory%/*
12 changes: 11 additions & 1 deletion Classes/Updates/ContainerDeleteChildrenWithWrongPid.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
use B13\Container\Integrity\Error\WrongPidError;
use B13\Container\Integrity\Integrity;
use B13\Container\Integrity\IntegrityFix;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Http\ServerRequestFactory;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\RepeatableInterface;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
Expand Down Expand Up @@ -76,7 +80,13 @@ public function updateNecessary(): bool
public function executeUpdate(): bool
{
if (Environment::isCli() === false) {
Bootstrap::initializeBackendUser();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) {
$requestFactory = GeneralUtility::makeInstance(ServerRequestFactory::class);
$request = $requestFactory::fromGlobals();
Bootstrap::initializeBackendUser(BackendUserAuthentication::class, $request);
} else {
Bootstrap::initializeBackendUser();
}
Bootstrap::initializeBackendAuthentication();
Bootstrap::initializeLanguageObject();
}
Expand Down
12 changes: 11 additions & 1 deletion Classes/Updates/ContainerMigrateSorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
*/

use B13\Container\Integrity\Sorting;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Http\ServerRequestFactory;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\RepeatableInterface;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;
Expand Down Expand Up @@ -63,7 +67,13 @@ public function updateNecessary(): bool
public function executeUpdate(): bool
{
if (Environment::isCli() === false) {
Bootstrap::initializeBackendUser();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) {
$requestFactory = GeneralUtility::makeInstance(ServerRequestFactory::class);
$request = $requestFactory::fromGlobals();
Bootstrap::initializeBackendUser(BackendUserAuthentication::class, $request);
} else {
Bootstrap::initializeBackendUser();
}
Bootstrap::initializeBackendAuthentication();
Bootstrap::initializeLanguageObject();
}
Expand Down

0 comments on commit 7a5481b

Please sign in to comment.