From: Steffen Kamper Date: Thu, 25 Nov 2010 23:38:59 +0000 (+0000) Subject: Fixed bug #16526: EM resolve dependencies by moving common objects to API class X-Git-Tag: TYPO3_4-5-0beta2~87 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/50af3d0c6d5af0b20b934bae26bad5f0df069e5d Fixed bug #16526: EM resolve dependencies by moving common objects to API class git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9641 709f56b5-9817-0410-a4d7-c38de5d9e867 --- diff --git a/ChangeLog b/ChangeLog index 5b0a445b9c22..0e565791a8b3 100755 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ 2010-11-25 Steffen Kamper + * 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 index 000000000000..74a1a9c38978 --- /dev/null +++ b/typo3/sysext/em/classes/class.tx_em_api.php @@ -0,0 +1,73 @@ + + * All rights reserved + * + * This script is part of the TYPO3 project. The TYPO3 project is + * free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The GNU General Public License can be found at + * http://www.gnu.org/copyleft/gpl.html. + * A copy is found in the textfile GPL.txt and important notices to the license + * from the author is found in LICENSE.txt distributed with these scripts. + * + * + * This script is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This copyright notice MUST APPEAR in all copies of the script! + ***************************************************************/ + +class tx_em_API { + + /** + * @var array + */ + public $typeLabels = array(); + + /** + * @var array + */ + public $typeDescr = array(); + + /** + * @var array + */ + public $typeBackPaths = array(); + + + /** + * Constructor + * + * @return void + */ + public function __construct() { + + // load langauge file + $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('em') . 'language/locallang.xml'); + + /** + * "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'), + ); + + + + } +} diff --git a/typo3/sysext/em/classes/extensions/class.tx_em_extensions_details.php b/typo3/sysext/em/classes/extensions/class.tx_em_extensions_details.php index eaf67d43d4c8..a09a79345a35 100644 --- a/typo3/sysext/em/classes/extensions/class.tx_em_extensions_details.php +++ b/typo3/sysext/em/classes/extensions/class.tx_em_extensions_details.php @@ -39,6 +39,13 @@ class tx_em_Extensions_Details { protected $descrTable = '_MOD_tools_em'; protected $parentObject; + /** + * Instance of EM API + * + * @var tx_em_API + */ + protected $api; + /** * Class for install extensions * @@ -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']] . ' - ' . $this->parentObject->typeDescr[$extInfo['type']] . ''; + $dataCol = $this->api->typeLabels[$extInfo['type']] . ' - ' . $this->parentObject->typeDescr[$extInfo['type']] . ''; $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 { diff --git a/typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php b/typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php index 0b48461cef70..54f04cdfea9a 100644 --- a/typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php +++ b/typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php @@ -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 = ' ' . tx_em_Tools::rfw($extInfo['doubleInstall']) . ''; } - $cells[] = '' . $this->parentObject->typeLabels[$extInfo['type']] . $doubleInstall . ''; + $cells[] = '' . $this->api->typeLabels[$extInfo['type']] . $doubleInstall . ''; } 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[] = '' . t3lib_befunc::date($extInfo['EM_CONF']['lastuploaddate']) . ''; $cells[] = '' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['author'], $GLOBALS['BE_USER']->uc[titleLen])) . ''; $cells[] = '' . $inst_curVer . ''; - $cells[] = '' . $this->parentObject->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? ' ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '' : '') . ''; + $cells[] = '' . $this->api->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? ' ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '' : '') . ''; $cells[] = '' . ($extInfo['downloadcounter_all'] ? $extInfo['downloadcounter_all'] : '  ') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : ' ') . ''; } $cells[] = '' . $this->parentObject->states[$extInfo['EM_CONF']['state']] . ''; @@ -697,7 +705,7 @@ EXTENSION KEYS: '' . $name . '' . '' . $data[EM_CONF][version] . '' . '' . $lastversion . '' . - '' . $this->parentObject->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? ' ' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '' : '') . '' . + '' . $this->api->typeLabels[$data['type']] . (strlen($data['doubleInstall']) > 1 ? ' ' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '' : '') . '' . '' . $comment . '' . LF . $warn . '
' . LF; diff --git a/typo3/sysext/em/classes/index.php b/typo3/sysext/em/classes/index.php index 37039f62b856..df4f099dc677 100644 --- a/typo3/sysext/em/classes/index.php +++ b/typo3/sysext/em/classes/index.php @@ -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, @@ -149,6 +142,13 @@ class SC_mod_tools_em_index extends t3lib_SCbase { var $inst_keys = array(); // Storage of installed extensions 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 * @@ -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 .= '' . $updateEMConf . ' ' . sprintf($GLOBALS['LANG']->getLL('extDelete_from_location'), - $this->typeLabels[$extInfo['type']], + $this->api->typeLabels[$extInfo['type']], substr($absPath, strlen(PATH_site)) ) . ''; $content .= '

' . $GLOBALS['LANG']->getLL('extUpdateEMCONF_info_changes') . '
diff --git a/typo3/sysext/em/classes/install/class.tx_em_install.php b/typo3/sysext/em/classes/install/class.tx_em_install.php index 723333e5ad38..a7854033d0cf 100644 --- a/typo3/sysext/em/classes/install/class.tx_em_install.php +++ b/typo3/sysext/em/classes/install/class.tx_em_install.php @@ -42,6 +42,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
'; $messageContent .= $GLOBALS['LANG']->getLL('ext_import_ext_type') . ' '; - $messageContent .= $this->typeLabels[$loc] . '
'; + $messageContent .= $this->api->typeLabels[$loc] . '
'; $messageContent .= '
'; // 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 .= '' . $deleteFromServer . ' ' . sprintf($GLOBALS['LANG']->getLL('extDelete_from_location'), - $this->typeLabels[$extInfo['type']], + $this->api->typeLabels[$extInfo['type']], substr($absPath, strlen(PATH_site)) ) . ''; $content .= '

' . $GLOBALS['LANG']->getLL('extDelete_backup'); diff --git a/typo3/sysext/em/ext_autoload.php b/typo3/sysext/em/ext_autoload.php index 01353de1d2bd..909fe0c2c2bf 100644 --- a/typo3/sysext/em/ext_autoload.php +++ b/typo3/sysext/em/ext_autoload.php @@ -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',