Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?s

public function execute(InputInterface $input, OutputInterface $output): int
{
$exitCode = 0;
Bootstrap::initializeBackendAuthentication();
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']);
// this fetches all errors / warnings, including unrelated
$res = $this->integrity->run();
foreach ($res['warnings'] as $warning) {
if ($warning instanceof NonExistingParentWarning) {
$exitCode = 1;
$this->integrityFix->deleteChildrenWithNonExistingParent($warning);
}
}
return 0;
// return with exit code !0 if errors found
return $exitCode;
}
}
6 changes: 5 additions & 1 deletion Classes/Command/DeleteChildrenWithWrongPidCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?s

public function execute(InputInterface $input, OutputInterface $output): int
{
$exitCode = 0;
Bootstrap::initializeBackendAuthentication();
$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class)->createFromUserPreferences($GLOBALS['BE_USER']);
// this fetches all errors / warnings, including unrelated
$res = $this->integrity->run();
foreach ($res['errors'] as $error) {
if ($error instanceof WrongPidError) {
$exitCode = 1;
$this->integrityFix->deleteChildrenWithWrongPid($error);
}
}
return 0;
// return with exit code !0 if errors found
return $exitCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?s

public function execute(InputInterface $input, OutputInterface $output): int
{
$exitCode = 0;
// this fetches all errors / warnings, including unrelated
$res = $this->integrity->run();
foreach ($res['errors'] as $error) {
if ($error instanceof ChildInTranslatedContainerError) {
$exitCode = 1;
$this->integrityFix->changeContainerParentToDefaultLanguageContainer($error);
}
}
return 0;
// return with exit code !0 if errors found
return $exitCode;
}
}
6 changes: 5 additions & 1 deletion Classes/Command/FixLanguageModeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ public function __construct(Integrity $integrity, IntegrityFix $integrityFix, ?s

public function execute(InputInterface $input, OutputInterface $output): int
{
$exitCode = 0;
// this fetches all errors / warnings, including unrelated
$res = $this->integrity->run();
$errors = [];
foreach ($res['errors'] as $error) {
if ($error instanceof WrongL18nParentError) {
$exitCode = 1;
$errors[] = $error;
}
}
$this->integrityFix->languageMode($errors);
return 0;
// return with exit code !0 if errors found
return $exitCode;
}
}
4 changes: 3 additions & 1 deletion Classes/Command/IntegrityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function execute(InputInterface $input, OutputInterface $output): int
}
if (count($res['warnings']) === 0 && count($res['errors']) === 0) {
$io->success('Good Job, no errors/warnings!');
return 0;
}
return 0;
// return with exit code !0 if errors found
return 1;
}
}
4 changes: 2 additions & 2 deletions Classes/Command/SortingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('- all good, nothing to do here');
}
}

return self::SUCCESS;
// return with exit code !0 if errors found
return count($errors) > 0 ? 1 : 0;
}
}
3 changes: 2 additions & 1 deletion Classes/Command/SortingInPageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
if (empty($errors)) {
$output->writeln('migration finished');
}
return 0;
// return with exit code !0 if errors found
return count($errors) > 0 ? 1 : 0;
}
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ bin/typo3 container:deleteChildrenWithWrongPid
bin/typo3 container:deleteChildrenWithNonExistingParent
```

Commands will generally exit with 0 on non-error and exit with !0 if an error was found, regardless of whether the
problems were fixed or not.

## TODOs
- Integrity proofs
- List module actions
Expand Down