Mercurial > hg > fapweb
changeset 925:5d53b9d6c319
Add 'probe' function to faptool.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 27 Nov 2014 17:28:05 +0200 |
parents | 22ca7b1aaff4 |
children | 3bead6333500 |
files | faptool.php |
diffstat | 1 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/faptool.php Thu Nov 27 17:26:21 2014 +0200 +++ b/faptool.php Thu Nov 27 17:28:05 2014 +0200 @@ -344,6 +344,9 @@ " e.g. any other files, like temp files, etc. DANGEROUS IF YOU DO NOT\n". " KNOW WHAT YOU ARE DOING!!!!!\n". "\n". + " probe <filename>\n". + " Probe specified file for file information.\n". + "\n". " previews <cmd> [args]\n". " Where <cmd> is one of:\n". " status - List files and show what is missing, etc.\n". @@ -392,6 +395,31 @@ stInitializeDirs(); break; + case "pro": + { + $filename = stCArg(2); + if ($filename == "") + die("No filename specified.\n"); + + if (($finfo = finfo_open()) === false) + { + stLogError("Internal error. Failed to initialize finfo()."); + return stError("Internal error, failed to probe file."); + } + + $sdata = @finfo_file($finfo, $filename, FILEINFO_NONE); + $smime = @finfo_file($finfo, $filename, FILEINFO_MIME_TYPE); + finfo_close($finfo); + + echo + "Probed: ".$sdata."\n". + "Mime : '".$smime."'\n"; + + if (($finfo = stProbeFileInfo($filename)) !== false) + print_r($finfo); + } + break; + case "cle": $doDelete = (stCArgLC(2) == "delete"); foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL") as $compo)