Commit 5355b0d9 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[!!!][TASK] Remove deprecated code from Extbase

Removes and adapts some classes, methods and parameters
which were marked as deprecated.

Resolves: #80713
Releases: master
Change-Id: Iae9c7035f72e3af0f9b4056cc507515546ecdbf9
Reviewed-on: https://review.typo3.org/52507

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarThomas Hohn <thomas@hohn.dk>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent ba4bc25f
......@@ -99,6 +99,14 @@ The following PHP class methods that have been previously deprecated for v8 have
* TYPO3\CMS\Core\Utility\GeneralUtility::strtolower()
* TYPO3\CMS\Core\Utility\GeneralUtility::strtoupper()
* TYPO3\CMS\Core\Utility\GeneralUtility::xmlGetHeaderAttribs()
* TYPO3\CMS\Extbase\Domain\Model\Category->getIcon()
* TYPO3\CMS\Extbase\Domain\Model\Category->setIcon()
* TYPO3\CMS\Extbase\Persistence\Generic\Qom\Comparison->getParameterIdentifier()
* TYPO3\CMS\Extbase\Persistence\Generic\Qom\Comparison->setParameterIdentifier()
* TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->getUsePreparedStatement()
* TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->getUseQueryCache()
* TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->usePreparedStatement()
* TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings->useQueryCache()
* TYPO3\CMS\Fluid\Core\Rendering\RenderingContext->getObjectManager()
* TYPO3\CMS\Fluid\Core\Rendering\RenderingContext->getTemplateVariableContainer()
* TYPO3\CMS\Fluid\Core\Rendering\RenderingContext->injectObjectManager()
......@@ -158,6 +166,10 @@ The following methods changed signature according to previous deprecations in v8
* TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName() - Second and thrird argument dropped
* TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj() - File reference prefix in first argument removed
* TYPO3\CMS\Core\Utility\GeneralUtility::wrapJS() - Second argument dropped
* TYPO3\CMS\Extbase\Persistence\Generic\Qom\Statement - support for \TYPO3\CMS\Core\Database\PreparedStatement as argument dropped
* TYPO3\CMS\Extbase\Mvc\Cli\ConsoleOutput->askAndValidate() - support for boolean as fourth argument removed
* TYPO3\CMS\Extbase\Mvc\Cli\ConsoleOutput->select() - support for boolean as fifth argument removed
* TYPO3\CMS\Extbase\Persistence\Generic\Query->like() - Third argument dropped
* TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->searchWhere() - Third parameter is now mandatory
* TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->whichWorkspace() - First argument removed
* TYPO3\CMS\Frontend\Plugin\AbstractPlugin->__constructor() - First argument unused
......@@ -189,6 +201,9 @@ The following class properties have changed visibility:
* TYPO3\CMS\Core\DataHandling\DataHandler->cachedTSconfig changed from public to protected
* TYPO3\CMS\Core\DataHandling\DataHandler->pageCache changed from public to protected
The following Interface signatures have been changed:
* TYPO3\CMS\Extbase\Persistence\Generic\QueryInterface->like() - Third argument dropped
The following configuration options are not evaluated anymore:
* $TYPO3_CONF_VARS[SC_OPTIONS][GLOBAL][cliKeys]
* $TYPO3_CONF_VARS[FE][noPHPscriptInclude]
......@@ -200,6 +215,9 @@ The following entry points have been removed:
The following hooks have been removed:
* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass']
The following functionality has been removed:
* Support for legacy prepared statements within Extbase Persistence within Qom\Statement
The following TypoScript options have been removed:
* stdWrap.fontTag
* stdWrap.removeBadHTML
......
......@@ -32,11 +32,6 @@ class Category extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $description = '';
/**
* @var string
*/
protected $icon = '';
/**
* @var \TYPO3\CMS\Extbase\Domain\Model\Category|NULL
* @lazy
......@@ -87,30 +82,6 @@ class Category extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->description = $description;
}
/**
* Returns the icon
*
* @return string $icon
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9
*/
public function getIcon()
{
\TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
return $this->icon;
}
/**
* Sets the icon
*
* @param string $icon
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9
*/
public function setIcon($icon)
{
\TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
$this->icon = $icon;
}
/**
* Gets the parent category.
*
......
......@@ -25,7 +25,6 @@ use Symfony\Component\Console\Output\ConsoleOutput as SymfonyConsoleOutput;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* A wrapper for Symfony ConsoleOutput and related helpers
......@@ -150,17 +149,12 @@ class ConsoleOutput
* @param array $choices List of choices to pick from
* @param bool $default The default answer if the user enters nothing
* @param bool $multiSelect If TRUE the result will be an array with the selected options. Multiple options can be given separated by commas
* @param null|bool|int $attempts Max number of times to ask before giving up (null by default, which means infinite)
* @param null|int $attempts Max number of times to ask before giving up (null by default, which means infinite)
* @return int|string|array The selected value or values (the key of the choices array)
* @throws \InvalidArgumentException
*/
public function select($question, $choices, $default = null, $multiSelect = false, $attempts = null)
{
// boolean option is @deprecated in TYPO3 v8, will be removed in TYPO3 v9
if ($attempts === false) {
GeneralUtility::deprecationLog('CLI output select() asks for infinite attempts by setting the value to "false", but should be null by default. Use "null" instead in your CommandController.');
$attempts = null;
}
$question = (new ChoiceQuestion($question, $choices, $default))
->setMultiselect($multiSelect)
->setMaxAttempts($attempts)
......@@ -228,7 +222,7 @@ class ConsoleOutput
*
* @param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
* @param callable $validator A PHP callback that gets a value and is expected to return the (transformed) value or throw an exception if it wasn't valid
* @param int|null|bool $attempts Max number of times to ask before giving up (null by default, which means infinite)
* @param int|null $attempts Max number of times to ask before giving up (null by default, which means infinite)
* @param string $default The default answer if none is given by the user
* @param array $autocomplete List of values to autocomplete. This only works if "stty" is installed
* @return mixed
......@@ -236,11 +230,6 @@ class ConsoleOutput
*/
public function askAndValidate($question, $validator, $attempts = null, $default = null, array $autocomplete = null)
{
// boolean option is @deprecated in TYPO3 v8, will be removed in TYPO3 v9
if ($attempts === false) {
GeneralUtility::deprecationLog('CLI output askAndValidate() sets infinite attempts by setting the value to "false", but should be null by default. Use "null" instead in your CommandController.');
$attempts = null;
}
$question = (new Question($question, $default))
->setValidator($validator)
->setMaxAttempts($attempts)
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Extbase\Mvc\Controller;
*/
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Cli\CommandArgumentDefinition;
use TYPO3\CMS\Extbase\Mvc\Cli\ConsoleOutput;
use TYPO3\CMS\Extbase\Mvc\Cli\Request;
......@@ -249,43 +248,6 @@ class CommandController implements CommandControllerInterface
}
}
/**
* Set admin permissions for currently authenticated user if requested
* and returns the original state or NULL
*
* @return NULL|int
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9, because admin role is always used in CLI mode
*/
protected function ensureAdminRoleIfRequested()
{
GeneralUtility::logDeprecatedFunction();
$userAuthentication = $this->getBackendUserAuthentication();
if (!$this->requestAdminPermissions || $userAuthentication === null || !isset($userAuthentication->user['admin'])) {
return null;
}
$originalRole = $userAuthentication->user['admin'];
$userAuthentication->user['admin'] = 1;
return $originalRole;
}
/**
* Restores the original user role
*
* @param NULL|int $originalRole
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9, because admin role is always used in CLI mode
*/
protected function restoreUserRole($originalRole)
{
GeneralUtility::logDeprecatedFunction();
$userAuthentication = $this->getBackendUserAuthentication();
if ($originalRole !== null && $userAuthentication !== null) {
$userAuthentication->user['admin'] = $originalRole;
}
}
/**
* Outputs specified text to the console window
* You can specify arguments that will be passed to the text via sprintf
......
......@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
......@@ -77,12 +76,6 @@ class Comparison implements ComparisonInterface
*/
protected $operand2;
/**
* @var string
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9
*/
protected $parameterIdentifier;
/**
* Constructs this Comparison instance
*
......@@ -137,26 +130,6 @@ class Comparison implements ComparisonInterface
return $this->operand2;
}
/**
* @param string $parameterIdentifier
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9
*/
public function setParameterIdentifier($parameterIdentifier)
{
GeneralUtility::logDeprecatedFunction();
$this->parameterIdentifier = $parameterIdentifier;
}
/**
* @return string
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9
*/
public function getParameterIdentifier()
{
GeneralUtility::logDeprecatedFunction();
return $this->parameterIdentifier;
}
/**
* Fills an array with the names of all bound variables in the constraints
*
......
......@@ -20,7 +20,7 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
class Statement implements ConstraintInterface
{
/**
* @var string|\TYPO3\CMS\Core\Database\PreparedStatement|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder
* @var string|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder
*/
protected $statement;
......@@ -32,7 +32,7 @@ class Statement implements ConstraintInterface
/**
* Constructs the Statement instance
*
* @param string|\TYPO3\CMS\Core\Database\PreparedStatement|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder $statement The statement as sql string or an instance of TYPO3\CMS\Core\Database\PreparedStatement, \Doctrine\DBAL\Statement or \TYPO3\CMS\Core\Database\Query\QueryBuilder
* @param string|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder $statement The statement as sql string or an instance of \Doctrine\DBAL\Statement or \TYPO3\CMS\Core\Database\Query\QueryBuilder
* @param array $boundVariables An array of variables to bind to the statement, only to be used with prepared statements
*/
public function __construct($statement, array $boundVariables = [])
......@@ -44,7 +44,7 @@ class Statement implements ConstraintInterface
/**
* Gets the statement.
*
* @return string|\TYPO3\CMS\Core\Database\PreparedStatement|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder the statement; non-null
* @return string|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder the statement; non-null
*/
public function getStatement()
{
......
......@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Extbase\Persistence\Generic;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
......@@ -493,21 +492,11 @@ class Query implements QueryInterface
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @param bool $caseSensitive, deprecated since TYPO3 v8, will be removed in TYPO3 v9
* @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\ComparisonInterface
* @api
*/
public function like($propertyName, $operand, $caseSensitive = null)
public function like($propertyName, $operand)
{
if ($caseSensitive !== null) {
GeneralUtility::deprecationLog(
'The parameter $caseSensitive for the Extbase like criterion has been deprecated.' .
'A case sensitive comparison cannot be reliably done as it is dependent on Database ' .
'Server settings. For MySQL switch the field to a case sensitive collation to achieve ' .
'the desired result.'
);
}
return $this->qomFactory->comparison(
$this->qomFactory->propertyValue($propertyName, $this->getSelectorName()),
QueryInterface::OPERATOR_LIKE,
......
......@@ -379,12 +379,6 @@ class Typo3DbBackend implements BackendInterface, SingletonInterface
throw new SqlErrorException($e->getPrevious()->getMessage(), 1481281404);
}
$rows = $realStatement->fetchAll();
} elseif ($realStatement instanceof \TYPO3\CMS\Core\Database\PreparedStatement) {
GeneralUtility::deprecationLog('Extbase support for Prepared Statements has been deprecated in TYPO3 v8, and will be removed in TYPO3 v9. Use native Doctrine DBAL Statements or QueryBuilder objects.');
$realStatement->execute($parameters);
$rows = $realStatement->fetchAll();
$realStatement->free();
} else {
// Do a real raw query. This is very stupid, as it does not allow to use DBAL's real power if
// several tables are on different databases, so this is used with caution and could be removed
......
......@@ -90,22 +90,6 @@ class Typo3QuerySettings implements QuerySettingsInterface
*/
protected $languageUid = 0;
/**
* Flag whether the query should use a prepared statement
*
* @var bool
* @deprecated since TYPO3 v8, will be removed in TYPO3 9, this option is handled automatically now in the database abstraction
*/
protected $usePreparedStatement = false;
/**
* Flag whether the query should be cached using the caching framework
*
* @var bool
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9, as the database is taking care of query caching
*/
protected $useQueryCache = true;
/**
* As long as we use a feature flag ignoreAllEnableFieldsInBe to determine the default behavior, the
* initializeObject is responsible for handling that.
......@@ -338,48 +322,4 @@ class Typo3QuerySettings implements QuerySettingsInterface
{
return $this->includeDeleted;
}
/**
* @param bool $usePreparedStatement
* @return QuerySettingsInterface
* @deprecated since TYPO3 v8, will be removed in TYPO3 9, this option is handled automatically now in the database abstraction
*/
public function usePreparedStatement($usePreparedStatement)
{
GeneralUtility::logDeprecatedFunction();
$this->usePreparedStatement = $usePreparedStatement;
return $this;
}
/**
* @return bool
* @deprecated since TYPO3 v8, will be removed in TYPO3 9, this option is handled automatically now in the database abstraction
*/
public function getUsePreparedStatement()
{
GeneralUtility::logDeprecatedFunction();
return (bool)$this->usePreparedStatement;
}
/**
* @param bool $useQueryCache
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9, as the database is taking care of query caching
* @return QuerySettingsInterface
*/
public function useQueryCache($useQueryCache)
{
GeneralUtility::logDeprecatedFunction();
$this->useQueryCache = (bool)$useQueryCache;
return $this;
}
/**
* @return bool
* @deprecated since TYPO3 v8, will be removed in TYPO3 v9, as the database is taking care of query caching
*/
public function getUseQueryCache()
{
GeneralUtility::logDeprecatedFunction();
return $this->useQueryCache;
}
}
......@@ -237,12 +237,11 @@ interface QueryInterface
*
* @param string $propertyName The name of the property to compare against
* @param string $operand The value to compare with
* @param bool $caseSensitive Whether the matching should be done case-sensitive
* @return ComparisonInterface
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException if used on a non-string property
* @api
*/
public function like($propertyName, $operand, $caseSensitive = true);
public function like($propertyName, $operand);
/**
* Returns a "contains" criterion used for matching objects against a query.
......
......@@ -63,23 +63,6 @@ class CategoryTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
$this->assertSame('foo bar', $this->fixture->getDescription());
}
/**
* @test
*/
public function getIconInitiallyReturnsEmptyString()
{
$this->assertSame('', $this->fixture->getIcon());
}
/**
* @test
*/
public function setIconSetsIcon()
{
$this->fixture->setIcon('icon.png');
$this->assertSame('icon.png', $this->fixture->getIcon());
}
/**
* @test
*/
......
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