Mercurial > hg > fapweb
changeset 901:dfa1277786c1
Some more work on faptool.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 27 Nov 2014 08:27:58 +0200 |
parents | b147f99934f6 |
children | 5d7e525b0eb5 |
files | faptool.php |
diffstat | 1 files changed, 79 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/faptool.php Thu Nov 27 08:18:54 2014 +0200 +++ b/faptool.php Thu Nov 27 08:27:58 2014 +0200 @@ -293,9 +293,19 @@ " init\n". " Create directories for entries and previews, if needed.\n". "\n". + " clean [delete]\n". + " Clean files marked to be deleted. This includes any old\n". + " or stale preview files and entry files.\n" + " Without 'delete' parameter just checks and shows what would\n". + " be deleted, but with it ACTUALLY DELETES THE FILES, SO BE CAREFUL!\n". + "\n". " previews <cmd> [args]\n". " Where <cmd> is one of:\n". " status - List files and show what is missing, etc.\n". + "\n". + " entry <cmd> [args]\n". + " status - List entries for all compos.\n". + " unpack - Create subdirs and unpack archives under them.\n". "\n"; exit; } @@ -337,6 +347,72 @@ stInitializeDirs(); break; + case "cle": + $doDelete = (stCArgLC(2) == "delete"); + foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL") as $compo) + if (stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]) > 0) + { + printf( + "==%'=-".($setWidth-2)."s\n". + sprintf("[ #%03d - %s ]", $compo["id"], substr($compo["name"], 0, 40)) + ); + echo str_repeat("-", $setWidth)."\n"; + + foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) + { + foreach (stExecSQL("SELECT * FROM files WHERE entry_id=".$entry["id"]) as $efile) + { + if ($efile["delete"] != 0) + { + echo "X"; + } + } + } + echo "\n"; + echo str_repeat("-", $setWidth)."\n"; + } + break; + + case "ent": + // + // Entry files handling + // + $mode = substr(stCArgLC(2), 0, 3); + switch ($mode) + { + case "unp": + case "sta": + foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL") as $compo) + if (stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]) > 0) + { + printf( + "==%'=-".($setWidth-2)."s\n". + sprintf("[ #%03d - %s ]", $compo["id"], substr($compo["name"], 0, 40)) + ); + echo str_repeat("-", $setWidth)."\n"; + + foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) + wtHandleEntry($compo, $entry, $mode); + + echo str_repeat("-", $setWidth)."\n"; + } + break; + + case "pac": + break; + + case "add": + break; + + default: + if ($mode == "") + die("ERROR! Entry command requires a sub-command argument.\n"); + else + die("ERROR! Invalid entry sub-command '".stCArg(2)."'.\n"); + break; + } + break; + case "pre": // // Preview files handling @@ -367,6 +443,9 @@ } break; + case "add": + break; + default: if ($mode == "") die("ERROR! Previews command requires a sub-command argument.\n");