/** * Extension action, displays extension report * * @return void */ public function extensionAction() { $values = array(); // FIXME: It's unclear to me how to get this value programmatically // There is a getArgumentPrefix method, but that only applies to widgets $values['argumentPrefix'] = 'tx_smoothmigration_tools_smoothmigrationsmoothmigration'; // List of frontend extensions $loadedExtensions = Tx_Smoothmigration_Utility_ExtensionUtility::getFrontendExtensions(FALSE); $this->view->assign('loadedExtensions', $loadedExtensions); $selectedExtension = ''; if ($this->request->hasArgument('extension')) { $selectedExtension = $this->request->getArgument('extension'); } // List of sites $sites = Tx_Smoothmigration_Utility_DatabaseUtility::getSiteRoots(); $selectSites = array(); foreach ($sites as $siteUid => $siteData) { $selectSites[$siteUid] = $siteUid . ': ' . $siteData['title']; } $values['sites'] = $selectSites; $selectedSite = ''; if ($this->request->hasArgument('site')) { $selectedSite = $this->request->getArgument('site'); $values['selectedSite'] = $selectedSite; } if ($selectedSite && $selectedExtension != 1) { // Get TypoScript configuration for selected site if (count($sites) && $selectedSite) { $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); $tmpl->tt_track = 0; $tmpl->init(); $tmpl->runThroughTemplates(t3lib_BEfunc::BEgetRootLine((int) $selectedSite, 'AND 1=1'), 0); $tmpl->generateConfig(); } // Fetch correct class names $correctClassNames = array(); if ($selectedExtension) { $correctClassNames[$selectedExtension] = t3lib_extMgm::getCN($selectedExtension); } else { $extensionKeys = Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensions(); foreach ($extensionKeys as $key) { $correctClassNames[$key] = t3lib_extMgm::getCN($key); } } $listTypes = array(); $values['plugins'] = array(); // For all the root plugin objects in the plugin array foreach ($tmpl->setup['plugin.'] as $name => $_) { $name = rtrim($name, '.'); // Store the matching extension key with the plugin name foreach ($correctClassNames as $key => $className) { if (strstr($name, $className)) { $values['plugins'][$name] = $key; $suffix = str_replace($className, '', $name); $listTypes[] = $key . $suffix; } } } asort($values['plugins']); $pluginNames = array_keys($values['plugins']); // This catches Powermail which has it's own ctype which it calls powermail_pi1 $values['cTypes'] = array(); foreach ($pluginNames as $name) { array_push($values['cTypes'], str_replace('tx_', '', $name)); } // Fetch list types, initialize with legacy tt_news list_type: 9 $values['listTypes'] = array(); if ($selectedExtension === 'tt_news') { $values['listTypes'] = array('9'); } foreach ($tmpl->setup['tt_content.']['list.']['20.'] as $listType => $_) { if (preg_match('/^[^.]+$/', $listType)) { foreach ($values['plugins'] as $correctedClassName) { if (preg_match('/^' . $correctedClassName . '/', $listType)) { $values['listTypes'][] = $listType; } } } } asort($values['listTypes']); $values['pages'] = array(); if (count($values['listTypes']) || count($values['cTypes'])) { $values['pages'] = Tx_Smoothmigration_Utility_DatabaseUtility::getPagesWithContentElements($values['cTypes'], $values['listTypes']); } $pages = array(); foreach ($values['pages'] as $page) { $this->setInPageArray($pages, t3lib_BEfunc::BEgetRootLine($page['pageUid'], 'AND 1=1'), $page); } $lines = array(); $lines[] = '<tr class="t3-row-header"> <td nowrap>Page title</td> <td nowrap>' . $GLOBALS['LANG']->getLL('isExt') . '</td> </tr>'; $lines = array_merge($lines, $this->renderList($pages)); $values['table'] = '<table border="0" cellpadding="0" cellspacing="1" id="ts-overview">' . implode('', $lines) . '</table>'; } $this->view->assignMultiple($values); $this->view->assign('selectedExtension', $selectedExtension); $this->view->assign('moduleToken', $this->moduleToken); }
/** * Loads all Extension-Versions from ext_emconf files * * @return void */ protected function initializeTypo3ExtensionArray() { $extensionKeys = Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensions(); foreach ($extensionKeys as $extensionKey) { $this->installedTypo3Extensions[$extensionKey] = t3lib_extMgm::getExtensionVersion($extensionKey); } }