pts-core: Add dump-file-info helper

This commit is contained in:
Michael Larabel
2017-05-19 16:01:38 -05:00
parent 45259478a4
commit 3465b95292
2 changed files with 51 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ PHORONIX TEST SUITE CHANGE-LOG
Phoronix Test Suite (Git)
pts-core: Add dump-file-info helper
phodevi: Fallback for being able to read I/O scheduler on NVMe device on Linux
phodevi: Monitor *DEBUG* environment variables
pts_Graph: Key alignment spacing fix

View File

@@ -0,0 +1,50 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2017, Phoronix Media
Copyright (C) 2017, 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 dump_file_info implements pts_option_interface
{
public static function run($r)
{
pts_client::$display->generic_heading('File Information');
if(empty($r))
{
echo PHP_EOL . 'No files passed.' . PHP_EOL;
}
foreach($r as $f)
{
if(!is_file($f))
{
echo PHP_EOL . 'Not a file: ' . $f . PHP_EOL;
}
else
{
echo PHP_EOL . 'FILE: ' . basename($f) . PHP_EOL;
echo 'MD5: ' . md5_file($f) . PHP_EOL;
echo 'SHA256: ' . hash_file('sha256', $f) . PHP_EOL;
echo 'SIZE: ' . filesize($f) . PHP_EOL;
}
}
}
}
?>