/** * @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); } } } }
/** * Execute the check * * @return void */ public function execute() { $list = Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensionsFiltered(TRUE, FALSE, TRUE); foreach ($list as $extensionKey) { $locations = Tx_Smoothmigration_Utility_FileLocatorUtility::searchInExtension($extensionKey, '.*[^ext_tables]\\.(php|inc)$', '(addPlugin\\s*\\(\\s*(array\\s*\\([^\\)]*\\)[^\\,]*\\,|\\$[^\\,]*\\,)[^\\)\\,]*\\))'); foreach ($locations as $location) { $this->issues[] = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $location); } } }
/** * @param string $fileNamePattern * @param string $searchPattern * @param array $excludedExtensions * * @return Tx_Smoothmigration_Domain_Interface_IssueLocation[] */ public static function searchInExtensions($fileNamePattern, $searchPattern, $excludedExtensions = array()) { $locations = array(); $loadedExtensions = Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensionsFiltered(); foreach ($loadedExtensions as $extensionKey) { if (in_array($extensionKey, $excludedExtensions)) { continue; } $locations = array_merge(self::searchInExtension($extensionKey, $fileNamePattern, $searchPattern), $locations); } return $locations; }
/** * Display index of actions * * @param string $type * * @return void */ protected function displayActionIndex($type = 'Check') { $this->messageBus->headerMessage('Avaliable ' . $type . 's:', 'info'); $type = strtolower($type); if ($this->availableActions === array()) { $this->availableActions = $this->commandManager->getAvailableCommands(); } $colorizedIdentifierLength = $this->getMaximumIdentifierLength($this->availableActions[$type], TRUE); $identifierLength = $this->getMaximumIdentifierLength($this->availableActions[$type]); $this->messageBus->message(vsprintf(' %-' . $identifierLength . 's %s', array('Identifier', 'Description'))); $this->messageBus->horizontalLine(); /** @var Tx_Smoothmigration_Checks_AbstractCheckDefinition $command */ $counter = 1; foreach ($this->availableActions[$type] as $command) { $this->autoCompleteValues['actions'][] = $command->getIdentifier(); $description = wordwrap($command->getShortDescription(), TERMINAL_WIDTH - $identifierLength - 7, PHP_EOL . str_repeat(' ', $identifierLength + 7), TRUE); $shortCommandIdentifier = $command->getIdentifier(); $this->messageBus->message(vsprintf('%2s) %-' . $colorizedIdentifierLength . 's %s', array($counter, $this->messageBus->successString($shortCommandIdentifier), $description))); $counter++; } $this->messageBus->message(); if ($this->isInInteractiveMode) { $this->messageBus->setCompletions(array('actions' => $this->autoCompleteValues['actions'], 'extensions' => Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensionsFiltered())); $actions = $this->autoCompleteValues['actions'][$type]; $this->messageBus->usage(); $response = $this->messageBus->prompt(); $this->messageBus->message(); list($code, $extension) = explode(' ', $response); if (array_key_exists($code, $actions)) { readline_add_history($response); $method = $type . 'Command'; $this->{$method}($actions[$code], $extension); } elseif (in_array($code, $actions)) { readline_add_history($response); $method = $type . 'Command'; $this->{$method}($code, $extension); } elseif ($code == -1) { $this->interactiveCommand(); } else { $this->messageBus->errorMessage('Uknown comand: ' . $code); $this->interactiveCommand(); } } else { $this->messageBus->message('Usage: ./cli_dispatch.phpsh extbase smoothmigration:' . $type . ' <Identifier> [extensionName]'); } $this->messageBus->message(); }