Mercurial > hg > fapweb
changeset 881:7c805dccd4f7
Work on the tool.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 26 Nov 2014 16:31:40 +0200 |
parents | 6db8ef2bb1b5 |
children | 25bcbd6d5682 |
files | faptool.php |
diffstat | 1 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/faptool.php Wed Nov 26 16:30:49 2014 +0200 +++ b/faptool.php Wed Nov 26 16:31:40 2014 +0200 @@ -52,6 +52,9 @@ " init\n". " Create directories for entries and previews, if needed.\n". "\n". + " previews <cmd> [args]\n". + " Where <cmd> is one of:\n". + " status - List files and show what is missing, etc.\n". "\n"; exit; } @@ -92,6 +95,41 @@ stInitializeDirs(); break; + case "prev": + // + // Preview files handling + // + $mode = substr(stCArgLC(2), 0, 3); + switch ($mode) + { + case "sta": + // List previews that are found and missing + foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL") as $compo) + { + printf( + "\n". + "--[ #%03d - %-30s ]---\n". + "PrevType : %s\n". + "PrevPath : %s\n". + "----------------------------------------------\n", + $compo["id"], $compo["name"], + $previewTypeList[$compo["preview_type"]][0], + stMakePath(FALSE, FALSE, array($setPreviewPath, $compo["cpath"]))); + + foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) + wtHandleEntryPreview($compo, $entry, $mode); + } + break; + + default: + if ($mode == "") + die("ERROR! Previews command requires a sub-command argument.\n"); + else + die("ERROR! Invalid previews sub-command '".stCArg(2)."'.\n"); + break; + } + break; + default: echo "ERROR! Invalid operation mode '".stCArg(1)."'.\n"; break;