[BUGFIX] Extension Manager does not use calcAge 34/19634/2
authorBenjamin Mack <benni@typo3.org>
Fri, 5 Apr 2013 21:22:21 +0000 (23:22 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 5 Apr 2013 22:21:40 +0000 (00:21 +0200)
The extension manager does his own magic with calculating the age
of the last TER update. This can be done automatically with
BackendUtility::calcAge.

Resolves: #46962
Relates: #46524
Releases: 6.1, 6.0
Change-Id: I1917da7fa97e8692ee5bac799377e2a62ad14864
Reviewed-on: https://review.typo3.org/19634
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/ViewHelpers/TimeSinceLastUpdateViewHelper.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf

index 9efe621..0c70465 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 namespace TYPO3\CMS\Extensionmanager\ViewHelpers;
-use \TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 
 /*****************************************************************
  *  Copyright notice
@@ -38,34 +37,7 @@ class TimeSinceLastUpdateViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
         * @return string
         */
        public function render($lastUpdateTime) {
-
-               $now = new \DateTime();
-               $timeSinceLastUpdate = $lastUpdateTime->diff($now, TRUE);
-
-               $result = '';
-
-               if ($timeSinceLastUpdate->days > 1) {
-                       $label = LocalizationUtility::translate('extensionList.updateFromTer.lastUpdate.days.plural', 'extensionmanager');
-                       $result = $timeSinceLastUpdate->format('%a') . $label;
-
-               } elseif ($timeSinceLastUpdate->days === 1) {
-                       $label = LocalizationUtility::translate('extensionList.updateFromTer.lastUpdate.days.singular', 'extensionmanager');
-                       $result = '1' . $label;
-
-               } elseif ($timeSinceLastUpdate->h > 1) {
-                       $label = LocalizationUtility::translate('extensionList.updateFromTer.lastUpdate.hours.plural', 'extensionmanager');
-                       $result = $timeSinceLastUpdate->format('%h') . $label;
-
-               } elseif ($timeSinceLastUpdate->h === 1) {
-                       $label = LocalizationUtility::translate('extensionList.updateFromTer.lastUpdate.hours.singular', 'extensionmanager');
-                       $result = '1' . $label;
-
-               } else {
-                       $label = LocalizationUtility::translate('extensionList.updateFromTer.lastUpdate.lessThanOneHour', 'extensionmanager');
-                       $result = $label;
-               }
-
-               return $result;
+               return \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge(time() - $lastUpdateTime->format('U'), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'));
        }
 }
 
index 413691b..46d21bf 100644 (file)
                        <trans-unit id="extensionList.updateFromTer.lastUpdate.noTimeOfLastUpdate" xml:space="preserve">
                                <source>No last update time known.</source>
                        </trans-unit>
-                       <trans-unit id="extensionList.updateFromTer.lastUpdate.days.plural" xml:space="preserve">
-                               <source> days</source>
-                       </trans-unit>
-                       <trans-unit id="extensionList.updateFromTer.lastUpdate.days.singular" xml:space="preserve">
-                               <source> day</source>
-                       </trans-unit>
-                       <trans-unit id="extensionList.updateFromTer.lastUpdate.hours.plural" xml:space="preserve">
-                               <source> hours</source>
-                       </trans-unit>
-                       <trans-unit id="extensionList.updateFromTer.lastUpdate.hours.singular" xml:space="preserve">
-                               <source> hour</source>
-                       </trans-unit>
-                       <trans-unit id="extensionList.updateFromTer.lastUpdate.lessThanOneHour" xml:space="preserve">
-                               <source>Less than one hour</source>
-                       </trans-unit>
 
                        <trans-unit id="task.updateExtensionListTask.name" xml:space="preserve">
                                <source>Update extension list</source>