Skip to content

Commit

Permalink
[TASK] Let all Commands return an int value
Browse files Browse the repository at this point in the history
The parent class states an integer value is returned,
but most core commands did not follow that rule. Now they
got according return statements to fulfill that contract.

Resolves: #90652
Releases: master
Change-Id: I58ad434404ce3537a4eb7ae34b88884b6962047f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63557
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
  • Loading branch information
maddy2101 authored and NeoBlack committed Mar 6, 2020
1 parent 247da0f commit 2d49deb
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 3 deletions.
2 changes: 2 additions & 0 deletions typo3/sysext/backend/Classes/Command/LockBackendCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -64,6 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
GeneralUtility::writeFile($lockFile, $lockFileContent);
$io->success($output);
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -66,5 +67,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io->section('Reference Index is now being updated');
}
$referenceIndex->updateIndex($isTestOnly, $progressListener);
return 0;
}
}
6 changes: 4 additions & 2 deletions typo3/sysext/backend/Classes/Command/UnlockBackendCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ protected function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -47,12 +48,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
unlink($lockFile);
if (@is_file($lockFile)) {
$io->caution('Could not remove lock file "' . $lockFile . '"!');
} else {
$io->success('Removed lock file "' . $lockFile . '".');
return 1;
}
$io->success('Removed lock file "' . $lockFile . '".');
} else {
$io->note('No lock file "' . $lockFile . '" was found.' . LF . 'Hence no lock can be removed.');
}
return 0;
}

/**
Expand Down
1 change: 1 addition & 0 deletions typo3/sysext/core/Classes/Command/DumpAutoloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io = new SymfonyStyle($input, $output);
ClassLoadingInformation::dumpClassLoadingInformation();
$io->success('Class loading information has been updated.');
return 0;
}
}
1 change: 1 addition & 0 deletions typo3/sysext/core/Classes/Command/ExtensionListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}
$table->render();
return 0;
}
}
1 change: 1 addition & 0 deletions typo3/sysext/core/Classes/Command/SiteShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$site = $siteFinder->getSiteByIdentifier($input->getArgument('identifier'));
$io->title('Site configuration for ' . $input->getArgument('identifier'));
$io->block(Yaml::dump($site->getConfiguration(), 4));
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$objectManager->get(InstallUtility::class)->install($extensionKey);

$io->success('Activated extension ' . $extensionKey . ' successfully.');
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$objectManager->get(InstallUtility::class)->uninstall($extensionKey);

$io->success('Deactivated extension "' . $extensionKey . '" successfully.');
return 0;
}
}
2 changes: 2 additions & 0 deletions typo3/sysext/impexp/Classes/Command/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ protected function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -117,5 +118,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

$io->success('Imported ' . $input->getArgument('file') . ' to page ' . $pageId . ' successfully');
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -110,6 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->success('Nothing to do - You\'re all set!');
}
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -115,6 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->deleteRecords($deletedRecords, $dryRun, $io);

$io->success('All done!');
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -108,6 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->success('Nothing to do, no files found which are referenced more than once.');
}
return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions typo3/sysext/lowlevel/Classes/Command/ListSysLogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -112,6 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$content[] = $result;
}
$io->table($tableHeaders, $content);
return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions typo3/sysext/lowlevel/Classes/Command/LostFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -134,6 +135,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->success('Nothing to do, no lost files found');
}
return 0;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions typo3/sysext/lowlevel/Classes/Command/MissingFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -113,6 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!count($missingSoftReferencedFiles) && !count($missingReferencedFiles)) {
$io->success('Nothing to do, no missing files found. Everything is in place.');
}
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -173,6 +174,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->success('Nothing to do, no missing relations found. Everything is in place.');
}
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -136,6 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->success('No orphan records found.');
}
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ protected function configure(): void
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output)
{
$registry = GeneralUtility::makeInstance(Registry::class);
$registry->remove(static::REGISTRY_NAMESPACE, static::REGISTRY_KEY);
Expand All @@ -62,5 +63,6 @@ protected function execute(InputInterface $input, OutputInterface $output): void
));
}
$registry->set(static::REGISTRY_NAMESPACE, static::REGISTRY_KEY, $list);
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -88,6 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->note('Nothing to do.');
}
return 0;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -64,5 +65,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$io->note('No expired preview links found. All done.');
}
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function configure()
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -255,6 +256,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
break;
}
$io->success('All done!');
return 0;
}

/**
Expand Down

0 comments on commit 2d49deb

Please sign in to comment.