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)
--- /dev/null
+<?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
protected $descrTable = '_MOD_tools_em';
protected $parentObject;
+ /**
+ * Instance of EM API
+ *
+ * @var tx_em_API
+ */
+ protected $api;
+
/**
* Class for install extensions
*
*/
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');
}
$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);
$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 {
protected $parentObject;
+ /**
+ * Instance of EM API
+ *
+ * @var tx_em_API
+ */
+ protected $api;
+
protected $categories;
protected $types;
*/
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(
);
$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])) {
$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'] : ' ') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : ' ') . '</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>';
'<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;
'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,
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
*
'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') .
$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'];
$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 />
*/
protected $parentObject;
+ /**
+ * Instance of EM API
+ *
+ * @var tx_em_API
+ */
+ protected $api;
+
/**
*
* @var t3lib_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'];
$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:
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']))) {
$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');
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',