[TASK] Add support for "outdated" extensions 42/21742/2
authorJigal van Hemert <jigal.van.hemert@typo3.org>
Sun, 30 Jun 2013 06:14:47 +0000 (08:14 +0200)
committerErnesto Baschny <ernst@cron-it.de>
Fri, 5 Jul 2013 15:56:59 +0000 (17:56 +0200)
Extension Manager displays installed extensions which are marked as
"outdated" with different styling. Reports module also checks for
installed and available "outdated" extensions.

Change-Id: I3050f3f7142e4153954f1b7f76b4bf64a3066223
Resolves: #49350
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/21742
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php
typo3/sysext/em/classes/reports/class.tx_em_reports_extensionstatus.php
typo3/sysext/em/language/locallang.xml
typo3/sysext/em/res/css/t3_em.css
typo3/sysext/em/res/js/em_components.js
typo3/sysext/em/res/js/em_tools.js
typo3/sysext/t3skin/stylesheets/visual/module_admin_extension_manager.css

index 4b4103c..1301ac3 100644 (file)
@@ -700,11 +700,19 @@ EXTENSION KEYS:
                }
 
                // show a different background through a different class for insecure (-1) extensions,
+               // and for outdated (-2) extensions,
                // for unreviewed (0) and reviewed extensions (1), just use the regular class
-               if ($this->xmlHandler->getReviewState($extKey, $extInfo['EM_CONF']['version']) < 0) {
-                       $bgclass = ' class="unsupported-ext"';
-               } else {
-                       $bgclass = ' class="' . ($bgColorClass ? $bgColorClass : 'em-listbg1') . '"';
+               $reviewState = $this->xmlHandler->getReviewState($extKey, $extInfo['EM_CONF']['version']);
+               switch ($reviewState) {
+                       case -2:
+                               $bgclass = ' class="outdated-ext"';
+                               break;
+                       case -1:
+                               $bgclass = ' class="unsupported-ext"';
+                               break;
+                       default:
+                               $bgclass = ' class="' . ($bgColorClass ? $bgColorClass : 'em-listbg1') . '"';
+                               break;
                }
 
                return '
index d8c2cd3..f1d4240 100644 (file)
@@ -58,6 +58,8 @@ class tx_em_reports_ExtensionStatus  implements tx_reports_StatusProvider {
                        'mainRepositoryCheck' => $this->checkMainRepositoryCheck(),
                        'extensionsSecurityStatusNotInstalled' => $status[0],
                        'extensionsSecurityStatusInstalled' => $status[1],
+                       'extensionsOutdatedStatusNotInstalled' => $status[2],
+                       'extensionsOutdatedStatusInstalled' => $status[3],
                );
 
                return $statuses;
@@ -120,18 +122,28 @@ class tx_em_reports_ExtensionStatus  implements tx_reports_StatusProvider {
        protected function getInsecuredExtensionsInSystem() {
                $value    = array(
                        $this->ok,
+                       $this->ok,
+                       $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>',
-          );
+               $severity = array(
+                       tx_reports_reports_status_Status::OK,
+                       tx_reports_reports_status_Status::OK,
+                       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>',
+                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_outdatedInstalledExtensions') . '<br><br>',
+                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_outdatedExistingExtensions') . '<br><br>',
+               );
                $extensionList = array();
                $installedExtensionList = array();
                $extensionCompareList = array();
                $unsecureList = array();
+               $outdatedList = array();
 
                /** @var $list tx_em_Extensions_List */
                $list = t3lib_div::makeInstance('tx_em_Extensions_List');
@@ -193,6 +205,46 @@ class tx_em_reports_ExtensionStatus  implements tx_reports_StatusProvider {
                        $severity[1]
                );
 
+                       // get outdated extensions from database
+               $outdatedListRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('extkey, version', 'cache_extensions',
+                       'reviewstate=-2 and extkey IN(' . $flatList . ')');
+               foreach ($outdatedListRows as $row) {
+                       $outdatedList[] = $row['extkey'] . '|' . $row['version'];
+               }
+               $resultArray = array_intersect($extensionCompareList, $outdatedList);
+
+               if (count($resultArray) > 0) {
+                       $count = array(0, 0);
+                       foreach ($resultArray as $result) {
+                               $temp = explode('|', $result);
+                               $index = in_array($temp[0], $installedExtensionList, TRUE) ? 2 : 3;
+                               $severity[$index] = tx_reports_reports_status_Status::WARNING;
+                               $count[$index]++;
+                               if ($message[$index] === '') {
+                                       $message[$index] = $initialMessage[$index];
+                               }
+                               $message[$index] .= '<strong>' . $temp[0] . '</strong> (version ' . $temp[1] . ')<br>';
+                       }
+                       if ($count[2]) {
+                               $value[2] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_outdatedExtensionsFound'), $count[2]);
+                       }
+                       if ($count[3]) {
+                               $value[3] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_outdatedExtensionsFound'), $count[3]);
+                       }
+               }
+
+               $status[2] = t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_StatusInstalledOutdatedExtensions'),
+                       $value[2],
+                       $message[2],
+                       $severity[2]);
+
+               $status[3] = t3lib_div::makeInstance('tx_reports_reports_status_Status',
+                       $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:reports_StatusExistingOutdatedExtensions'),
+                       $value[3],
+                       $message[3],
+                       $severity[3]);
+
                return $status;
        }
 
index 37bf1e3..296f9a2 100644 (file)
                        <label index="reports_StatusMainRepositoryUpdate">Last update of TYPO3 main repository</label>
                        <label index="reports_insecureInstalledExtensions">The following extensions are insecure and usage might damage your system. Please update these extensions as soon as possible or remove them from your system:</label>
                        <label index="reports_insecureExistingExtensions">The following extensions were found on your system, but are currently not installed. Please delete the extensions using the extension manager:</label>
+                       <label index="reports_outdatedInstalledExtensions">The following extensions are outdated and may not be compatible with your installation. Please make sure these extensions are compatible and ask the extension author to publish updates:</label>
+                       <label index="reports_outdatedExistingExtensions">The following extensions were found on your system, but are currently not installed. Please make sure they are compatible with your system before installing them:</label>
                        <label index="reports_StatusInstalledExtensions">Security status of installed extensions</label>
                        <label index="reports_StatusExistingExtensions">Security status of existing extensions</label>
+                       <label index="reports_StatusInstalledOutdatedExtensions">Outdated status of installed extensions</label>
+                       <label index="reports_StatusExistingOutdatedExtensions">Outdated status of existing extensions</label>
                        <label index="insecureExtension">This extension is marked as insecure and usage might damage your system. Please update this extension as soon as possible or remove it from your system.</label>
+                       <label index="outdatedExtension">The following extensions are outdated and may not be compatible with your installation. Please make sure these extensions are compatible and ask the extension author to publish updates.</label>
                        <label index="reports_insecureExtensionsFound">%s insecure extension(s) found</label>
+                       <label index="reports_outdatedExtensionsFound">%s outdated extension(s) found</label>
                        <label index="reports_sysTerNotFound">The table "sys_ter" was not found. Please go to the Install Tool and do a database compare!</label>
                        <label index="reports_MainRepositoryNotFound">The Main Repository entry in table "sys_ter" was not found. Please go to the Extension Manager and import static data!</label>
                        <label index="reports_MainRepositoryNoExtensions">The Main Repository has no extensions. Please update the repository in the Extension Manager or the Scheduler.</label>
index c5c590d..7ca9338 100644 (file)
@@ -217,6 +217,11 @@ a.email {
        font-weight: bold;
 }
 
+.outdatedExtension {
+       color: #0c08ff;
+       font-weight: bold;
+}
+
 .paddingActionIcon img {
        margin-right: 5px;
 }
index 437b16a..d1ff25e 100644 (file)
@@ -294,10 +294,14 @@ TYPO3.EM.GridColumns.ExtensionTitle = {
                if (value == '') {
                        value = '[no title]';
                }
-               if (record.data.reviewstate < 0) {
+               if (record.data.reviewstate == -1) {
                        metaData.css += ' insecureExtension';
                        description += '<br><br><strong>' + TYPO3.lang.insecureExtension + '</strong>';
                }
+               if (record.data.reviewstate == -2) {
+                       metaData.css += ' outdatedExtension';
+                       description += '<br><br><strong>' + TYPO3.lang.outdatedExtension + '</strong>';
+               }
                if (description) {
                        metaData.attr = 'ext:qtip="' + Ext.util.Format.htmlEncode(description) + '"';
                }
index 82bfb77..e273e53 100644 (file)
@@ -62,9 +62,12 @@ TYPO3.EM.Tools = function() {
                        if (value == '') {
                                value = '[no title]';
                        }
-                       if (record.data.reviewstate < 0) {
+                       if (record.data.reviewstate == -1) {
                                description += '<br><br><strong>' + TYPO3.lang.insecureExtension + '</strong>';
                        }
+                       if (record.data.reviewstate == -2) {
+                               description += '<br><br><strong>' + TYPO3.lang.outdatedExtension + '</strong>';
+                       }
                        return record.data.icon + ' ' + value + ' (v' + record.data.version + ')';
                },
 
index 0469dd0..7b23eb8 100644 (file)
@@ -32,6 +32,18 @@ body#typo3-mod-tools-em-index-php tr.unsupported-ext td a {
        color: #ff0000;
 }
 
+body#typo3-mod-tools-em-index-php tr.outdated-ext {
+       background-color: #e7e9ff;
+}
+
+body#typo3-mod-tools-em-index-php tr.outdated-ext td {
+       color: #0c08ff;
+}
+
+body#typo3-mod-tools-em-index-php tr.outdated-ext td a {
+       color: #0c08ff;
+}
+
 body#typo3-mod-tools-em-index-php tr td.extstate {
        color: #fff;
        font-weight: bold;