Bug #24116 ยป 16457.patch
typo3/sysext/em/classes/tools/class.tx_em_tools.php (revision ) | ||
---|---|---|
/**
|
||
* Refreshes the global extension list
|
||
*
|
||
* @return void
|
||
*/
|
||
function refreshGlobalExtList() {
|
||
global $TYPO3_LOADED_EXT;
|
||
$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
|
||
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
|
||
require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
|
||
}
|
||
return;
|
||
$GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::typo3_loadExtensions();
|
||
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
|
||
require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
|
||
} else {
|
||
$temp_TYPO3_LOADED_EXT = $TYPO3_LOADED_EXT;
|
||
foreach ($temp_TYPO3_LOADED_EXT as $_EXTKEY => $temp_lEDat) {
|
||
if (is_array($temp_lEDat) && $temp_lEDat['ext_localconf.php']) {
|
||
$_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
|
||
require($temp_lEDat['ext_localconf.php']);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* Set category array entries for extension
|
||
*
|
||
* @param array Category index array
|
typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php (revision ) | ||
---|---|---|
'</a></td>';
|
||
// Manual download
|
||
$fileP = PATH_site . $this->parentObject->typePaths[$extInfo['type']] . $extKey . '/doc/manual.sxw';
|
||
$fileP = PATH_site . tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw';
|
||
$cells[] = '<td nowrap="nowrap">' .
|
||
($this->parentObject->typePaths[$extInfo['type']] && @is_file($fileP) ?
|
||
'<a href="' . htmlspecialchars(t3lib_div::resolveBackPath($this->parentObject->doc->backPath . '../' . $this->parentObject->typePaths[$extInfo['type']] . $extKey . '/doc/manual.sxw')) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' .
|
||
(tx_em_Tools::typePath($extInfo['type']) && @is_file($fileP) ?
|
||
'<a href="' . htmlspecialchars(t3lib_div::resolveBackPath($this->parentObject->doc->backPath . '../' .
|
||
tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw')) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' .
|
||
t3lib_iconWorks::getSpriteIcon('actions-system-extension-documentation') . '</a>' : '') .
|
||
'</td>';
|
||
... | ... | |
// Implode unique list of extensions to load and return:
|
||
$list = implode(',', array_unique($listArr));
|
||
return $list;
|
||
}
|
||
... | ... | |
* @see removeExtFromList(), addExtToList()
|
||
*/
|
||
function removeRequiredExtFromListArr($listArr) {
|
||
$requiredExtensions = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'], 1);
|
||
foreach ($listArr as $k => $ext) {
|
||
if (in_array($ext, $this->parentObject->requiredExt) || !strcmp($ext, '_CACHEFILE')) {
|
||
if (in_array($ext, $requiredExtensions) || !strcmp($ext, '_CACHEFILE')) {
|
||
unset($listArr[$k]);
|
||
}
|
||
}
|
typo3/sysext/em/classes/install/class.tx_em_install.php (revision ) | ||
---|---|---|
return $content;
|
||
}
|
||
/**
|
||
* Writes the extension list to "localconf.php" file
|
||
* Removes the temp_CACHED* files before return.
|
||
*
|
||
* @param string List of extensions
|
||
* @return void
|
||
*/
|
||
function writeNewExtensionList($newExtList) {
|
||
$strippedExtensionList = $this->stripNonFrontendExtensions($newExtList);
|
||
// Instance of install tool
|
||
$instObj = new t3lib_install;
|
||
$instObj->allowUpdateLocalConf = 1;
|
||
$instObj->updateIdentity = 'TYPO3 Extension Manager';
|
||
// Get lines from localconf file
|
||
$lines = $instObj->writeToLocalconf_control();
|
||
$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
|
||
$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList_FE\']', $strippedExtensionList);
|
||
$instObj->writeToLocalconf_control($lines);
|
||
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
|
||
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extList_FE'] = $strippedExtensionList;
|
||
t3lib_extMgm::removeCacheFiles();
|
||
}
|
||
}
|
||
/**
|
||
* Removes unneeded extensions from the frontend based on
|
||
* EMCONF doNotLoadInFE = 1
|
||
*
|
||
* @param string $extList
|
||
* @return string
|
||
*/
|
||
function stripNonFrontendExtensions($extList) {
|
||
$fullExtList = $this->parentObject->extensionList->getInstalledExtensions();
|
||
$extListArray = t3lib_div::trimExplode(',', $extList);
|
||
foreach ($extListArray as $arrayKey => $extKey) {
|
||
if ($fullExtList[0][$extKey]['EM_CONF']['doNotLoadInFE'] == 1) {
|
||
unset($extListArray[$arrayKey]);
|
||
}
|
||
}
|
||
$nonFEList = implode(',', $extListArray);
|
||
return $nonFEList;
|
||
}
|
||
/**
|
||
* Updates the database according to extension requirements
|
||
* DBAL compliant (based on Install Tool code)
|
||
*
|
||
* @param string Extension key
|
||
* @param array Extension information array
|
||
* @return void
|
||
*/
|
||
function forceDBupdates($extKey, $extInfo) {
|
||
$instObj = new t3lib_install;
|
||
// Updating tables and fields?
|
||
if (is_array($extInfo['files']) && in_array('ext_tables.sql', $extInfo['files'])) {
|
||
$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables.sql');
|
||
$FDfile = $instObj->getFieldDefinitions_fileContent($fileContent);
|
||
if (count($FDfile)) {
|
||
$FDdb = $instObj->getFieldDefinitions_database(TYPO3_db);
|
||
$diff = $instObj->getDatabaseExtra($FDfile, $FDdb);
|
||
$update_statements = $instObj->getUpdateSuggestions($diff);
|
||
foreach ((array) $update_statements['add'] as $string) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($string);
|
||
}
|
||
foreach ((array) $update_statements['change'] as $string) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($string);
|
||
}
|
||
foreach ((array) $update_statements['create_table'] as $string) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($string);
|
||
}
|
||
}
|
||
}
|
||
// Importing static tables?
|
||
if (is_array($extInfo['files']) && in_array('ext_tables_static+adt.sql', $extInfo['files'])) {
|
||
$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables_static+adt.sql');
|
||
$statements = $instObj->getStatementarray($fileContent, 1);
|
||
list($statements_table, $insertCount) = $instObj->getCreateTables($statements, 1);
|
||
// Traverse the tables
|
||
foreach ($statements_table as $table => $query) {
|
||
$GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS ' . $table);
|
||
$GLOBALS['TYPO3_DB']->admin_query($query);
|
||
if ($insertCount[$table]) {
|
||
$statements_insert = $instObj->getTableInsertStatements($statements, $table);
|
||
foreach ($statements_insert as $v) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($v);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
?>
|
typo3/sysext/em/classes/index.php (revision ) | ||
---|---|---|
// temporary unset new modules
|
||
unset ($this->MOD_MENU['function']['extensionmanager'], $this->MOD_MENU['function']['develop']);
|
||
/*
|
||
if (!intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug'])) {
|
||
unset ($this->MOD_MENU['function']['develop']);
|
||
}
|
||
*/
|
||
$this->MOD_MENU['singleDetails'] = $this->mergeExternalItems($this->MCONF['name'], 'singleDetails', $this->MOD_MENU['singleDetails']);
|
||
... | ... | |
* @return void
|
||
*/
|
||
function main() {
|
||
global $BE_USER, $LANG, $TYPO3_CONF_VARS;
|
||
if (empty($this->MOD_SETTINGS['mirrorListURL'])) {
|
||
$this->MOD_SETTINGS['mirrorListURL'] = $TYPO3_CONF_VARS['EXT']['em_mirrorListURL'];
|
||
$this->MOD_SETTINGS['mirrorListURL'] = $GLOBALS['TYPO3_CONF_VARS']['EXT']['em_mirrorListURL'];
|
||
}
|
||
// Starting page:
|
||
... | ... | |
break;
|
||
}
|
||
if ($newExtList != -1) {
|
||
$this->writeNewExtensionList($newExtList);
|
||
$this->refreshGlobalExtList();
|
||
$this->forceDBupdates($extKey, $inst_list[$extKey]);
|
||
$this->install->writeNewExtensionList($newExtList);
|
||
tx_em_Tools::refreshGlobalExtList();
|
||
$this->install->forceDBupdates($extKey, $inst_list[$extKey]);
|
||
return array(true, $GLOBALS['LANG']->getLL('ext_import_ext_loaded'));
|
||
}
|
||
}
|
||
... | ... | |
$this->importExtFromRep($extKey, $version, 'L');
|
||
$newExtList = $this->extensionList->addExtToList($extKey, $inst_list);
|
||
if ($newExtList != -1) {
|
||
$this->writeNewExtensionList($newExtList);
|
||
$this->refreshGlobalExtList();
|
||
$this->forceDBupdates($extKey, $inst_list[$extKey]);
|
||
$this->install->writeNewExtensionList($newExtList);
|
||
tx_em_Tools::refreshGlobalExtList();
|
||
$this->install->forceDBupdates($extKey, $inst_list[$extKey]);
|
||
$this->translations->installTranslationsForExtension($extKey, $this->getMirrorURL());
|
||
return array(true, $GLOBALS['LANG']->getLL('ext_import_ext_imported'));
|
||
} else {
|
||
... | ... | |
}
|
||
}
|
||
function refreshGlobalExtList() {
|
||
global $TYPO3_LOADED_EXT;
|
||
$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
|
||
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
|
||
require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
|
||
}
|
||
return;
|
||
$GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::typo3_loadExtensions();
|
||
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
|
||
require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
|
||
} else {
|
||
$temp_TYPO3_LOADED_EXT = $TYPO3_LOADED_EXT;
|
||
foreach ($temp_TYPO3_LOADED_EXT as $_EXTKEY => $temp_lEDat) {
|
||
if (is_array($temp_lEDat) && $temp_lEDat['ext_localconf.php']) {
|
||
$_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
|
||
require($temp_lEDat['ext_localconf.php']);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* Imports an extensions from the online repository
|
||
* NOTICE: in version 4.0 this changed from "importExtFromRep_old($extRepUid,$loc,$uploadFlag=0,$directInput='',$recentTranslations=0,$incManual=0,$dontDelete=0)"
|
||
... | ... | |
}
|
||
}
|
||
if (!$updates || t3lib_div::_GP('_do_install')) {
|
||
$this->writeNewExtensionList($newExtList);
|
||
$this->install->writeNewExtensionList($newExtList);
|
||
$action = $this->CMD['load'] ? 'installed' : 'removed';
|
||
$GLOBALS['BE_USER']->writelog(5, 1, 0, 0, 'Extension list has been changed, extension %s has been %s', array($extKey, $action));
|
||
... | ... | |
}
|
||
/**
|
||
* Writes the extension list to "localconf.php" file
|
||
* Removes the temp_CACHED* files before return.
|
||
*
|
||
* @param string List of extensions
|
||
* @return void
|
||
*/
|
||
function writeNewExtensionList($newExtList) {
|
||
global $TYPO3_CONF_VARS;
|
||
$strippedExtensionList = $this->stripNonFrontendExtensions($newExtList);
|
||
// Instance of install tool
|
||
$instObj = new t3lib_install;
|
||
$instObj->allowUpdateLocalConf = 1;
|
||
$instObj->updateIdentity = 'TYPO3 Extension Manager';
|
||
// Get lines from localconf file
|
||
$lines = $instObj->writeToLocalconf_control();
|
||
$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
|
||
$instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList_FE\']', $strippedExtensionList);
|
||
$instObj->writeToLocalconf_control($lines);
|
||
$TYPO3_CONF_VARS['EXT']['extList'] = $newExtList;
|
||
$TYPO3_CONF_VARS['EXT']['extList_FE'] = $strippedExtensionList;
|
||
t3lib_extMgm::removeCacheFiles();
|
||
}
|
||
/**
|
||
* Removes unneeded extensions from the frontend based on
|
||
* EMCONF doNotLoadInFE = 1
|
||
*
|
||
* @param string $extList
|
||
* @return string
|
||
*/
|
||
function stripNonFrontendExtensions($extList) {
|
||
$fullExtList = $this->extensionList->getInstalledExtensions();
|
||
$extListArray = t3lib_div::trimExplode(',', $extList);
|
||
foreach ($extListArray as $arrayKey => $extKey) {
|
||
if ($fullExtList[0][$extKey]['EM_CONF']['doNotLoadInFE'] == 1) {
|
||
unset($extListArray[$arrayKey]);
|
||
}
|
||
}
|
||
$nonFEList = implode(',', $extListArray);
|
||
return $nonFEList;
|
||
}
|
||
/**
|
||
* Updates the database according to extension requirements
|
||
* DBAL compliant (based on Install Tool code)
|
||
*
|
||
* @param string Extension key
|
||
* @param array Extension information array
|
||
* @return void
|
||
*/
|
||
function forceDBupdates($extKey, $extInfo) {
|
||
$instObj = new t3lib_install;
|
||
// Updating tables and fields?
|
||
if (is_array($extInfo['files']) && in_array('ext_tables.sql', $extInfo['files'])) {
|
||
$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables.sql');
|
||
$FDfile = $instObj->getFieldDefinitions_fileContent($fileContent);
|
||
if (count($FDfile)) {
|
||
$FDdb = $instObj->getFieldDefinitions_database(TYPO3_db);
|
||
$diff = $instObj->getDatabaseExtra($FDfile, $FDdb);
|
||
$update_statements = $instObj->getUpdateSuggestions($diff);
|
||
foreach ((array) $update_statements['add'] as $string) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($string);
|
||
}
|
||
foreach ((array) $update_statements['change'] as $string) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($string);
|
||
}
|
||
foreach ((array) $update_statements['create_table'] as $string) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($string);
|
||
}
|
||
}
|
||
}
|
||
// Importing static tables?
|
||
if (is_array($extInfo['files']) && in_array('ext_tables_static+adt.sql', $extInfo['files'])) {
|
||
$fileContent = t3lib_div::getUrl(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . 'ext_tables_static+adt.sql');
|
||
$statements = $instObj->getStatementarray($fileContent, 1);
|
||
list($statements_table, $insertCount) = $instObj->getCreateTables($statements, 1);
|
||
// Traverse the tables
|
||
foreach ($statements_table as $table => $query) {
|
||
$GLOBALS['TYPO3_DB']->admin_query('DROP TABLE IF EXISTS ' . $table);
|
||
$GLOBALS['TYPO3_DB']->admin_query($query);
|
||
if ($insertCount[$table]) {
|
||
$statements_insert = $instObj->getTableInsertStatements($statements, $table);
|
||
foreach ($statements_insert as $v) {
|
||
$GLOBALS['TYPO3_DB']->admin_query($v);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
/************************************
|
||
*
|
||
* Various helper functions
|
typo3/sysext/em/classes/connection/class.tx_em_connection_extdirectserver.php (revision ) | ||
---|---|---|
var $xmlhandler;
|
||
/**
|
||
* Class for printing extension lists
|
||
*
|
||
* @var tx_em_Extensions_List
|
||
*/
|
||
public $extensionList;
|
||
/**
|
||
* Class for extension details
|
||
*
|
||
* @var tx_em_Extensions_Details
|
||
*/
|
||
public $extensionDetails;
|
||
/**
|
||
* Keeps instance of settings class.
|
||
*
|
||
* @var tx_em_Settings
|
||
... | ... | |
* @return array status
|
||
*/
|
||
public function uploadExtension($parameter) {
|
||
$uploadedTempFile = t3lib_div::upload_to_tempfile($parameter['extupload-path']['tmp_name']);
|
||
$uploadedTempFile = isset($parameter['extfile']) ? $parameter['extfile'] : t3lib_div::upload_to_tempfile($parameter['extupload-path']['tmp_name']);
|
||
$location = ($parameter['loc'] === 'G' || $parameter['loc'] === 'S') ? $parameter['loc'] : 'L';
|
||
$uploadOverwrite = $parameter['uploadOverwrite'] ? TRUE : FALSE;
|
||
$install = t3lib_div::makeInstance('tx_em_Install', $this);
|
||
$this->extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this);
|
||
$this->extensionDetails = t3lib_div::makeInstance('tx_em_Extensions_Details', $this);
|
||
$upload = $install->uploadExtensionFile($uploadedTempFile, $location, $uploadOverwrite);
|
||
if ($upload[0] === FALSE) {
|
||
... | ... | |
'error' => $upload[1]
|
||
);
|
||
}
|
||
$extKey = $upload[1][0]['extKey'];
|
||
$result = $install->installExtension($upload[1], $location);
|
||
$version = '';
|
||
$dontDelete = TRUE;
|
||
$result = $install->installExtension($upload[1], $location, $version, $uploadedTempFile, $dontDelete);
|
||
return array(
|
||
'success' => TRUE,
|
||
'data' => $result,
|
||
... | ... | |
);
|
||
}
|
||
/**
|
||
* Enables an extension
|
||
*
|
||
* @param $extensionKey
|
||
* @return void
|
||
*/
|
||
public function enableExtension($extensionKey) {
|
||
$this->extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this);
|
||
$install = t3lib_div::makeInstance('tx_em_Install', $this);
|
||
list($installedList,) = $this->extensionList->getInstalledExtensions();
|
||
$newExtensionList = $this->extensionList->addExtToList($extensionKey, $installedList);
|
||
$install->writeNewExtensionList($newExtensionList);
|
||
tx_em_Tools::refreshGlobalExtList();
|
||
$install->forceDBupdates($extensionKey, $newExtensionList[$extensionKey]);
|
||
}
|
||
}
|
||
}
|
||
?>
|