Fixed bug #16526: EM resolve dependencies by moving common objects to API class
authorSteffen Kamper <info@sk-typo3.de>
Thu, 25 Nov 2010 23:38:59 +0000 (23:38 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Thu, 25 Nov 2010 23:38:59 +0000 (23:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9641 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/em/classes/class.tx_em_api.php [new file with mode: 0644]
typo3/sysext/em/classes/extensions/class.tx_em_extensions_details.php
typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php
typo3/sysext/em/classes/index.php
typo3/sysext/em/classes/install/class.tx_em_install.php
typo3/sysext/em/ext_autoload.php

index 5b0a445..0e56579 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
 
 2010-11-25  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #16526: EM resolve dependencies by moving common objects to API class
        * Fixed bug #16527: EM: delete of extension does not work
        * Fixed bug #16528: EM: remove dependency to $TBE_TEMPLATE
        * Fixed bug #16565: Bug: FlashmessageQueue does not work in FE mode (Thanks to Bastian Waidelich)
diff --git a/typo3/sysext/em/classes/class.tx_em_api.php b/typo3/sysext/em/classes/class.tx_em_api.php
new file mode 100644 (file)
index 0000000..74a1a9c
--- /dev/null
@@ -0,0 +1,73 @@
+<?php\r
+/***************************************************************\r
+ *  Copyright notice\r
+ *\r
+ *  (c) 2010 Steffen Kamper <steffen@typo3.org>\r
+ *  All rights reserved\r
+ *\r
+ *  This script is part of the TYPO3 project. The TYPO3 project is\r
+ *  free software; you can redistribute it and/or modify\r
+ *  it under the terms of the GNU General Public License as published by\r
+ *  the Free Software Foundation; either version 2 of the License, or\r
+ *  (at your option) any later version.\r
+ *\r
+ *  The GNU General Public License can be found at\r
+ *  http://www.gnu.org/copyleft/gpl.html.\r
+ *  A copy is found in the textfile GPL.txt and important notices to the license\r
+ *  from the author is found in LICENSE.txt distributed with these scripts.\r
+ *\r
+ *\r
+ *  This script is distributed in the hope that it will be useful,\r
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ *  GNU General Public License for more details.\r
+ *\r
+ *  This copyright notice MUST APPEAR in all copies of the script!\r
+ ***************************************************************/\r
+\r
+class tx_em_API {\r
+\r
+       /**\r
+        * @var array\r
+        */\r
+       public $typeLabels = array();\r
+\r
+       /**\r
+        * @var array\r
+        */\r
+       public $typeDescr = array();\r
+\r
+       /**\r
+        * @var array\r
+        */\r
+       public $typeBackPaths = array();\r
+\r
+\r
+       /**\r
+        * Constructor\r
+        *\r
+        * @return void\r
+        */\r
+       public function __construct() {\r
+\r
+               // load langauge file\r
+               $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('em') . 'language/locallang.xml');\r
+\r
+               /**\r
+                * "TYPE" information; labels, paths, description etc.\r
+                */\r
+               $this->typeLabels = array(\r
+                       'S' => $GLOBALS['LANG']->getLL('type_system'),\r
+                       'G' => $GLOBALS['LANG']->getLL('type_global'),\r
+                       'L' => $GLOBALS['LANG']->getLL('type_local'),\r
+               );\r
+               $this->typeDescr = array(\r
+                       'S' => $GLOBALS['LANG']->getLL('descr_system'),\r
+                       'G' => $GLOBALS['LANG']->getLL('descr_global'),\r
+                       'L' => $GLOBALS['LANG']->getLL('descr_local'),\r
+               );\r
+\r
+\r
+\r
+       }\r
+}\r
index eaf67d4..a09a793 100644 (file)
@@ -40,6 +40,13 @@ class tx_em_Extensions_Details {
        protected $parentObject;
 
        /**
+        * Instance of EM API
+        *
+        * @var tx_em_API
+        */
+       protected $api;
+
+       /**
         * Class for install extensions
         *
         * @var em_install
@@ -53,6 +60,7 @@ class tx_em_Extensions_Details {
         */
        public function __construct($parentObject = NULL) {
                $this->parentObject = $parentObject;
+               $this->api = t3lib_div::makeInstance('tx_em_API');
                $this->install = t3lib_div::makeInstance('tx_em_Install', $this);
                $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('em') . 'language/locallang.xml');
        }
@@ -565,7 +573,7 @@ $EM_CONF[$_EXTKEY] = ' . tx_em_Tools::arrayToCode($EM_CONF, 0) . ';
 
                        $headerCol = $GLOBALS['LANG']->getLL('extInfoArray_inst_type');
                        $headerCol = t3lib_BEfunc::wrapInHelp($this->parentObject->descrTable, 'emconf_type', $headerCol);
-                       $dataCol = $this->parentObject->typeLabels[$extInfo['type']] . ' - <em>' . $this->parentObject->typeDescr[$extInfo['type']] . '</em>';
+                       $dataCol = $this->api->typeLabels[$extInfo['type']] . ' - <em>' . $this->parentObject->typeDescr[$extInfo['type']] . '</em>';
                        $lines[] = array($headerCol, $dataCol);
 
 
@@ -735,13 +743,13 @@ $EM_CONF[$_EXTKEY] = ' . tx_em_Tools::arrayToCode($EM_CONF, 0) . ';
                        $others = array();
                        for ($a = 0; $a < strlen($dbInst); $a++) {
                                if (substr($dbInst, $a, 1) != $current) {
-                                       $others[] = '"' . $this->parentObject->typeLabels[substr($dbInst, $a, 1)] . '"';
+                                       $others[] = '"' . $this->api->typeLabels[substr($dbInst, $a, 1)] . '"';
                                }
                        }
                        return tx_em_Tools::rfw(
                                sprintf($GLOBALS['LANG']->getLL('extInfoArray_double_installation_infotext'),
                                        implode(' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:and') . ' ', $others),
-                                       $this->parentObject->typeLabels[$current]
+                                       $this->api->typeLabels[$current]
                                )
                        );
                } else {
index 0b48461..54f04cd 100644 (file)
@@ -36,6 +36,13 @@ class tx_em_Extensions_List {
 
        protected $parentObject;
 
+       /**
+        * Instance of EM API
+        *
+        * @var tx_em_API
+        */
+       protected $api;
+
        protected $categories;
        protected $types;
 
@@ -47,6 +54,7 @@ class tx_em_Extensions_List {
         */
        public function __construct($parentObject = NULL) {
                $this->parentObject = $parentObject;
+               $this->api = t3lib_div::makeInstance('tx_em_API');
                $this->install = t3lib_div::makeInstance('tx_em_Install', $this);
 
                $this->categories = array(
@@ -581,7 +589,7 @@ EXTENSION KEYS:
                                        );
                                        $doubleInstall = ' <strong><abbr title="' . $doubleInstallTitle . '">' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</abbr></strong>';
                                }
-                               $cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$extInfo['type']] . $doubleInstall . '</td>';
+                               $cells[] = '<td nowrap="nowrap">' . $this->api->typeLabels[$extInfo['type']] . $doubleInstall . '</td>';
                        } else { // Listing extensions from REMOTE repository:
                                $inst_curVer = $inst_list[$extKey]['EM_CONF']['version'];
                                if (isset($inst_list[$extKey])) {
@@ -592,7 +600,7 @@ EXTENSION KEYS:
                                $cells[] = '<td nowrap="nowrap">' . t3lib_befunc::date($extInfo['EM_CONF']['lastuploaddate']) . '</td>';
                                $cells[] = '<td nowrap="nowrap">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['author'], $GLOBALS['BE_USER']->uc[titleLen])) . '</td>';
                                $cells[] = '<td nowrap="nowrap">' . $inst_curVer . '</td>';
-                               $cells[] = '<td nowrap="nowrap">' . $this->parentObject->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>';
+                               $cells[] = '<td nowrap="nowrap">' . $this->api->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>';
                                $cells[] = '<td nowrap="nowrap">' . ($extInfo['downloadcounter_all'] ? $extInfo['downloadcounter_all'] : '&nbsp;&nbsp;') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : '&nbsp;') . '</td>';
                        }
                        $cells[] = '<td nowrap="nowrap" class="extstate" style="background-color:' . $this->parentObject->stateColors[$extInfo['EM_CONF']['state']] . ';">' . $this->parentObject->states[$extInfo['EM_CONF']['state']] . '</td>';
@@ -697,7 +705,7 @@ EXTENSION KEYS:
                                                '<td valign="top">' . $name . '</td>' .
                                                '<td valign="top" align="right">' . $data[EM_CONF][version] . '</td>' .
                                                '<td valign="top" align="right">' . $lastversion . '</td>' .
-                                               '<td valign="top" nowrap="nowrap">' . $this->parentObject->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</strong>' : '') . '</td>' .
+                                               '<td valign="top" nowrap="nowrap">' . $this->api->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</strong>' : '') . '</td>' .
                                                '<td valign="top">' . $comment . '</td></tr>' . LF .
                                                $warn .
                                                '<tr class="bgColor4"><td colspan="7"><hr style="margin:0px" /></td></tr>' . LF;
index 37039f6..df4f099 100644 (file)
@@ -107,13 +107,6 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
                'excludeFromUpdates' => '#cf7307'
        );
 
-       /**
-        * "TYPE" information; labels, paths, description etc. See init()
-        */
-       var $typeLabels = array();
-       var $typeDescr = array();
-       var $typeBackPaths = array(); // Also static, set in init()
-
        var $detailCols = array(
                0 => 2,
                1 => 5,
@@ -150,6 +143,13 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
        var $gzcompress = 0; // Is set true, if system support compression.
 
        /**
+        * Instance of EM API
+        *
+        * @var tx_em_API
+        */
+       protected $api;
+
+       /**
         * instance of TER connection handler
         *
         * @var tx_em_Connection_Ter
@@ -260,21 +260,6 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
                        'excludeFromUpdates' => $GLOBALS['LANG']->getLL('state_exclude_from_updates')
                );
 
-               /**
-                * "TYPE" information; labels, paths, description etc.
-                */
-               $this->typeLabels = array(
-                       'S' => $GLOBALS['LANG']->getLL('type_system'),
-                       'G' => $GLOBALS['LANG']->getLL('type_global'),
-                       'L' => $GLOBALS['LANG']->getLL('type_local'),
-               );
-               $this->typeDescr = array(
-                       'S' => $GLOBALS['LANG']->getLL('descr_system'),
-                       'G' => $GLOBALS['LANG']->getLL('descr_global'),
-                       'L' => $GLOBALS['LANG']->getLL('descr_local'),
-               );
-
-
                $this->script = 'mod.php?M=tools_em';
                $this->privacyNotice = $GLOBALS['LANG']->getLL('privacy_notice');
                $securityMessage = $GLOBALS['LANG']->getLL('security_warning_extensions') .
@@ -316,6 +301,7 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
                $this->doc->setModuleTemplate('templates/em_index.html');
 
                // Initialize helper objects
+               $this->api = t3lib_div::makeInstance('tx_em_API');
                $this->terConnection = t3lib_div::makeInstance('tx_em_Connection_Ter', $this);
                $this->terConnection->wsdlURL = $TYPO3_CONF_VARS['EXT']['em_wsdlURL'];
 
@@ -2181,7 +2167,7 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
                        $content .= '<a class="t3-link" href="#" onclick="' . htmlspecialchars($onClick) .
                                        ' return false;"><strong>' . $updateEMConf . '</strong> ' .
                                        sprintf($GLOBALS['LANG']->getLL('extDelete_from_location'),
-                                               $this->typeLabels[$extInfo['type']],
+                                               $this->api->typeLabels[$extInfo['type']],
                                                substr($absPath, strlen(PATH_site))
                                        ) . '</a>';
                        $content .= '<br /><br />' . $GLOBALS['LANG']->getLL('extUpdateEMCONF_info_changes') . '<br />
index 723333e..a785403 100644 (file)
@@ -43,6 +43,13 @@ class tx_em_Install {
        protected $parentObject;
 
        /**
+        * Instance of EM API
+        *
+        * @var tx_em_API
+        */
+       protected $api;
+
+       /**
         *
         * @var t3lib_install
         */
@@ -59,6 +66,7 @@ class tx_em_Install {
        public function __construct($parentObject = NULL) {
                $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('em', 'language/locallang.xml'));
                $this->parentObject = $parentObject;
+               $this->api = t3lib_div::makeInstance('tx_em_API');
                $this->install = t3lib_div::makeInstance('t3lib_install');
                $this->install->INSTALL = t3lib_div::_GP('TYPO3_INSTALL');
                $this->systemInstall = isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall']) && $GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall'];
@@ -202,7 +210,7 @@ class tx_em_Install {
 
                                                                                        $messageContent .= 'ext_emconf.php: ' . $extDirPath . 'ext_emconf.php<br />';
                                                                                        $messageContent .= $GLOBALS['LANG']->getLL('ext_import_ext_type') . ' ';
-                                                                                       $messageContent .= $this->typeLabels[$loc] . '<br />';
+                                                                                       $messageContent .= $this->api->typeLabels[$loc] . '<br />';
                                                                                        $messageContent .= '<br />';
 
                                                                                        // Remove cache files:
@@ -537,7 +545,7 @@ class tx_em_Install {
                        return $GLOBALS['LANG']->getLL('extDelete_ext_active');
                } elseif (!tx_em_Tools::deleteAsType($extInfo['type'])) {
                        return sprintf($GLOBALS['LANG']->getLL('extDelete_wrong_scope'),
-                               $this->typeLabels[$extInfo['type']]
+                               $this->api->typeLabels[$extInfo['type']]
                        );
                } elseif (t3lib_div::inList('G,L', $extInfo['type'])) {
                        if ($command['doDelete'] && !strcmp($absPath, urldecode($command['absPath']))) {
@@ -570,7 +578,7 @@ class tx_em_Install {
                                $content .= '<a class="t3-link" href="#" onclick="' . htmlspecialchars($onClick) .
                                                ' return false;"><strong>' . $deleteFromServer . '</strong> ' .
                                                sprintf($GLOBALS['LANG']->getLL('extDelete_from_location'),
-                                                       $this->typeLabels[$extInfo['type']],
+                                                       $this->api->typeLabels[$extInfo['type']],
                                                        substr($absPath, strlen(PATH_site))
                                                ) . '</a>';
                                $content .= '<br /><br />' . $GLOBALS['LANG']->getLL('extDelete_backup');
index 01353de..909fe0c 100644 (file)
@@ -4,7 +4,8 @@ $emInterfacesPath = PATH_site . 'typo3/sysext/em/interfaces/';
 return array(
        'tx_em_index_checkdatabaseupdateshook' => $emInterfacesPath . 'interface.tx_em_index_checkdatabaseupdateshook.php',
 
-       'sc_mod_tools_em_index' => $emClassesPath . '../classes/index.php',
+       'sc_mod_tools_em_index' => $emClassesPath . 'index.php',
+       'tx_em_api' => $emClassesPath . 'class.tx_em_api.php',
 
        'tx_em_connection_ter' => $emClassesPath . 'connection/class.tx_em_connection_ter.php',
        'tx_em_connection_soap' => $emClassesPath . 'connection/class.tx_em_connection_soap.php',