[BUGFIX] Extension Security Report goes green if TER was never fetched 93/20493/2
authorMario Rimann <mario.rimann@typo3.org>
Tue, 17 Jul 2012 19:17:27 +0000 (21:17 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 5 May 2013 12:05:18 +0000 (14:05 +0200)
Shows a notice for both the extension security checks as long as
the check for the main repository is not showing an OK state.

As soon as the main repository check is OK, the status of the
extensions will be checked as before.

Change-Id: I41aaa6f4bbb36e32dcb1f734c2b491164a705c76
Resolves: #39043
Releases: 4.7, 4.5
Reviewed-on: https://review.typo3.org/20493
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/em/classes/reports/class.tx_em_reports_extensionstatus.php
typo3/sysext/em/language/locallang.xml

index d8c2cd3..82c7499 100644 (file)
@@ -52,19 +52,43 @@ class tx_em_reports_ExtensionStatus  implements tx_reports_StatusProvider {
                $this->ok = $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:msg_ok');
                $this->upToDate = $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:translation_status_uptodate');
                $this->error = t3lib_div::strtoupper($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:msg_error'));
-               $status = $this->getInsecuredExtensionsInSystem();
-
-               $statuses = array(
-                       'mainRepositoryCheck' => $this->checkMainRepositoryCheck(),
-                       'extensionsSecurityStatusNotInstalled' => $status[0],
-                       'extensionsSecurityStatusInstalled' => $status[1],
-               );
+               $terStatus =  $this->checkMainRepositoryCheck();
+
+                       // Generate a notice if the TER has never been fetched or is not up-to-date
+               if ($terStatus->getSeverity() != tx_reports_reports_status_Status::OK) {
+                       $outdatedStatusExisting = t3lib_div::makeInstance(
+                                       'tx_reports_reports_status_Status',
+                                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_StatusExistingExtensions'),
+                                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_ExtensionsNotProperlyConfiguredOrListOutdatedTitle'),
+                                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_ExtensionsNotProperlyConfiguredOrListOutdated'),
+                                       tx_reports_reports_status_Status::INFO
+                       );
+                       $outdatedStatusInstalled = t3lib_div::makeInstance(
+                                       'tx_reports_reports_status_Status',
+                                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_StatusInstalledExtensions'),
+                                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_ExtensionsNotProperlyConfiguredOrListOutdatedTitle'),
+                                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_ExtensionsNotProperlyConfiguredOrListOutdated'),
+                                       tx_reports_reports_status_Status::INFO
+                       );
+                       $statuses = array(
+                               'mainRepositoryCheck' => $terStatus,
+                               'extensionsSecurityStatusNotInstalled' => $outdatedStatusExisting,
+                               'extensionsSecurityStatusInstalled' => $outdatedStatusInstalled,
+                       );
+               } else {
+                       $status = $this->getInsecuredExtensionsInSystem();
 
+                       $statuses = array(
+                               'mainRepositoryCheck' => $terStatus,
+                               'extensionsSecurityStatusNotInstalled' => $status[0],
+                               'extensionsSecurityStatusInstalled' => $status[1],
+                       );
+               }
                return $statuses;
        }
 
        /**
-        * Checks main repository in sys_ter (existance, has extensions / update older tha 7 days
+        * Checks main repository in sys_ter (existence, has extensions / update older than 7 days)
         *
         * @return      tx_reports_reports_status_Status        An tx_reports_reports_status_Status object representing whether
         */
@@ -113,21 +137,21 @@ class tx_em_reports_ExtensionStatus  implements tx_reports_StatusProvider {
 
 
        /**
-        * Checks if there are insecure extensions in system
+        * Checks if there are insecure extensions in system.
         *
-        * @return      tx_reports_reports_status_Status        An tx_reports_reports_status_Status object representing whether
+        * @return tx_reports_reports_status_Status A status object representing whether any extensions are known to be insecure
         */
        protected function getInsecuredExtensionsInSystem() {
-               $value    = array(
+               $value = array(
                        $this->ok,
                        $this->ok
                );
                $message  = array('', '');
                $severity = array(tx_reports_reports_status_Status::OK, tx_reports_reports_status_Status::OK);
-          $initialMessage = array(
-                  $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_insecureInstalledExtensions') . '<br><br>',
-                  $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_insecureExistingExtensions') . '<br><br>',
-          );
+               $initialMessage = array(
+                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_insecureInstalledExtensions') . '<br><br>',
+                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_insecureExistingExtensions') . '<br><br>',
+               );
                $extensionList = array();
                $installedExtensionList = array();
                $extensionCompareList = array();
index 37bf1e3..b47fbfa 100644 (file)
                        <label index="reports_MainRepositoryOldList">The Main Repository extension list is older than 7 days. Please update it in the Extension manager or Scheduler.</label>
                        <label index="reports_NoExtensionsFound">No extensions found!</label>
                        <label index="reports_ExtensionsNotUpToDate">Extension list is not up to date!</label>
+                       <label index="reports_ExtensionsNotProperlyConfiguredOrListOutdatedTitle">Status unknown!</label>
+                       <label index="reports_ExtensionsNotProperlyConfiguredOrListOutdated">The status of the extensions is either outdated or was never fetched from the TER. Please update the list of extensions from TER for a current information on the security status of the extensions.</label>
                        <label index="wsdlUrl">WSDL URL</label>
                        <label index="msg_items">Items</label>
                        <label index="msg_item">Item</label>