public static function run($r) { pts_client::$display->generic_heading('Recently Updated OpenBenchmarking.org Tests'); $recently_updated = array(); foreach (pts_openbenchmarking::linked_repositories() as $repo) { if ($repo == 'local') { // Skip local since it's a fake repository continue; } $repo_index = pts_openbenchmarking::read_repository_index($repo); $changes[$repo] = pts_openbenchmarking_client::fetch_repository_changelog($repo); if (isset($repo_index['tests']) && is_array($repo_index['tests'])) { foreach (array_keys($repo_index['tests']) as $identifier) { if ($repo_index['tests'][$identifier]['last_updated'] > time() - 90 * 86400) { $recently_updated[$repo . '/' . $identifier] = $repo_index['tests'][$identifier]; } } } } if (count($recently_updated) > 0) { // sort by date uasort($recently_updated, array('openbenchmarking_changes', 'compare_time_stamps')); // so that tests are shown from newest to oldest $recently_updated = array_reverse($recently_updated); $longest_identifier_length = array_keys($recently_updated); $longest_identifier_length = strlen(pts_strings::find_longest_string($longest_identifier_length)) + 1; foreach ($recently_updated as $test_profile => $repo_data) { echo sprintf('%-' . $longest_identifier_length . 'ls - %-35ls', $test_profile, $repo_data['title']) . PHP_EOL; $br = explode('/', $test_profile); if (isset($changes[$br[0]]['tests'][$br[1]]['changes'])) { foreach ($changes[$br[0]]['tests'][$br[1]]['changes'] as $test_profile_version => $data) { echo 'v' . $test_profile_version . ' [' . date('d M Y', $data['last_updated']) . ']' . PHP_EOL; echo ' - ' . $data['commit_description'] . PHP_EOL; } } else { echo 'Last Updated: ' . date('d F Y', $repo_data['last_updated']) . PHP_EOL; } echo PHP_EOL; // $repo_data['test_type'] } } else { echo PHP_EOL . 'No updated tests were found.' . PHP_EOL; } }