Revert "[TASK] Rebuild the calcAge functionality"
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / ViewHelpers / TimeSinceLastUpdateViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Shows the elapsed time since the last update of the extension repository
19 * from TER in a readable manner.
20 */
21 class TimeSinceLastUpdateViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
22
23 /**
24 * Render method
25 *
26 * @param \DateTime $lastUpdateTime The date of the last update.
27 * @return string
28 */
29 public function render($lastUpdateTime) {
30 if (NULL === $lastUpdateTime) {
31 return $GLOBALS['LANG']->sL(
32 'LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:extensionList.updateFromTer.never'
33 );
34 }
35 return \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge(
36 time() - $lastUpdateTime->format('U'),
37 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
38 );
39 }
40 }