Skip to content
Snippets Groups Projects
Commit 2d191fe5 authored by Lukas Maxheim's avatar Lukas Maxheim Committed by Anja Leichsenring
Browse files

[TASK] Introduce table format for redirect integrity check

* This commit updates the command "redirects:checkintegrity" to use the table format for clearer and more organized output.
* Now, the list of hits will be presented in a user-friendly tabular layout, improving readability and overall user experience.

Resolves: #99492
Releases: main, 12.4
Change-Id: Id20cb2f39ff797786c2080557db0a993a987b32e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80393


Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent b9fc1e3e
Branches
Tags
No related merge requests found
......@@ -18,10 +18,12 @@ declare(strict_types=1);
namespace TYPO3\CMS\Redirects\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use TYPO3\CMS\Redirects\Service\IntegrityService;
class CheckIntegrityCommand extends Command
......@@ -63,16 +65,37 @@ class CheckIntegrityCommand extends Command
{
$this->registry->remove(self::REGISTRY_NAMESPACE, self::REGISTRY_KEY);
$conflictingRedirects = [];
$list = [];
$site = $input->getArgument('site') ?: null;
$table = new Table($output);
$table->setHeaders(
[
LocalizationUtility::translate(
'LLL:EXT:redirects/Resources/Private/Language/locallang_db.xlf:sys_redirect.source_host'
),
LocalizationUtility::translate(
'LLL:EXT:redirects/Resources/Private/Language/locallang_db.xlf:sys_redirect.source_path'
),
LocalizationUtility::translate(
'LLL:EXT:redirects/Resources/Private/Language/locallang_db.xlf:sys_redirect.target'
),
]
);
foreach ($this->integrityService->findConflictingRedirects($site) as $conflict) {
$list[] = $conflict;
$output->writeln(sprintf(
'Redirect (Host: %s, Path: %s) conflicts with %s',
$conflictingRedirects[] = [
$conflict['redirect']['source_host'],
$conflict['redirect']['source_path'],
$conflict['uri']
));
$conflict['uri'],
];
$list[] = $conflict;
}
if ($conflictingRedirects !== []) {
$table->setRows($conflictingRedirects);
$table->render();
}
$this->registry->set(self::REGISTRY_NAMESPACE, self::REGISTRY_KEY, $list);
return Command::SUCCESS;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment