Skip to content

Commit

Permalink
[TASK] Drop a series of unused code occurences
Browse files Browse the repository at this point in the history
A couple of not needed assignments throughout the
core and a 'too many arguments' fix.

Resolves: #92605
Releases: master
Change-Id: I883dc2fcc12c72c525bc7a44236cac8311d96f11
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66182
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
lolli42 authored and ervaude committed Oct 28, 2020
1 parent ae79e25 commit ceb9032
Show file tree
Hide file tree
Showing 18 changed files with 7 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ protected function makeEditForm(): string
$this->errorC++;
// Try to fetch error message from "recordInternals" be user object
// @todo: This construct should be logged and localized and de-uglified
$message = (!empty($beUser->errorMsg)) ? $beUser->errorMsg : $message = $e->getMessage() . ' ' . $e->getCode();
$message = (!empty($beUser->errorMsg)) ? $beUser->errorMsg : $e->getMessage() . ' ' . $e->getCode();
$title = $this->getLanguageService()
->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.noEditPermission');
$editForm .= $this->getInfobox($message, $title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public function render()

$table = $this->data['tableName'];
$field = $this->data['fieldName'];
$row = $this->data['databaseRow'];
$parameterArray = $this->data['parameterArray'];
$config = $parameterArray['fieldConf']['config'];

Expand Down
12 changes: 0 additions & 12 deletions typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;

Expand All @@ -36,7 +35,6 @@ class EditPopup extends AbstractNode
*/
public function render()
{
$languageService = $this->getLanguageService();
$options = $this->data['renderData']['fieldControlOptions'];

$title = $options['title'] ?? 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.edit';
Expand Down Expand Up @@ -100,14 +98,4 @@ public function render()
],
];
}

/**
* Returns an instance of LanguageService
*
* @return LanguageService
*/
protected function getLanguageService()
{
return $GLOBALS['LANG'];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,12 @@ public function ext_isLinkable($doktype, $uid)
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param string $bMark If set, the link will have an anchor point (=$bMark) and a name attribute (=$bMark)
* @param string $bMark If set, the link will have a name attribute (=$bMark)
* @param bool $isOpen
* @return string Link-wrapped input string
*/
public function PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false)
{
$anchor = $bMark ? '#' . $bMark : '';
$name = $bMark ? ' name=' . $bMark : '';
$urlParameters = $this->linkParameterProvider->getUrlParameters([]);
$urlParameters['PM'] = $cmd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ protected function setSessionCookie()
$isSetSessionCookie = $this->isSetSessionCookie();
$isRefreshTimeBasedCookie = $this->isRefreshTimeBasedCookie();
if ($isSetSessionCookie || $isRefreshTimeBasedCookie) {
$settings = $GLOBALS['TYPO3_CONF_VARS']['SYS'];
// Get the domain to be used for the cookie (if any):
$cookieDomain = $this->getCookieDomain();
// If no cookie domain is set, use the base path:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ public function authUser(array $user): int
$saltFactory = GeneralUtility::makeInstance(PasswordHashFactory::class);

// Get a hashed password instance for the hash stored in db of this user
$invalidPasswordHashException = null;
try {
$hashInstance = $saltFactory->get($passwordHashInDatabase, $this->pObj->loginType);
} catch (InvalidPasswordHashException $invalidPasswordHashException) {
} catch (InvalidPasswordHashException $exception) {
// Could not find a responsible hash algorithm for given password. This is unusual since other
// authentication services would usually be called before this one with higher priority. We thus log
// the failed login but still return '100' to proceed with other services that may follow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public function createDependencyInjectionContainer(PackageManager $packageManage
return new FailsafeContainer($serviceProviderRegistry, $this->defaultServices);
}

$container = null;

$cacheIdentifier = $this->getCacheIdentifier($packageManager);
$containerClassName = $cacheIdentifier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,6 @@ public function fixVersioningPid($table, &$rr)
return;
}
$uid = (int)$rr['uid'];
$oid = 0;
$workspaceId = 0;
$versionState = null;
// Check values for t3ver_state and t3ver_wsid
Expand Down
3 changes: 0 additions & 3 deletions typo3/sysext/core/Classes/Resource/ResourceStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2188,10 +2188,8 @@ protected function getAllFileObjectsInFolder(Folder $folder)
public function moveFolder(Folder $folderToMove, Folder $targetParentFolder, $newFolderName = null, $conflictMode = DuplicationBehavior::RENAME)
{
// @todo add tests
$originalFolder = $folderToMove->getParentFolder();
$this->assureFolderMovePermissions($folderToMove, $targetParentFolder);
$sourceStorage = $folderToMove->getStorage();
$returnObject = null;
$sanitizedNewFolderName = $this->driver->sanitizeFileName($newFolderName ?: $folderToMove->getName());
// @todo check if folder already exists in $targetParentFolder, handle this conflict then
$this->eventDispatcher->dispatch(
Expand Down Expand Up @@ -2321,7 +2319,6 @@ public function renameFolder($folderObject, $newName)
}

$sanitizedNewName = $this->driver->sanitizeFileName($newName);
$returnObject = null;
if ($this->driver->folderExistsInFolder($sanitizedNewName, $folderObject->getIdentifier())) {
throw new \InvalidArgumentException('The folder ' . $sanitizedNewName . ' already exists in folder ' . $folderObject->getIdentifier(), 1325418870);
}
Expand Down
1 change: 0 additions & 1 deletion typo3/sysext/core/Classes/Resource/StorageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ public function getStorageObject($uid, array $recordData = [], &$fileIdentifier
}
if (empty($this->storageInstances[$uid])) {
$storageConfiguration = null;
$storageObject = null;
/** @var BeforeResourceStorageInitializationEvent $event */
$event = $this->eventDispatcher->dispatch(new BeforeResourceStorageInitializationEvent($uid, $recordData, $fileIdentifier));
$recordData = $event->getRecord();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ protected function getFrontendConstraintStatement($tableName, $ignoreEnableField
if ($ignoreEnableFields && !$includeDeleted) {
if (!empty($enableFieldsToBeIgnored)) {
// array_combine() is necessary because of the way \TYPO3\CMS\Core\Domain\Repository\PageRepository::enableFields() is implemented
$statement .= $this->getPageRepository()->enableFields($tableName, -1, array_combine($enableFieldsToBeIgnored, $enableFieldsToBeIgnored), true);
$statement .= $this->getPageRepository()->enableFields($tableName, -1, array_combine($enableFieldsToBeIgnored, $enableFieldsToBeIgnored));
} elseif (!empty($GLOBALS['TCA'][$tableName]['ctrl']['delete'])) {
$statement .= ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['delete'] . '=0';
}
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/filelist/Classes/FileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ public function makeEdit($fileOrFolderObject)
// replace file
if ($fileOrFolderObject instanceof File && $fileOrFolderObject->checkActionPermission('replace')) {
$attributes = [
'href' => $url = (string)$this->uriBuilder->buildUriFromRoute('file_replace', ['target' => $fullIdentifier, 'uid' => $fileOrFolderObject->getUid(), 'returnUrl' => $this->listURL()]),
'href' => (string)$this->uriBuilder->buildUriFromRoute('file_replace', ['target' => $fullIdentifier, 'uid' => $fileOrFolderObject->getUid(), 'returnUrl' => $this->listURL()]),
'title' => $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.replace'),
];
$cells['replace'] = '<a class="btn btn-default" ' . GeneralUtility::implodeAttributes($attributes, true) . '>' . $this->iconFactory->getIcon('actions-edit-replace', Icon::SIZE_SMALL)->render() . '</a>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ protected function registerDocheaderButtons()
$buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
$currentRequest = $this->request;
$moduleName = $currentRequest->getPluginName();
$getVars = $this->request->getArguments();

// Create new
$addFormButton = $buttonBar->makeLinkButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ public static function mapValueToOption($value, array $options)
*/
public static function processObject(FormElementInterface $element, $object): string
{
$properties = $element->getProperties();

if ($element instanceof StringableFormElementInterface) {
return $element->valueToString($object);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4547,8 +4547,6 @@ public function getKey($key, $arr)
*/
protected function resolveMixedLinkParameter($linkText, $mixedLinkParameter, &$configuration = [])
{
$linkParameter = null;

// Link parameter value = first part
$linkParameterParts = GeneralUtility::makeInstance(TypoLinkCodecService::class)->decode($mixedLinkParameter);

Expand All @@ -4560,7 +4558,6 @@ protected function resolveMixedLinkParameter($linkText, $mixedLinkParameter, &$c
// Disallow insecure scheme's like javascript: or data:
return $linkText;
}
$linkParameter = $linkParameterParts['url'];

// additional parameters that need to be set
if ($linkParameterParts['additionalParams'] !== '') {
Expand All @@ -4570,7 +4567,7 @@ protected function resolveMixedLinkParameter($linkText, $mixedLinkParameter, &$c
}

return [
'href' => $linkParameter,
'href' => $linkParameterParts['url'],
'target' => $linkParameterParts['target'],
'class' => $linkParameterParts['class'],
'title' => $linkParameterParts['title']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
*/
protected function simulateDate(ServerRequestInterface $request): bool
{
$simulatedDate = null;
$queryTime = $request->getQueryParams()['ADMCMD_simTime'] ?? false;
if (!$queryTime) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/impexp/Classes/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ public function processSoftReferences_substTokens($tokenizedContent, $softRefCfg
*/
public function processSoftReferences_saveFile($relFileName, $cfg, $table, $uid)
{
if ($fileHeaderInfo = $this->dat['header']['files'][$cfg['file_ID']]) {
if ($this->dat['header']['files'][$cfg['file_ID']]) {
// Initialize; Get directory prefix for file and find possible RTE filename
$dirPrefix = PathUtility::dirname($relFileName) . '/';
if (GeneralUtility::isFirstPartOfStr($dirPrefix, $this->fileadminFolderName . '/')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ public function main()
$url = (string)$uriBuilder->buildUriFromRoute('web_ts', $urlParameters);
HttpUtility::redirect($url);
}
$tce = null;
if ($existTemplate) {
$lang = $this->getLanguageService();
$lang->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_info.xlf');
Expand Down

0 comments on commit ceb9032

Please sign in to comment.