/usr/share/phoronix-test-suite/pts-core/commands/openbenchmarking_changes.php is in phoronix-test-suite 4.8.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | <?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2011 - 2013, Phoronix Media
Copyright (C) 2011 - 2013, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class openbenchmarking_changes implements pts_option_interface
{
const doc_section = 'OpenBenchmarking.org';
const doc_description = 'This option will list recent changes to test profiles of enabled OpenBenchmarking.org repositories.';
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;
}
}
protected static function compare_time_stamps($a, $b)
{
return $a['last_updated'] < $b['last_updated'] ? -1 : 1;
}
}
?>
|