if (isset($params["e"]) && isset($params["e"][DB_COL_STATUS]) && is_array($params["e"][DB_COL_STATUS]) && in_array(STATUS_DUPLICATE, $params["e"][DB_COL_STATUS])) { // Use error ID when displaying duplicates $row[0] = $report[DB_COL_ERRORID]; } $row[] = $report['count']; if (array_key_exists($report[DB_COL_STATUS], $status)) { $row[] = $status[$report[DB_COL_STATUS]]; } if (MULTIPROJECT) { $row[] = $report[DB_COL_PROJECTNAME]; } $row = array_merge($row, explode(ERROR_DELIMITER, $report[DB_COL_ERRORNAME])); $row[] = date(DATE_FORMAT, strtotime($report["firstTime"])); $row[] = date(DATE_FORMAT, strtotime($report["lastTime"])); $row[] = formatVersion($report["firstVersion"], $report[DB_COL_VERSION]); $row[] = formatVersion($report["latestVersion"], $report[DB_COL_VERSION]); $output["rows"][] = $row; } } echo json_encode($output); // INET_NTOA doesn't preserve the number of digits, so try to turn the number into something resembling a user-defined version number function formatVersion($versionNumber, $template) { if ($versionNumber == 0 && !preg_match('/(([0-9]+\\.)*[0-9]+)[A-Za-z]*$/', $template)) { return $template; } $split = explode(".", $template); $version = $versionNumber % 256; for ($i = 1; $i < count($split) || $versionNumber >= 256; ++$i) { $versionNumber = floor($versionNumber / 256); $version = $versionNumber % 256 . "." . $version;
function outputMigrationHeadline(AbstractMigration $migration) { global $lastMigration; if ($migration !== $lastMigration) { outputHeadline('Migration %s (%s)', 1, array($migration->getIdentifier(), formatVersion($migration->getVersionNumber()))); $description = $migration->getDescription(); if ($description !== null) { outputLine($description); outputLine(); } $lastMigration = $migration; } }
} else { define('FLOW_PATH_PACKAGES', FLOW_PATH_ROOT . 'Packages/'); } if (\TYPO3\Flow\Core\Migrations\Git::isGitAvailable() === FALSE) { echo 'No executable git binary found, exiting.'; exit(255); } $migrationsManager = new \TYPO3\Flow\Core\Migrations\Manager(); if (flagIsSet('status')) { $status = $migrationsManager->getStatus(); $output = PHP_EOL . ' == Migration status' . PHP_EOL; foreach ($status as $packageKey => $migrations) { $output .= PHP_EOL . ' == for ' . $packageKey . PHP_EOL; foreach ($migrations as $versionNumber => $migration) { $status = $migration['state'] === \TYPO3\Flow\Core\Migrations\Manager::STATE_MIGRATED ? 'migrated' : 'not migrated'; $output .= ' >> ' . formatVersion($versionNumber) . ' (' . $migration['source'] . ')' . str_repeat(' ', 30 - strlen($status)) . $status . PHP_EOL; } } echo $output; exit(0); } $migrationsManager->migrate(getFlagValue('package-key')); /** * Check if the given flag is in $GLOBALS['argv']. * * @param string $flag * @return boolean */ function flagIsSet($flag) { return in_array('--' . $flag, $GLOBALS['argv']);