/** * Execute the check * * @return void */ public function execute() { $regularExpression = $this->generateRegularExpression(); if (trim($regularExpression)) { if ($this->getExtensionKey()) { $locations = Tx_Smoothmigration_Utility_FileLocatorUtility::searchInExtension($this->getExtensionKey(), '.*\\.(php|inc)$', $regularExpression); } else { $locations = Tx_Smoothmigration_Utility_FileLocatorUtility::searchInExtensions('.*\\.(php|inc)$', $regularExpression); } foreach ($locations as $location) { $issue = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $location); $issue->setAdditionalInformation($this->getRepleacabilityReport($location)); $this->issues[] = $issue; } } }
/** * Execute the check * @return void */ public function execute() { $characterSets = $this->getMySqlCharacterSets(); $preferredCharacterSets = array('character_set_connection' => 'utf8', 'character_set_database' => 'utf8', 'character_set_server' => 'utf8'); foreach ($characterSets as $key => $characterSet) { if (array_key_exists($key, $preferredCharacterSets)) { if ($characterSet !== $preferredCharacterSets[$key]) { $physicalLocation = new Tx_Smoothmigration_Domain_Model_IssueLocation_Database(TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db); $details = new Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration(Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration::TYPE_DATABASESERVER, TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db . ': ' . $key, $characterSet, $physicalLocation); $issue = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $details); $issue->setAdditionalInformation(array('type' => 'configuration', 'setting' => $key, 'preferredValue' => $preferredCharacterSets[$key], 'actualValue' => $characterSet)); $this->issues[] = $issue; } } } $dbCharsetCollation = $this->getDatabaseCharsetAndCollation(); $allowedCollations = array('utf8_general_ci', 'utf8_unicode_ci', 'utf8_general_cs', 'utf8_unicode_cs', 'utf8_bin'); $physicalLocation = new Tx_Smoothmigration_Domain_Model_IssueLocation_Database(TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db); if ($dbCharsetCollation['characterSet'] !== 'utf8' or !in_array($dbCharsetCollation['defaultCollation'], $allowedCollations)) { $key = 'databaseCharacterset'; $details = new Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration(Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration::TYPE_DATABASE, TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db . ': ' . $key, $key, $physicalLocation); $issue = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $details); $issue->setAdditionalInformation(array('type' => 'databaseCollation', 'characterSet' => $dbCharsetCollation['characterSet'], 'defaultCollation' => $dbCharsetCollation['defaultCollation'])); $this->issues[] = $issue; } $tableCollations = $this->getTableCollations(); foreach ($tableCollations as $collationInfo) { $key = $collationInfo['table_name'] . '#' . $collationInfo['collation_name']; $physicalLocation = new Tx_Smoothmigration_Domain_Model_IssueLocation_Database(TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db); $details = new Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration(Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration::TYPE_DATABASE, TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db . ': ' . $key, $key, $physicalLocation); $issue = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $details); $issue->setAdditionalInformation(array('type' => 'tableCollation', 'tableName' => $collationInfo['table_name'], 'tableCollation' => $collationInfo['table_collation'])); $this->issues[] = $issue; } $columnCollations = $this->getColumnCollations(); foreach ($columnCollations as $collationInfo) { $key = $collationInfo['table_name'] . '#' . $collationInfo['column_name'] . '#' . $collationInfo['character_set_name'] . '#' . $collationInfo['collation_name']; $physicalLocation = new Tx_Smoothmigration_Domain_Model_IssueLocation_Database(TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db); $details = new Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration(Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration::TYPE_DATABASE, TYPO3_db_username . '@' . TYPO3_db_host . '/' . TYPO3_db . ': ' . $key, $key, $physicalLocation); $issue = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $details); $issue->setAdditionalInformation(array('type' => 'columnCollation', 'tableName' => $collationInfo['table_name'], 'columnName' => $collationInfo['column_name'], 'characterSetName' => $collationInfo['character_set_name'], 'collationName' => $collationInfo['collation_name'])); $this->issues[] = $issue; } }
/** * @param string $context * @param string $targetClass * @param string $implementationClass * @param string $extKey * * @return Tx_Smoothmigration_Domain_Model_Issue */ protected function createIssue($context, $targetClass, $implementationClass, $extKey) { $physicalLocation = new Tx_Smoothmigration_Domain_Model_IssueLocation_File($extKey, 'EXT:' . $extKey . '/ext_localconf.php'); $details = new Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration(Tx_Smoothmigration_Domain_Model_IssueLocation_Configuration::TYPE_PHP, '$GLOBALS[TYPO3_CONF_VARS][' . $context . '][XCLASS][' . $targetClass . ']', $implementationClass, $physicalLocation); // Cut off any possibly leading slash $targetClass = ltrim($targetClass, '/'); if (file_exists(PATH_site . 'typo3conf/' . $targetClass)) { $originalFilePath = PATH_site . 'typo3conf/' . $targetClass; } elseif (file_exists(PATH_site . 'typo3/sys/' . $targetClass)) { $originalFilePath = PATH_site . 'typo3/sys/' . $targetClass; } elseif (file_exists(PATH_site . 'typo3/sysext/cms/' . $targetClass)) { $originalFilePath = PATH_site . 'typo3/sysext/cms/' . $targetClass; } else { $originalFilePath = PATH_site . $targetClass; } $originalClass = $this->getFirstClassInFile($originalFilePath); $xClass = $this->getFirstClassInFile($implementationClass); $issue = new Tx_Smoothmigration_Domain_Model_Issue($this->parentCheck->getIdentifier(), $details); $issue->setAdditionalInformation(array('ORIGINAL_CLASS_FILENAME' => $targetClass, 'IMPLEMENTATION_CLASS_FILENAME' => $implementationClass, 'ORIGINAL_CLASS' => $originalClass, 'IMPLEMENTATION_CLASS' => $xClass)); return $issue; }