# HG changeset patch # User Matti Hamalainen # Date 1417102085 -7200 # Node ID 5d53b9d6c319ea1f6646d3c25d40771afb7af29c # Parent 22ca7b1aaff4c5543936339951d0ce4fb88f816e Add 'probe' function to faptool. diff -r 22ca7b1aaff4 -r 5d53b9d6c319 faptool.php --- 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 \n". + " Probe specified file for file information.\n". + "\n". " previews [args]\n". " Where 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)