/** * Upload extension to TER * * @formHandler * * @param string $parameter * @return array */ public function uploadExtToTer($parameter) { $repository = $this->getSelectedRepository(); $wsdlURL = $repository['wsdl_url']; $parameter['user']['fe_u'] = $parameter['fe_u']; $parameter['user']['fe_p'] = $parameter['fe_p']; $parameter['upload']['mode'] = $parameter['newversion']; $parameter['upload']['comment'] = $parameter['uploadcomment']; /** @var $extensionList tx_em_Extensions_List */ $extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this); list($list, ) = $extensionList->getInstalledExtensions(); /** @var $extensionDetails tx_em_Extensions_Details */ $this->extensionDetails = t3lib_div::makeInstance('tx_em_Extensions_Details', $this); /** @var $terConnection tx_em_Connection_Ter*/ $terConnection = t3lib_div::makeInstance('tx_em_Connection_Ter', $this); $terConnection->wsdlURL = $wsdlURL; $parameter['extInfo'] = $list[$parameter['extKey']]; $response = $terConnection->uploadToTER($parameter); if (!is_array($response)) { return array('success' => FALSE, 'error' => $response, 'params' => $parameter); } if ($response['resultCode'] == 10504) { //success $parameter['extInfo']['EM_CONF']['version'] = $response['version']; $response['resultMessages'][] = sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:terCommunication_ext_version'), $response['version']); $response['resultMessages'][] = $this->extensionDetails->updateLocalEM_CONF($parameter['extKey'], $parameter['extInfo']); } return array('success' => TRUE, 'params' => $parameter, 'response' => $response); }
/** * Download extension as file / make backup * * @param string Extension key * @param array Extension information array * @return string HTML content */ function extBackup($extKey, $extInfo) { $uArr = $this->extensionDetails->makeUploadarray($extKey, $extInfo); if (is_array($uArr)) { $backUpData = $this->terConnection->makeUploadDataFromarray($uArr); $filename = 'T3X_' . $extKey . '-' . str_replace('.', '_', $extInfo['EM_CONF']['version']) . '-z-' . date('YmdHi') . '.t3x'; if (intval($this->CMD['doBackup']) == 1) { ob_end_clean(); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename); echo $backUpData; exit; } elseif ($this->CMD['dumpTables']) { $filename = 'T3X_' . $extKey; $cTables = count(explode(',', $this->CMD['dumpTables'])); if ($cTables > 1) { $filename .= '-' . $cTables . 'tables'; } else { $filename .= '-' . $this->CMD['dumpTables']; } $filename .= '+adt.sql'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename); echo tx_em_Database::dumpStaticTables($this->CMD['dumpTables']); exit; } else { $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo); $lines = array(); $lines[] = '<tr class="t3-row-header"><td colspan="2">' . $GLOBALS['LANG']->getLL('extBackup_select') . '</td></tr>'; $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->getLL('extBackup_files') . '</strong></td><td>' . '<a class="t3-link" href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[doBackup]' => 1, 'CMD[showExt]' => $extKey))) . '">' . sprintf($GLOBALS['LANG']->getLL('extBackup_download'), $extKey) . '</a><br /> (' . $filename . ', <br />' . t3lib_div::formatSize(strlen($backUpData)) . ', <br />' . $GLOBALS['LANG']->getLL('extBackup_md5') . ' ' . md5($backUpData) . ') <br /></td></tr>'; if (is_array($techInfo['tables'])) { $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->getLL('extBackup_data_tables') . '</strong></td><td>' . tx_em_Database::dumpDataTablesLine($techInfo['tables'], $extKey) . '</td></tr>'; } if (is_array($techInfo['static'])) { $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->getLL('extBackup_static_tables') . '</strong></td><td>' . tx_em_Database::dumpDataTablesLine($techInfo['static'], $extKey) . '</td></tr>'; } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; } } else { throw new RuntimeException('TYPO3 Fatal Error: ' . $GLOBALS['LANG']->getLL('extBackup_unexpected_error'), 1270853981); } }