Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion Classes/Updates/ContainerDeleteChildrenWithWrongPid.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use B13\Container\Integrity\Error\WrongPidError;
use B13\Container\Integrity\Integrity;
use B13\Container\Integrity\IntegrityFix;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\Environment;
Expand All @@ -24,12 +25,13 @@
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Attribute\UpgradeWizard;
use TYPO3\CMS\Install\Updates\ChattyInterface;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\RepeatableInterface;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;

#[UpgradeWizard('container_containerDeleteChildrenWithWrongPid')]
class ContainerDeleteChildrenWithWrongPid implements UpgradeWizardInterface, RepeatableInterface
class ContainerDeleteChildrenWithWrongPid implements UpgradeWizardInterface, RepeatableInterface, ChattyInterface
{
public const IDENTIFIER = 'container_deleteChildrenWithWrongPid';

Expand All @@ -43,12 +45,19 @@ class ContainerDeleteChildrenWithWrongPid implements UpgradeWizardInterface, Rep
*/
protected $integrityFix;

private OutputInterface $output;

public function __construct(Integrity $integrity, IntegrityFix $integrityFix)
{
$this->integrity = $integrity;
$this->integrityFix = $integrityFix;
}

public function setOutput(OutputInterface $output): void
{
$this->output = $output;
}

public function getIdentifier(): string
{
return self::IDENTIFIER;
Expand Down Expand Up @@ -92,6 +101,12 @@ public function executeUpdate(): bool
} else {
Bootstrap::initializeBackendUser();
}
if ($GLOBALS['BE_USER'] === null || $GLOBALS['BE_USER']->user === null) {
$this->output->writeln(
'<error>EXT:container Migrations need a valid Backend User, Login to the Backend to execute Wizard, or use CLI</error>'
);
return false;
}
Bootstrap::initializeBackendAuthentication();
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']);
}
Expand Down
17 changes: 16 additions & 1 deletion Classes/Updates/ContainerMigrateSorting.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

use B13\Container\Integrity\Sorting;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\Environment;
Expand All @@ -22,15 +23,18 @@
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Attribute\UpgradeWizard;
use TYPO3\CMS\Install\Updates\ChattyInterface;
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
use TYPO3\CMS\Install\Updates\RepeatableInterface;
use TYPO3\CMS\Install\Updates\UpgradeWizardInterface;

#[UpgradeWizard('container_containerMigrateSorting')]
class ContainerMigrateSorting implements UpgradeWizardInterface, RepeatableInterface
class ContainerMigrateSorting implements UpgradeWizardInterface, RepeatableInterface, ChattyInterface
{
public const IDENTIFIER = 'container_migratesorting';

private OutputInterface $output;

/**
* @var Sorting
*/
Expand All @@ -41,6 +45,11 @@ public function __construct(Sorting $sorting)
$this->sorting = $sorting;
}

public function setOutput(OutputInterface $output): void
{
$this->output = $output;
}

public function getIdentifier(): string
{
return self::IDENTIFIER;
Expand Down Expand Up @@ -79,6 +88,12 @@ public function executeUpdate(): bool
} else {
Bootstrap::initializeBackendUser();
}
if ($GLOBALS['BE_USER'] === null || $GLOBALS['BE_USER']->user === null) {
$this->output->writeln(
'<error>EXT:container Migrations need a valid Backend User, Login to the Backend to execute Wizard, or use CLI</error>'
);
return false;
}
Bootstrap::initializeBackendAuthentication();
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']);
}
Expand Down
Loading