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

[!!!][TASK] Remove deprecated code from backend functions

Resolves: #72451
Releases: master
Change-Id: Ie7c8309800304b68c2d345636ba0ecc6ba6cf872
Reviewed-on: https://review.typo3.org/45452


Reviewed-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Tested-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 0809d194
......@@ -1325,22 +1325,6 @@ class ClickMenu
}
}
/**
* Wrapping the input string in a table with background color 4 and a black border style.
* For the pop-up menu
*
* @param string $str HTML content to wrap in table.
* @return string
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function wrapColorTableCM($str)
{
GeneralUtility::logDeprecatedFunction();
return '<div class="typo3-CSM-wrapperCM">
' . $str . '
</div>';
}
/**
* Traverses the menuItems and generates an output array for implosion in the CM div-layers table.
*
......@@ -1475,19 +1459,6 @@ class ClickMenu
);
}
/**
* Returns the input string IF not a user setting has disabled display of icons.
*
* @param string $iconCode The icon-image tag
* @return string The icon-image tag prefixed with space char IF the icon should be printed at all due to user settings
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function excludeIcon($iconCode)
{
GeneralUtility::logDeprecatedFunction();
return $this->backendUser->uc['noMenuMode'] && $this->backendUser->uc['noMenuMode'] !== 'icons' ? '' : ' ' . $iconCode;
}
/**
* Enabling / Disabling items based on list provided from GET var ($this->iParts[3])
*
......
......@@ -40,14 +40,6 @@ class ContextMenuAction
*/
protected $icon = '';
/**
* Class
*
* @var string
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
protected $class = '';
/**
* Callback Action
*
......@@ -137,30 +129,6 @@ class ContextMenuAction
$this->icon = $icon;
}
/**
* Returns the class
*
* @return string
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function getClass()
{
GeneralUtility::logDeprecatedFunction();
return $this->class;
}
/**
* Sets the class
*
* @param string $class
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function setClass($class)
{
GeneralUtility::logDeprecatedFunction();
$this->class = $class;
}
/**
* Returns the callback action
*
......
......@@ -266,18 +266,12 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
$result = false;
list($matchType, $condition) = explode(':', $displayCondition, 2);
switch ($matchType) {
case 'EXT':
$result = $this->matchExtensionCondition($condition);
break;
case 'FIELD':
$result = $this->matchFieldCondition($condition, $record, $flexformContext);
break;
case 'HIDE_FOR_NON_ADMINS':
$result = $this->matchHideForNonAdminsCondition();
break;
case 'HIDE_L10N_SIBLINGS':
$result = $this->matchHideL10nSiblingsCondition();
break;
case 'REC':
$result = $this->matchRecordCondition($condition, $record);
break;
......@@ -291,31 +285,6 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
return $result;
}
/**
* Evaluates conditions concerning extensions
*
* Example:
* "EXT:saltedpasswords:LOADED:TRUE" => TRUE, if extension saltedpasswords is loaded.
*
* @param string $condition
* @return bool
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - Do not use EXT:LOADED display conditions any longer
*/
protected function matchExtensionCondition($condition)
{
GeneralUtility::logDeprecatedFunction();
$result = false;
list($extensionKey, $operator, $operand) = explode(':', $condition, 3);
if ($operator === 'LOADED') {
if (strtoupper($operand) === 'TRUE') {
$result = ExtensionManagementUtility::isLoaded($extensionKey);
} elseif (strtoupper($operand) === 'FALSE') {
$result = !ExtensionManagementUtility::isLoaded($extensionKey);
}
}
return $result;
}
/**
* Evaluates conditions concerning a field of the current record.
* Requires a record set via ->setRecord()
......@@ -430,19 +399,6 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
return (bool)$this->getBackendUser()->isAdmin();
}
/**
* Evaluates whether the field is a value for the default language.
* Works only for <langChildren>=1, otherwise it has no effect.
*
* @return bool
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
protected function matchHideL10nSiblingsCondition()
{
GeneralUtility::deprecationLog('HIDE_L10N_SIBLINGS in Flexform display conditions has been deprecated with TYPO3 CMS 7 and will be removed with TYPO3 CMS 8.');
return true;
}
/**
* Evaluates conditions concerning the status of the current record.
* Requires a record set via ->setRecord()
......
......@@ -338,19 +338,6 @@ class SuggestWizardDefaultReceiver
}
}
/**
* Return the icon for a record - just a wrapper for two functions from \TYPO3\CMS\Backend\Utility\IconUtility
*
* @param array $row The record to get the icon for
* @return string The path to the icon
* @deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8, use IconFactory::getIconForRecord() directly
*/
protected function getIcon($row)
{
GeneralUtility::logDeprecatedFunction();
return $this->iconFactory->getIconForRecord($this->mmForeignTable ?: $this->table, $row, Icon::SIZE_SMALL)->render();
}
/**
* Returns the path for a record. Is the whole path for all records except pages - for these the last part is cut
* off, because it contains the pagetitle itself, which would be double information
......
......@@ -323,56 +323,6 @@ class EvaluateDisplayConditionsTest extends UnitTestCase
$this->assertSame($expected, $this->subject->addData($input));
}
/**
* The HIDE_L10N_SIBLINGS condition is deprecated, this test only ensures that it can be successfully parsed
*
* @test
*/
public function matchHideL10NSiblingsReturnsTrue()
{
$input = [
'databaseRow' => [],
'processedTca' => [
'columns' => [
'aField' => [
'displayCond' => 'HIDE_L10N_SIBLINGS',
'config' => [
'type' => 'input',
]
],
]
]
];
$expected = $input;
$this->assertSame($expected, $this->subject->addData($input));
}
/**
* @test
*/
public function matchHideL10NSiblingsExceptAdminReturnsTrue()
{
$input = [
'databaseRow' => [],
'processedTca' => [
'columns' => [
'aField' => [
'displayCond' => 'HIDE_L10N_SIBLINGS:except_admin',
'config' => [
'type' => 'input',
]
],
]
]
];
$expected = $input;
$this->assertSame($expected, $this->subject->addData($input));
}
/**
* Returns data sets for the test matchConditionStrings
* Each data set is an array with the following elements:
......@@ -390,26 +340,6 @@ class EvaluateDisplayConditionsTest extends UnitTestCase
[],
false,
],
'Not loaded extension compares to loaded as FALSE' => [
'EXT:neverloadedext:LOADED:TRUE',
[],
false,
],
'Not loaded extension compares to not loaded as TRUE' => [
'EXT:neverloadedext:LOADED:FALSE',
[],
true,
],
'Loaded extension compares to TRUE' => [
'EXT:backend:LOADED:TRUE',
[],
true,
],
'Loaded extension compares to FALSE' => [
'EXT:backend:LOADED:FALSE',
[],
false,
],
'Field is not greater zero if not given' => [
'FIELD:uid:>:0',
[],
......@@ -500,11 +430,6 @@ class EvaluateDisplayConditionsTest extends UnitTestCase
['uid' => '23'],
false,
],
'Field is value for default language without flexform' => [
'HIDE_L10N_SIBLINGS',
[],
true,
],
'New is TRUE for new comparison with TRUE' => [
'REC:NEW:TRUE',
['uid' => null],
......
......@@ -117,13 +117,6 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
*/
public $includeGroupArray = array();
/**
* Set to 'WIN', if windows
* @var string
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the constant TYPO3_OS directly
*/
public $OS = '';
/**
* Used to accumulate the TSconfig data of the user
* @var array
......@@ -307,7 +300,6 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
parent::__construct();
$this->name = self::getCookieName();
$this->loginType = 'BE';
$this->OS = TYPO3_OS;
}
/**
......@@ -2345,44 +2337,6 @@ This is a dump of the failures:
}
}
/**
* If the backend script is in CLI mode, it will try to load a backend user named by the CLI module name (in lowercase)
*
* @return bool Returns TRUE if a CLI user was loaded, otherwise FALSE!
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. Please implement this functionality in your own application directly from the outside
*/
public function checkCLIuser()
{
GeneralUtility::logDeprecatedFunction();
// First, check if cliMode is enabled:
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
if (!$this->user['uid']) {
if (substr($GLOBALS['MCONF']['name'], 0, 5) == '_CLI_') {
$userName = strtolower($GLOBALS['MCONF']['name']);
$this->setBeUserByName($userName);
if ($this->user['uid']) {
if (!$this->isAdmin()) {
return true;
} else {
fwrite(STDERR, 'ERROR: CLI backend user "' . $userName . '" was ADMIN which is not allowed!' . LF . LF);
die(3);
}
} else {
fwrite(STDERR, 'ERROR: No backend user named "' . $userName . '" was found!' . LF . LF);
die(3);
}
} else {
fwrite(STDERR, 'ERROR: Module name, "' . $GLOBALS['MCONF']['name'] . '", was not prefixed with "_CLI_"' . LF . LF);
die(3);
}
} else {
fwrite(STDERR, 'ERROR: Another user was already loaded which is impossible in CLI mode!' . LF . LF);
die(3);
}
}
return false;
}
/**
* Initialize the internal ->uc array for the backend user
* Will make the overrides if necessary, and write the UC back to the be_users record if changes has happened
......
=================================================================
Breaking: #72451 - Removed deprecated code from backend functions
=================================================================
Description
===========
Removed deprecated code from backend functions
The following methods have been removed:
``ClickMenu::wrapColorTableCM``
``ClickMenu::excludeIcon``
``ContextMenuAction::getClass``
``ContextMenuAction::setClass``
``SuggestWizardDefaultReceiver::getIcon``
``BackendUserAuthentication::checkCLIuser``
``PageFunctionsController::printContent``
``InfoModuleController::printContent``
The following display condition option have been removed
* Evaluates conditions concerning extensions
* Evaluates whether the field is a value for the default language.
The property ``$OS`` has been removed from ``BackendUserAuthentication``
The property ``$doc`` has been removed from ``InfoModuleController``
Impact
======
Using the methods above directly in any third party extension will result in a fatal error.
Affected Installations
======================
Instances which use custom calls to one of the methods above.
Migration
=========
For property ``$OS`` use the constant TYPO3_OS directly.
......@@ -184,18 +184,6 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
$this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
}
/**
* Print module content (from $this->content)
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function printContent()
{
GeneralUtility::logDeprecatedFunction();
echo $this->content;
}
/**
* Create the panel of buttons for submitting the form or otherwise perform operations.
*/
......
......@@ -71,7 +71,7 @@ class Clickmenu
$url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
$localItems[] = $backRef->linkItem(
htmlspecialchars($this->getLanguageService()->getLLL('export', $LL)),
$backRef->excludeIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL)),
$this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL),
$backRef->urlRefForCM($url),
1
);
......@@ -86,7 +86,7 @@ class Clickmenu
$url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
$localItems[] = $backRef->linkItem(
htmlspecialchars($this->getLanguageService()->getLLL('import', $LL)),
$backRef->excludeIcon($this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL)),
$this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL),
$backRef->urlRefForCM($url),
1
);
......
......@@ -34,14 +34,6 @@ class InfoModuleController extends BaseScriptClass
*/
public $pageinfo;
/**
* Document Template Object
*
* @var \TYPO3\CMS\Backend\Template\DocumentTemplate
* @deprecated
*/
public $doc;
/**
* @var \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
*/
......@@ -132,19 +124,6 @@ class InfoModuleController extends BaseScriptClass
}
}
/**
* Print module content (from $this->content)
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function printContent()
{
GeneralUtility::logDeprecatedFunction();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
}
/**
* Injects the request object for the current request or subrequest
* Then checks for module functions that have hooked in, and renders menu etc.
......
......@@ -60,7 +60,7 @@ class VersionClickMenu
$url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
$localItems[] = $backRef->linkItem(
$GLOBALS['LANG']->getLLL('title', $LL),
$backRef->excludeIcon($this->iconFactory->getIcon('actions-version-page-open', Icon::SIZE_SMALL)->render()),
$this->iconFactory->getIcon('actions-version-page-open', Icon::SIZE_SMALL)->render(),
$backRef->urlRefForCM($url),
true
);
......
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