[BUGFIX] EM 6.0 doesn't store extension state from TER
authorJigal van Hemert <jigal@xs4all.nl>
Mon, 22 Oct 2012 11:03:03 +0000 (13:03 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Mon, 22 Oct 2012 12:44:24 +0000 (14:44 +0200)
The extension state is stored as text in the TER dump, but stored as
an integer in the database. The correct conversion must be done to
be able to show the states from extensions in TER.

Change-Id: I9fc05a61df1df71696c690874507f7bbc51e9aab
Fixes: #42260
Releases: 6.0
Reviewed-on: http://review.typo3.org/15877
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php

index af8190b..03d38e8 100644 (file)
@@ -339,21 +339,23 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
         * @return mixed
         */
        public function getDefaultState($state = NULL) {
+               $defaultState = '';
                if (is_null($state)) {
                        $defaultState = self::$defaultStates;
                } else {
                        if (is_string($state)) {
-                               // default state
-                               $stateIndex = 999;
-                               if (array_key_exists(strtolower($state), self::$defaultStates)) {
-                                       $stateIndex = self::$defaultStates[strtolower($state)];
+                               $stateIndex = array_search(strtolower($state), self::$defaultStates);
+                               if ($stateIndex === FALSE) {
+                                       // default state
+                                       $stateIndex = 999;
                                }
                                $defaultState = $stateIndex;
                        } else {
                                if (is_int($state) && $state >= 0) {
-                                       $stateTitle = array_search($state, self::$defaultStates);
-                                       // default state
-                                       if (!$stateTitle) {
+                                       if (array_key_exists($state, self::$defaultStates)) {
+                                               $stateTitle = self::$defaultStates[$state];
+                                       } else {
+                                               // default state
                                                $stateTitle = 'n/a';
                                        }
                                        $defaultState = $stateTitle;