|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the TYPO3 CMS project. |
|
5
|
|
|
* |
|
6
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
8
|
|
|
* of the License, or any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
* |
|
13
|
|
|
* The TYPO3 project - inspiring people to share! |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace TYPO3\CMS\Extensionmanager\ViewHelpers; |
|
17
|
|
|
|
|
18
|
|
|
use TYPO3\CMS\Core\Imaging\Icon; |
|
19
|
|
|
use TYPO3\CMS\Core\Imaging\IconFactory; |
|
20
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
21
|
|
|
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder; |
|
22
|
|
|
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; |
|
23
|
|
|
use TYPO3\CMS\Extensionmanager\Utility\UpdateScriptUtility; |
|
24
|
|
|
use TYPO3\CMS\Fluid\ViewHelpers\Link\ActionViewHelper; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* ViewHelper for update script link |
|
28
|
|
|
* @internal |
|
29
|
|
|
*/ |
|
30
|
|
|
class UpdateScriptViewHelper extends ActionViewHelper |
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* initialize arguments |
|
34
|
|
|
*/ |
|
35
|
|
|
public function initializeArguments() |
|
36
|
|
|
{ |
|
37
|
|
|
parent::initializeArguments(); |
|
38
|
|
|
$this->registerArgument('extensionKey', 'string', 'Extension key', true); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Renders a link to the update script screen if the extension has one |
|
43
|
|
|
* |
|
44
|
|
|
* @return string The rendered a tag |
|
45
|
|
|
*/ |
|
46
|
|
|
public function render() |
|
47
|
|
|
{ |
|
48
|
|
|
$extensionKey = $this->arguments['extensionKey']; |
|
49
|
|
|
|
|
50
|
|
|
// If the "class.ext_update.php" file exists, build link to the update script screen |
|
51
|
|
|
$updateScriptUtility = GeneralUtility::makeInstance(UpdateScriptUtility::class); |
|
52
|
|
|
$iconFactory = GeneralUtility::makeInstance(IconFactory::class); |
|
53
|
|
|
if ($updateScriptUtility->checkUpdateScriptExists($extensionKey)) { |
|
54
|
|
|
/** @var UriBuilder $uriBuilder */ |
|
55
|
|
|
$uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder(); |
|
|
|
|
|
|
56
|
|
|
$action = 'show'; |
|
57
|
|
|
$uri = $uriBuilder->reset()->uriFor( |
|
58
|
|
|
$action, |
|
59
|
|
|
['extensionKey' => $extensionKey], |
|
60
|
|
|
'UpdateScript' |
|
61
|
|
|
); |
|
62
|
|
|
$this->tag->addAttribute('href', $uri); |
|
63
|
|
|
$this->tag->addAttribute('title', LocalizationUtility::translate('extensionList.update.script', 'extensionmanager')); |
|
64
|
|
|
$this->tag->setContent($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)->render()); |
|
65
|
|
|
$tag = $this->tag->render(); |
|
66
|
|
|
} else { |
|
67
|
|
|
return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>'; |
|
68
|
|
|
} |
|
69
|
|
|
return $tag; |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.