/** * @return void */ public function execute() { $contexts = array('BE', 'FE'); if ($this->getExtensionKey()) { $extensionList = array($this->getExtensionKey()); } else { $extensionList = Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensionsFiltered(); } foreach ($contexts as $context) { if (is_array($GLOBALS['TYPO3_CONF_VARS'][$context]['XCLASS']) && count($GLOBALS['TYPO3_CONF_VARS'][$context]['XCLASS']) > 0) { foreach ($GLOBALS['TYPO3_CONF_VARS'][$context]['XCLASS'] as $targetClass => $implementationClass) { if (is_file($implementationClass)) { $path = str_replace(PATH_typo3conf . 'ext/', '', $implementationClass); $extKey = current(explode('/', $path)); } else { $extKey = t3lib_extMgm::getExtensionKeyByPrefix(strtolower($implementationClass)); } if (!in_array($extKey, $extensionList)) { continue; } $this->issues[] = $this->createIssue($context, $targetClass, $implementationClass, $extKey); } } } }
/** * Get path to ext_icon.gif from processing instruction key * * @param string $key Like tx_realurl_rebuild * @return string */ protected function getExtensionIcon($key) { $extIcon = ''; if (method_exists(t3lib_extMgm, 'getExtensionKeyByPrefix')) { $parts = explode('_', $key); if (is_array($parts) && count($parts) > 2) { $extensionKey = t3lib_extMgm::getExtensionKeyByPrefix('tx_' . $parts[1]); $extIcon = t3lib_extMgm::extRelPath($extensionKey) . 'ext_icon.gif'; } } return $extIcon; }
/** * Try to load the entries for a given class name into the registry. * * First, figures out the extension the class belongs to. * Then, tries to load the ext_autoload.php file inside the extension directory, and adds its contents to the $classNameToFileMapping. * * @param string $className Class Name */ protected static function attemptToLoadRegistryForGivenClassName($className) { $classNameParts = explode('_', $className); $extensionPrefix = array_shift($classNameParts) . '_' . array_shift($classNameParts); $extensionKey = t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix); if (!$extensionKey || array_key_exists($extensionKey, self::$extensionHasAutoloadConfiguration)) { // extension key could not be determined or we already tried to load the extension's autoload configuration return; } $possibleAutoloadConfigurationFileName = t3lib_extMgm::extPath($extensionKey) . 'ext_autoload.php'; if (file_exists($possibleAutoloadConfigurationFileName)) { self::$extensionHasAutoloadConfiguration[$extensionKey] = TRUE; $extensionClassNameToFileMapping = (require $possibleAutoloadConfigurationFileName); self::$classNameToFileMapping = array_merge($extensionClassNameToFileMapping, self::$classNameToFileMapping); } else { self::$extensionHasAutoloadConfiguration[$extensionKey] = FALSE; } }
/** * @test * @see t3lib_extMgm::getExtensionKeyByPrefix */ public function getExtensionKeyByPrefixForNotLoadedExtensionReturnsFalse() { t3lib_extMgm::clearExtensionKeyMap(); $uniqueSuffix = uniqid('test'); $extensionKey = 'unloadedextension' . $uniqueSuffix; $extensionPrefix = 'tx_unloadedextension' . $uniqueSuffix; $this->assertFalse(t3lib_extMgm::getExtensionKeyByPrefix($extensionPrefix)); }