/** * 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); } }
/** * Prints backupdelete * * @param string $parameter * @return string */ public function getExtensionBackupDelete($extKey) { $content = ''; /** @var $extensionList tx_em_Extensions_List*/ $extensionList = t3lib_div::makeInstance('tx_em_Extensions_List', $this); /** @var $extensionDetails tx_em_Extensions_Details */ $extensionDetails = t3lib_div::makeInstance('tx_em_Extensions_Details'); /** @var $extensionDetails tx_em_Connection_Ter */ $terConnection = t3lib_div::makeInstance('tx_em_Connection_Ter', $this); /** @var $extensionDetails tx_em_Install */ $install = t3lib_div::makeInstance('tx_em_Install'); /** @var $api tx_em_API */ $api = t3lib_div::makeInstance('tx_em_API'); list($list, ) = $extensionList->getInstalledExtensions(); $uploadArray = $extensionDetails->makeUploadarray($extKey, $list[$extKey]); if (is_array($uploadArray)) { $backUpData = $terConnection->makeUploadDataFromarray($uploadArray); $filename = 'T3X_' . $extKey . '-' . str_replace('.', '_', $list[$extKey]['EM_CONF']['version']) . '-z-' . date('YmdHi') . '.t3x'; $techInfo = $install->makeDetailedExtensionAnalysis($extKey, $list[$extKey]); $lines = array(); // Backup $lines[] = '<tr class="t3-row-header"><td colspan="2">' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:ext_details_backup') . '</td></tr>'; $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_files') . '</strong></td><td>' . '<a class="t3-link" href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[doBackup]' => 1, 'CMD[showExt]' => $extKey, 'SET[singleDetails]' => 'backup'))) . '">' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_download'), $extKey) . '</a><br /> (' . $filename . ', <br />' . t3lib_div::formatSize(strlen($backUpData)) . ', <br />' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_md5') . ' ' . md5($backUpData) . ') <br /></td></tr>'; if (is_array($techInfo['tables'])) { $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_data_tables') . '</strong></td><td>' . tx_em_Database::dumpDataTablesLine($techInfo['tables'], $extKey, array('SET[singleDetails]' => 'backup')) . '</td></tr>'; } if (is_array($techInfo['static'])) { $lines[] = '<tr class="bgColor4"><td><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extBackup_static_tables') . '</strong></td><td>' . tx_em_Database::dumpDataTablesLine($techInfo['static'], $extKey, array('SET[singleDetails]' => 'backup')) . '</td></tr>'; } // Delete if (!t3lib_extMgm::isLoaded($extKey)) { // check ext scope if (tx_em_Tools::deleteAsType($list[$extKey]['type']) && t3lib_div::inList('G,L', $list[$extKey]['type'])) { $lines[] = '<tr class="t3-row-header"><td colspan="2">' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:ext_details_delete') . '</td></tr>'; $lines[] = '<tr class="bgColor4"><td colspan="2">' . $install->extDelete($extKey, $list[$extKey], '') . '</td></tr>'; } } // EM_CONF $lines[] = '<tr class="t3-row-header"><td colspan="2">' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:ext_details_update_em_conf') . '</td></tr>'; $updateEMConf = $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extUpdateEMCONF_file'); $lines[] = '<tr class="bgColor4"><td colspan="2">' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extUpdateEMCONF_info_changes') . '<br /> ' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extUpdateEMCONF_info_reset') . '<br /><br />' . '<a class="t3-link emconfLink" href="#"><strong>' . $updateEMConf . '</strong> ' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:extDelete_from_location'), $api->typeLabels[$list[$extKey]['type']], substr(tx_em_Tools::getExtPath($extKey, $list[$extKey]['type']['type']), strlen(PATH_site))) . '</a>' . '</td></tr>'; // mod menu for singleDetails $modMenu = $GLOBALS['TBE_MODULES_EXT']['tools_em']['MOD_MENU']['singleDetails']; if (isset($modMenu) && is_array($modMenu)) { $lines[] = '<tr class="t3-row-header"><td colspan="2">' . $GLOBALS['LANG']->sL('LLL:EXT:em/language/locallang.xml:ext_details_externActions') . '</td></tr>'; $menuLinks = ''; foreach ($modMenu as $menuEntry) { $onClick = htmlspecialchars('jumpToUrl(\'mod.php?&id=0&M=tools_em&SET[singleDetails]=' . $menuEntry['name'] . '&CMD[showExt]=' . $extKey . '\');'); $menuLinks .= '<a class="t3-link" href="#" onclick="' . $onClick . '" >' . $GLOBALS['LANG']->sL($menuEntry['title'], TRUE) . '</a><br />'; } $lines[] = '<tr class="bgColor4"><td colspan="2"><p>' . $menuLinks . '</p></td></tr>'; } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $this->replaceLinks($content); } }