[BUGFIX] EM: TimeSinceLastUpdateViewHelper fatals if never updated 45/21745/2
authorAlexander Opitz <opitz.alexander@googlemail.com>
Fri, 14 Jun 2013 13:22:08 +0000 (15:22 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 30 Jun 2013 12:29:18 +0000 (14:29 +0200)
If the repository was never updated (or the update failed) last_update
has the value of zero in the database.
Then NULL->format in the TimeSinceLastUpdateViewHelper leads to the fatal
error.

Resolves: #47726
Releases: 6.2, 6.1, 6.0
Change-Id: Ia41c50f2037fb1c7ef935a8855a200b303347383
Reviewed-on: https://review.typo3.org/21745
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/extensionmanager/Classes/ViewHelpers/TimeSinceLastUpdateViewHelper.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf

index 0c70465..70445e8 100644 (file)
@@ -37,7 +37,15 @@ class TimeSinceLastUpdateViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
         * @return string
         */
        public function render($lastUpdateTime) {
-               return \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge(time() - $lastUpdateTime->format('U'), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'));
+               if (NULL === $lastUpdateTime) {
+                       return $GLOBALS['LANG']->sL(
+                               'LLL:EXT:extensionmanager/Resources/Private/Language/locallang.xlf:extensionList.updateFromTer.never'
+                       );
+               }
+               return \TYPO3\CMS\Backend\Utility\BackendUtility::calcAge(
+                       time() - $lastUpdateTime->format('U'),
+                       $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')
+               );
        }
 }
 
index c379323..c8bca28 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.never" xml:space="preserve">
+                               <source>Never</source>
+                       </trans-unit>
 
                        <trans-unit id="task.updateExtensionListTask.name" xml:space="preserve">
                                <source>Update extension list</source>