Commit 211e400c authored by Wouter Wolters's avatar Wouter Wolters Committed by Georg Ringer
Browse files

[!!!][TASK] Remove deprecated code from EXT:install

Resolves: #87292
Releases: master
Change-Id: I4ea3a115273e9b83fc7eabf0cd87440df05b0f86
Reviewed-on: https://review.typo3.org/59295


Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 5810931a
......@@ -380,6 +380,10 @@ The following PHP class methods that have been previously deprecated for v9 have
* :php:`TYPO3\CMS\Impexp\Controller\ImportExportController->handleExternalFunctionValue()`
* :php:`TYPO3\CMS\Impexp\Controller\ImportExportController->menuConfig()`
* :php:`TYPO3\CMS\Impexp\Controller\ImportExportController->mergeExternalItems()`
* :php:`TYPO3\CMS\Install\Service\CoreVersionService->getDownloadBaseUrl()`
* :php:`TYPO3\CMS\Install\Service\CoreVersionService->isYoungerPatchDevelopmentReleaseAvailable()`
* :php:`TYPO3\CMS\Install\Service\CoreVersionService->getYoungestPatchDevelopmentRelease()`
* :php:`TYPO3\CMS\Install\Service\CoreVersionService->updateVersionMatrix()`
* :php:`TYPO3\CMS\Rsaauth\RsaEncryptionEncoder->getRsaPublicKeyAjaxHandler()`
* :php:`TYPO3\CMS\Setup\Controller\SetupModuleController->getFormProtection()`
* :php:`TYPO3\CMS\Setup\Controller\SetupModuleController->simulateUser()`
......
......@@ -17,11 +17,9 @@ namespace TYPO3\CMS\Install\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Configuration\ConfigurationManager;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException;
use TYPO3\CMS\Install\Service\Exception\ConfigurationChangedException;
use TYPO3\CMS\Install\Service\SilentConfigurationUpgradeService;
......@@ -95,40 +93,6 @@ class LayoutController extends AbstractController
]);
}
/**
* Legacy ajax call. This silent updater takes care that all extensions configured in LocalConfiguration
* EXT/extConf serialized array are "upmerged" to arrays within EXTENSIONS if this extension does not
* exist in EXTENSIONS yet.
*
* @return ResponseInterface
* @deprecated since TYPO3 v9, will be removed with TYPO3 v10.0
*/
public function executeSilentLegacyExtConfExtensionConfigurationUpdateAction(): ResponseInterface
{
$configurationManager = new ConfigurationManager();
try {
$oldExtConfSettings = $configurationManager->getConfigurationValueByPath('EXT/extConf');
} catch (MissingArrayPathException $e) {
// The old 'extConf' array may not exist anymore, set to empty array if so.
$oldExtConfSettings = [];
}
try {
$newExtensionSettings = $configurationManager->getConfigurationValueByPath('EXTENSIONS');
} catch (MissingArrayPathException $e) {
// New 'EXTENSIONS' array may not exist yet, for instance if just upgrading to v9
$newExtensionSettings = [];
}
foreach ($oldExtConfSettings as $extensionName => $extensionSettings) {
if (!array_key_exists($extensionName, $newExtensionSettings)) {
$newExtensionSettings = $this->removeDotsFromArrayKeysRecursive(unserialize($extensionSettings, ['allowed_classes' => false]));
$configurationManager->setLocalConfigurationValueByPath('EXTENSIONS/' . $extensionName, $newExtensionSettings);
}
}
return new JsonResponse([
'success' => true,
]);
}
/**
* Synchronize TYPO3_CONF_VARS['EXTENSIONS'] with possibly new defaults from extensions
* ext_conf_template.txt files. This make LocalConfiguration the only source of truth for
......@@ -145,27 +109,4 @@ class LayoutController extends AbstractController
'success' => true,
]);
}
/**
* Helper method for executeSilentLegacyExtConfExtensionConfigurationUpdateAction(). Old EXT/extConf
* settings have dots at the end of array keys if nested arrays were used. The new configuration does
* not use this funny nested representation anymore. The method removes all dots at the end of given
* array keys recursive to do this transition.
*
* @param array $settings
* @return array New settings
* @deprecated since TYPO3 v9, will be removed with TYPO3 v10.0 along with executeSilentLegacyExtConfExtensionConfigurationUpdateAction()
*/
private function removeDotsFromArrayKeysRecursive(array $settings): array
{
$settingsWithoutDots = [];
foreach ($settings as $key => $value) {
if (is_array($value)) {
$settingsWithoutDots[rtrim($key, '.')] = $this->removeDotsFromArrayKeysRecursive($value);
} else {
$settingsWithoutDots[$key] = $value;
}
}
return $settingsWithoutDots;
}
}
......@@ -270,10 +270,9 @@ class UpgradeController extends AbstractController
$this->coreUpdateInitialize();
$messageQueue = new FlashMessageQueue('install');
if ($this->coreVersionService->isInstalledVersionAReleasedVersion()) {
$isDevelopmentUpdateAvailable = $this->coreVersionService->isYoungerPatchDevelopmentReleaseAvailable();
$isUpdateAvailable = $this->coreVersionService->isYoungerPatchReleaseAvailable();
$isUpdateSecurityRelevant = $this->coreVersionService->isUpdateSecurityRelevant();
if (!$isUpdateAvailable && !$isDevelopmentUpdateAvailable) {
if (!$isUpdateAvailable) {
$messageQueue->enqueue(new FlashMessage(
'',
'No regular update available',
......@@ -296,14 +295,6 @@ class UpgradeController extends AbstractController
));
$action = ['title' => 'Update now', 'action' => 'updateRegular'];
}
} elseif ($isDevelopmentUpdateAvailable) {
$newVersion = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
$messageQueue->enqueue(new FlashMessage(
'',
'Update to development release ' . $newVersion . ' is available!',
FlashMessage::INFO
));
$action = ['title' => 'Update now', 'action' => 'updateDevelopment'];
}
} else {
$messageQueue->enqueue(new FlashMessage(
......@@ -1096,12 +1087,7 @@ class UpgradeController extends AbstractController
1380975303
);
}
if ($type === 'development') {
$versionToHandle = $this->coreVersionService->getYoungestPatchDevelopmentRelease();
} else {
$versionToHandle = $this->coreVersionService->getYoungestPatchRelease();
}
return $versionToHandle;
return $this->coreVersionService->getYoungestPatchRelease();
}
/**
......
......@@ -22,7 +22,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
use TYPO3\CMS\Install\FolderStructure\DefaultFactory;
use TYPO3\CMS\Install\Service\Exception\RemoteFetchException;
/**
* Core update service.
......@@ -125,33 +124,6 @@ class CoreUpdateService
return $this->messages;
}
/**
* Wrapper method for CoreVersionService
*
* @deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0 - use REST api directly (see https://get.typo3.org/v1/api/doc)
* @return bool TRUE on success
*/
public function updateVersionMatrix()
{
trigger_error(
'The method updateVersionMatrix() is deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0, use the REST api directly (see https://get.typo3.org/v1/api/doc).',
E_USER_DEPRECATED
);
$success = true;
try {
$this->coreVersionService->getYoungestPatchRelease();
} catch (RemoteFetchException $e) {
$success = false;
$this->messages->enqueue(new FlashMessage(
'Current version specification could not be fetched from https://get.typo3.org.'
. ' This is probably a network issue, please fix it.',
'Version information could not be fetched from get.typo3.org',
FlashMessage::ERROR
));
}
return $success;
}
/**
* Check if an update is possible at all
*
......
......@@ -190,77 +190,6 @@ class CoreVersionService
return $explodedVersion[0];
}
/**
* Update version matrix from remote and store in registry
*
* @deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0 - use new REST API directly (see https://get.typo3.org/v1/api/doc)
* @throws Exception\RemoteFetchException
*/
public function updateVersionMatrix(): void
{
trigger_error('Method updateVersionMatrix will be removed in TYPO3 v10.0, use new REST API directly (see https://get.typo3.org/v1/api/doc).', E_USER_DEPRECATED);
$url = 'https://get.typo3.org/json';
$versionJson = GeneralUtility::getUrl($url);
if (!$versionJson) {
$this->throwFetchException($url);
}
$versionArray = json_decode($versionJson, true);
$installedMajorVersion = (int)$this->getInstalledMajorVersion();
foreach ($versionArray as $versionNumber => $versionDetails) {
if (is_array($versionDetails) && (int)$this->getMajorVersion((string)$versionNumber) < $installedMajorVersion) {
unset($versionArray[$versionNumber]);
}
}
$this->registry->set('TYPO3.CMS.Install', 'coreVersionMatrix', $versionArray);
}
/**
* Youngest development patch release, e.g., 6.2.0alpha3 or 6.2-snapshot-20131004
*
* @deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0 - TYPO3 release cycles do not contain development releases anymore
* @return string
* @throws \TYPO3\CMS\Install\Service\Exception\RemoteFetchException
*/
public function getYoungestPatchDevelopmentRelease(): string
{
trigger_error(
'Method getYoungestPatchDevelopmentRelease() is deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0, use getYoungestPatchRelease() instead.',
E_USER_DEPRECATED
);
return $this->getYoungestPatchRelease();
}
/**
* Returns TRUE if a younger patch level release exists in version matrix that may be a development release.
*
* @deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0 - TYPO3 release cycles do not contain development releases anymore
* @return bool TRUE if younger patch release is exists
* @throws \TYPO3\CMS\Install\Service\Exception\RemoteFetchException
*/
public function isYoungerPatchDevelopmentReleaseAvailable(): bool
{
trigger_error(
'Method isYoungerPatchDevelopmentReleaseAvailable() is deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0, use isYoungerPatchReleaseAvailable() instead.',
E_USER_DEPRECATED
);
return $this->isYoungerPatchReleaseAvailable();
}
/**
* @deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0, use 'https://get.typo3.org' directly
* @return string
*/
public function getDownloadBaseUrl(): string
{
trigger_error(
'Method getDownloadBaseUrl() is deprecated since TYPO3 v9 and will be removed in TYPO3 v10.0, use https://get.typo3.org directly.',
E_USER_DEPRECATED
);
return $this->apiBaseUrl;
}
/**
* Helper method to throw same exception in multiple places
*
......
<?php
namespace TYPO3\CMS\Install\Updates;
/*
* 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!
*/
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Generic class that every update wizard class inherits from.
* Used by the update wizard in the install tool.
*
* @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
*/
abstract class AbstractUpdate implements UpgradeWizardInterface, ChattyInterface
{
public function __construct()
{
trigger_error('Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this), E_USER_DEPRECATED);
}
/**
* The human-readable title of the upgrade wizard
*
* @var string
*/
protected $title;
/**
* The update wizard identifier
*
* @var string
*/
protected $identifier;
/**
* User input, set from outside
*
* @var string
*/
public $userInput;
/**
* @var OutputInterface
*/
protected $output;
/**
* Returns the title attribute
*
* @deprecated Deprecated since TYPO3 v9
* @return string The title of this update wizard
*/
public function getTitle(): string
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
if ($this->title) {
return $this->title;
}
return $this->identifier;
}
/**
* Sets the title attribute
*
* @param string $title The title of this update wizard
*/
public function setTitle($title)
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$this->title = $title;
}
/**
* Returns the identifier of this class
*
* @return string The identifier of this update wizard
*/
public function getIdentifier(): string
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
return $this->identifier ?? static::class;
}
/**
* Sets the identifier attribute
*
* @param string $identifier The identifier of this update wizard
*/
public function setIdentifier($identifier)
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$this->identifier = $identifier;
}
/**
* Simple wrapper function that helps dealing with the compatibility
* layer that some update wizards don't have a second parameter
* thus, it evaluates everything already
*
* @return bool If the wizard should be shown at all on the overview page
* @see checkForUpdate()
*/
public function shouldRenderWizard()
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$explanation = '';
$result = $this->checkForUpdate($explanation);
return (bool)$result === true;
}
/**
* Check if given table exists
*
* @param string $table
* @return bool
*/
protected function checkIfTableExists($table)
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$tableExists = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable($table)
->getSchemaManager()
->tablesExist([$table]);
return $tableExists;
}
/**
* Checks whether updates are required.
*
* @param string &$description The description for the update
* @return bool Whether an update is required (TRUE) or not (FALSE)
*/
abstract public function checkForUpdate(&$description);
/**
* Performs the accordant updates.
*
* @param array &$dbQueries Queries done in this update
* @param string &$customMessage Custom message
* @return bool Whether everything went smoothly or not
*/
abstract public function performUpdate(array &$dbQueries, &$customMessage);
/**
* This method can be called to install extensions following all proper processes
* (e.g. installing in extList, respecting priority, etc.)
*
* @param array $extensionKeys List of keys of extensions to install
*/
protected function installExtensions(array $extensionKeys)
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
/** @var \TYPO3\CMS\Extensionmanager\Utility\InstallUtility $installUtility */
$installUtility = GeneralUtility::makeInstance(
\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class
);
$installUtility->install($extensionKeys);
}
/**
* Marks some wizard as being "seen" so that it not shown again.
*
* Writes the info in LocalConfiguration.php
*
* @param mixed $confValue The configuration is set to this value
*/
protected function markWizardAsDone($confValue = 1)
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
GeneralUtility::makeInstance(Registry::class)->set('installUpdate', static::class, $confValue);
}
/**
* Checks if this wizard has been "done" before
*
* @return bool TRUE if wizard has been done before, FALSE otherwise
*/
protected function isWizardDone()
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$wizardClassName = static::class;
return GeneralUtility::makeInstance(Registry::class)->get('installUpdate', $wizardClassName, false);
}
/**
* Return the description for this wizard
*
* @return string
*/
public function getDescription(): string
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
return '';
}
/**
* Execute the update
* Called when a wizard reports that an update is necessary
*
* @return bool
*/
public function executeUpdate(): bool
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$queries = [];
$message = '';
$result = $this->performUpdate($queries, $message);
$this->output->write($message);
return $result;
}
/**
* Is an update necessary?
* Is used to determine whether a wizard needs to be run.
* Check if data for migration exists.
*
* @return bool
*/
public function updateNecessary(): bool
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$description = '';
$result = $this->checkForUpdate($description);
$this->output->write($description);
return $result;
}
/**
* Returns an array of class names of Prerequisite classes
* This way a wizard can define dependencies like "database up-to-date" or
* "reference index updated"
*
* @return string[]
*/
public function getPrerequisites(): array
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
return [
DatabaseUpdatedPrerequisite::class
];
}
/**
* Setter injection for output into upgrade wizards
*
* @param OutputInterface $output
*/
public function setOutput(OutputInterface $output): void
{
trigger_error(
'Deprecated since TYPO3 v9, will be removed in TYPO3 v10.0, use UpgradeWizardInterface directly. affected class: ' . get_class($this),
E_USER_DEPRECATED
);
$this->output = $output;
}
}
......@@ -2331,6 +2331,7 @@ return [
'maximumNumberOfArguments' => 0,
'restFiles' => [
'Deprecation-84549-DeprecateMethodsInCoreVersionService.rst',
'Breaking-87193-DeprecatedFunctionalityRemoved.rst'
],
],
'TYPO3\CMS\Install\Service\CoreVersionService->isYoungerPatchDevelopmentReleaseAvailable' => [
......@@ -2338,6 +2339,7 @@ return [
'maximumNumberOfArguments' => 0,
'restFiles' => [
'Deprecation-84549-DeprecateMethodsInCoreVersionService.rst',
'Breaking-87193-DeprecatedFunctionalityRemoved.rst'
],
],
'TYPO3\CMS\Install\Service\CoreVersionService->getYoungestPatchDevelopmentRelease' => [
......@@ -2345,6 +2347,7 @@ return [
'maximumNumberOfArguments' => 0,
'restFiles' => [
'Deprecation-84549-DeprecateMethodsInCoreVersionService.rst',
'Breaking-87193-DeprecatedFunctionalityRemoved.rst'
],
],
'TYPO3\CMS\Install\Service\CoreVersionService->updateVersionMatrix' => [
......@@ -2352,6 +2355,7 @@ return [
'maximumNumberOfArguments' => 0,
'restFiles' => [
'Deprecation-84549-DeprecateMethodsInCoreVersionService.rst',
'Breaking-87193-DeprecatedFunctionalityRemoved.rst'
],
],
'TYPO3\CMS\Core\TypoScript\TemplateService->linkData' => [
......