Commit 8d19f685 authored by Nikita Hovratov's avatar Nikita Hovratov Committed by Christian Kuhn
Browse files

[!!!][TASK] Remove lowerCamelCase Import/Export command options

The lowerCamelCase options and the deprecation
warnings have been removed alongside with deprecated
tests.

Resolves: #96186
Related: #94902
Releases: main
Change-Id: I979b32797e7c84d7952c456cadc8623fe26a7a4d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72448


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5af323ca
......@@ -224,6 +224,19 @@ The following module configuration have been removed:
- :php:`navFrameScriptParam`
- :php:`navigationFrameModule` (Extbase)
The following command line options have been removed:
- :shell:`impexp:export --includeRelated`
- :shell:`impexp:export --includeStatic`
- :shell:`impexp:export --excludeDisabledRecords`
- :shell:`impexp:export --excludeHtmlCss`
- :shell:`impexp:export --saveFilesOutsideExportFile`
- :shell:`impexp:import --updateRecords`
- :shell:`impexp:import --ignorePid`
- :shell:`impexp:import --forceUid`
- :shell:`impexp:import --importMode`
- :shell:`impexp:import --enableLog`
Impact
======
......
......@@ -161,37 +161,6 @@ class ExportCommand extends Command
InputOption::VALUE_NONE,
'Save files into separate folder instead of including them into the common export file. Folder name pattern is "{filename}.files".'
)
// @deprecated since v11, will be removed in v12. Drop all options below and look for other fallbacks in the class.
->addOption(
'includeRelated',
null,
InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
'Deprecated. Use --include-related instead.'
)
->addOption(
'includeStatic',
null,
InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
'Deprecated. Use --include-static instead.'
)
->addOption(
'excludeDisabledRecords',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --exclude-disabled-records instead.'
)
->addOption(
'excludeHtmlCss',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --exclude-html-css instead.'
)
->addOption(
'saveFilesOutsideExportFile',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --save-files-outside-export-file instead.'
)
;
}
......@@ -204,20 +173,6 @@ class ExportCommand extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
// @deprecated since v11, will be removed in v12. lowerCameCased options. Also look for other fallbacks in the class.
$deprecatedOptions = [
'--includeRelated' => '--include-related',
'--includeStatic' => '--include-static',
'--excludeDisabledRecords' => '--exclude-disabled-records',
'--excludeHtmlCss' => '--exclude-html-css',
'--saveFilesOutsideExportFile' => '--save-files-outside-export-file',
];
foreach ($deprecatedOptions as $deprecatedName => $actualName) {
if ($input->hasParameterOption($deprecatedName, true)) {
$this->triggerCommandOptionDeprecation($deprecatedName, $actualName);
}
}
// Ensure the _cli_ user is authenticated
Bootstrap::initializeBackendAuthentication();
......@@ -231,35 +186,16 @@ class ExportCommand extends Command
$this->export->setTables($input->getOption('table'));
$this->export->setRecord($input->getOption('record'));
$this->export->setList($input->getOption('list'));
$this->export->setRelOnlyTables(
array_merge(
$input->getOption('includeRelated'),
$input->getOption('include-related')
)
);
$this->export->setRelStaticTables(
array_merge(
$input->getOption('includeStatic'),
$input->getOption('include-static')
)
);
$this->export->setRelOnlyTables($input->getOption('include-related'));
$this->export->setRelStaticTables($input->getOption('include-static'));
$this->export->setExcludeMap($input->getOption('exclude'));
$this->export->setExcludeDisabledRecords(
$input->getOption('excludeDisabledRecords') ||
$input->getOption('exclude-disabled-records')
);
$this->export->setIncludeExtFileResources(!(
$input->getOption('excludeHtmlCss') ||
$input->getOption('exclude-html-css')
));
$this->export->setExcludeDisabledRecords($input->getOption('exclude-disabled-records'));
$this->export->setIncludeExtFileResources(!$input->getOption('exclude-html-css'));
$this->export->setTitle((string)$input->getOption('title'));
$this->export->setDescription((string)$input->getOption('description'));
$this->export->setNotes((string)$input->getOption('notes'));
$this->export->setExtensionDependencies($input->getOption('dependency'));
$this->export->setSaveFilesOutsideExportFile(
$input->getOption('saveFilesOutsideExportFile') ||
$input->getOption('save-files-outside-export-file')
);
$this->export->setSaveFilesOutsideExportFile($input->getOption('save-files-outside-export-file'));
$this->export->process();
$saveFile = $this->export->saveToFile();
$io->success('Exporting to ' . $saveFile->getPublicUrl() . ' succeeded.');
......@@ -273,19 +209,4 @@ class ExportCommand extends Command
return 1;
}
}
/**
* @deprecated since v11, will be removed in v12. Drop all options below and look for other fallbacks in the class.
*/
protected function triggerCommandOptionDeprecation(string $deprecatedName, string $actualName): void
{
trigger_error(
sprintf(
'Command option "impexp:export %s" is deprecated and will be removed in v12. Use "%s" instead.',
$deprecatedName,
$actualName
),
E_USER_DEPRECATED
);
}
}
......@@ -98,37 +98,6 @@ class ImportCommand extends Command
InputOption::VALUE_NONE,
'If set, all database actions are logged.'
)
// @deprecated since v11, will be removed in v12. Drop all options below and look for other fallbacks in the class.
->addOption(
'updateRecords',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --update-records instead.'
)
->addOption(
'ignorePid',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --ignore-pid instead.'
)
->addOption(
'forceUid',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --force-uid instead.'
)
->addOption(
'importMode',
null,
InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
'Deprecated. Use --import-mode instead.'
)
->addOption(
'enableLog',
null,
InputOption::VALUE_NONE,
'Deprecated. Use --enable-log instead.'
)
;
}
......@@ -141,20 +110,6 @@ class ImportCommand extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
// @deprecated since v11, will be removed in v12. lowerCameCased options. Also look for other fallbacks in the class.
$deprecatedOptions = [
'--updateRecords' => '--update-records',
'--ignorePid' => '--ignore-pid',
'--forceUid' => '--force-uid',
'--importMode' => '--import-mode',
'--enableLog' => '--enable-log',
];
foreach ($deprecatedOptions as $deprecatedName => $actualName) {
if ($input->hasParameterOption($deprecatedName, true)) {
$this->triggerCommandOptionDeprecation($deprecatedName, $actualName);
}
}
// Ensure the _cli_ user is authenticated
Bootstrap::initializeBackendAuthentication();
......@@ -162,28 +117,11 @@ class ImportCommand extends Command
try {
$this->import->setPid((int)$input->getArgument('pid'));
$this->import->setUpdate(
$input->getOption('updateRecords') ||
$input->getOption('update-records')
);
$this->import->setGlobalIgnorePid(
$input->getOption('ignorePid') ||
$input->getOption('ignore-pid')
);
$this->import->setForceAllUids(
$input->getOption('forceUid') ||
$input->getOption('force-uid')
);
$this->import->setEnableLogging(
$input->getOption('enableLog') ||
$input->getOption('enable-log')
);
$this->import->setImportMode(
array_merge(
$this->parseAssociativeArray($input, 'importMode', '='),
$this->parseAssociativeArray($input, 'import-mode', '='),
)
);
$this->import->setUpdate($input->getOption('update-records'));
$this->import->setGlobalIgnorePid($input->getOption('ignore-pid'));
$this->import->setForceAllUids($input->getOption('force-uid'));
$this->import->setEnableLogging($input->getOption('enable-log'));
$this->import->setImportMode($this->parseAssociativeArray($input, 'import-mode', '='));
$this->import->loadFile((string)$input->getArgument('file'), true);
$this->import->checkImportPrerequisites();
$this->import->importData();
......@@ -200,21 +138,6 @@ class ImportCommand extends Command
}
}
/**
* @deprecated since v11, will be removed in v12. Drop all options below and look for other fallbacks in the class.
*/
protected function triggerCommandOptionDeprecation(string $deprecatedName, string $actualName): void
{
trigger_error(
sprintf(
'Command option "impexp:import %s" is deprecated and will be removed in v12. Use "%s" instead.',
$deprecatedName,
$actualName
),
E_USER_DEPRECATED
);
}
/**
* Parse a basic commandline option array into an associative array by splitting each entry into a key part and
* a value part using a specific separator.
......
......@@ -55,7 +55,6 @@ class ImportCommandTest extends AbstractImportExportTestCase
$input = [
'file' => 'EXT:impexp/Tests/Functional/Fixtures/XmlImports/sys_language.xml',
'pid' => 3,
// @deprecated since v11, will be removed in v12. Drop the lowerCamelCase options.
'--update-records' => false,
'--ignore-pid' => false,
'--force-uid' => false,
......
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Impexp\Tests\FunctionalDeprecated\Command;
use Symfony\Component\Console\Tester\CommandTester;
use TYPO3\CMS\Impexp\Command\ExportCommand;
use TYPO3\CMS\Impexp\Export;
use TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase;
/**
* Test case
*/
class ExportCommandTest extends AbstractImportExportTestCase
{
/**
* @test
*/
public function exportCommandPassesArgumentsToExportObject(): void
{
$input = [
'filename' => 'empty_export',
'--type' => Export::FILETYPE_T3D,
'--pid' => 123,
'--levels' => Export::LEVELS_RECORDS_ON_THIS_PAGE,
'--table' => ['tt_content'],
'--record' => ['sys_category:6'],
'--list' => ['sys_category:123'],
'--include-related' => ['be_users'],
// @deprecated since v11, will be removed in v12. Drop the lowerCamelCase options.
'--includeRelated' => ['be_groups'],
'--include-static' => ['sys_category'],
'--includeStatic' => ['sys_language'],
'--exclude' => ['be_users:3'],
'--exclude-disabled-records' => false,
'--excludeDisabledRecords' => true,
'--exclude-html-css' => false,
'--excludeHtmlCss' => true,
'--title' => 'Export Command',
'--description' => 'The export which considers all arguments passed on the command line.',
'--notes' => 'This export is not for production use.',
'--dependency' => ['bootstrap_package'],
'--save-files-outside-export-file' => false,
'--saveFilesOutsideExportFile' => true,
];
$exportMock = $this->getAccessibleMock(Export::class, [
'setExportFileType', 'setExportFileName', 'setPid', 'setLevels', 'setTables', 'setRecord', 'setList',
'setRelOnlyTables', 'setRelStaticTables', 'setExcludeMap', 'setExcludeDisabledRecords',
'setIncludeExtFileResources', 'setTitle', 'setDescription', 'setNotes', 'setExtensionDependencies',
'setSaveFilesOutsideExportFile',
]);
$exportMock->expects(self::once())->method('setExportFileName')->with(self::equalTo('empty_export'));
$exportMock->expects(self::once())->method('setExportFileType')->with(self::equalTo(Export::FILETYPE_T3D));
$exportMock->expects(self::once())->method('setPid')->with(self::equalTo(123));
$exportMock->expects(self::once())->method('setLevels')->with(self::equalTo(Export::LEVELS_RECORDS_ON_THIS_PAGE));
$exportMock->expects(self::once())->method('setTables')->with(self::equalTo(['tt_content']));
$exportMock->expects(self::once())->method('setRecord')->with(self::equalTo(['sys_category:6']));
$exportMock->expects(self::once())->method('setList')->with(self::equalTo(['sys_category:123']));
$exportMock->expects(self::once())->method('setRelOnlyTables')->with(self::equalTo(['be_groups', 'be_users']));
$exportMock->expects(self::once())->method('setRelStaticTables')->with(self::equalTo(['sys_language', 'sys_category']));
$exportMock->expects(self::once())->method('setExcludeMap')->with(self::equalTo(['be_users:3']));
$exportMock->expects(self::once())->method('setExcludeDisabledRecords')->with(self::equalTo(true));
$exportMock->expects(self::once())->method('setIncludeExtFileResources')->with(self::equalTo(false));
$exportMock->expects(self::once())->method('setTitle')->with(self::equalTo('Export Command'));
$exportMock->expects(self::once())->method('setDescription')->with(self::equalTo('The export which considers all arguments passed on the command line.'));
$exportMock->expects(self::once())->method('setNotes')->with(self::equalTo('This export is not for production use.'));
$exportMock->expects(self::once())->method('setExtensionDependencies')->with(self::equalTo(['bootstrap_package']));
$exportMock->expects(self::once())->method('setSaveFilesOutsideExportFile')->with(self::equalTo(true));
$tester = new CommandTester(new ExportCommand($exportMock));
$tester->execute($input);
}
}
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Impexp\Tests\FunctionalDeprecated\Command;
use Symfony\Component\Console\Tester\CommandTester;
use TYPO3\CMS\Impexp\Command\ImportCommand;
use TYPO3\CMS\Impexp\Import;
use TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase;
class ImportCommandTest extends AbstractImportExportTestCase
{
/**
* @test
*/
public function importCommandPassesArgumentsToImportObject(): void
{
$input = [
'file' => 'EXT:impexp/Tests/Functional/Fixtures/XmlImports/sys_language.xml',
'pid' => 3,
// @deprecated since v11, will be removed in v12. Drop the lowerCamelCase options.
'--update-records' => false,
'--updateRecords' => true,
'--ignore-pid' => false,
'--ignorePid' => true,
'--force-uid' => false,
'--forceUid' => true,
'--enable-log' => false,
'--enableLog' => true,
'--import-mode' => [
sprintf('pages:789=%s', Import::IMPORT_MODE_FORCE_UID),
sprintf('tt_content:1=%s', Import::IMPORT_MODE_EXCLUDE),
],
'--importMode' => [
sprintf('pages:987=%s', Import::IMPORT_MODE_FORCE_UID),
sprintf('tt_content:1=%s', Import::IMPORT_MODE_AS_NEW),
],
];
$importMock = $this->getAccessibleMock(Import::class, [
'setPid', 'setUpdate', 'setGlobalIgnorePid', 'setForceAllUids', 'setEnableLogging', 'loadFile',
'setImportMode',
]);
$importMock->expects(self::once())->method('setPid')->with(self::equalTo(3));
$importMock->expects(self::once())->method('setUpdate')->with(self::equalTo(true));
$importMock->expects(self::once())->method('setGlobalIgnorePid')->with(self::equalTo(true));
$importMock->expects(self::once())->method('setForceAllUids')->with(self::equalTo(true));
$importMock->expects(self::once())->method('setEnableLogging')->with(self::equalTo(true));
$importMock->expects(self::once())->method('setImportMode')->with(self::equalTo([
'pages:987' => Import::IMPORT_MODE_FORCE_UID,
'tt_content:1' => Import::IMPORT_MODE_EXCLUDE,
'pages:789' => Import::IMPORT_MODE_FORCE_UID,
]));
$importMock->expects(self::once())->method('loadFile')->with(self::equalTo('EXT:impexp/Tests/Functional/Fixtures/XmlImports/sys_language.xml'));
$tester = new CommandTester(new ImportCommand($importMock));
$tester->execute($input);
}
}
Supports Markdown
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