Mercurial > hg > fapweb
changeset 1083:1f77195b4f95
Some work on faptool.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 25 Jan 2017 21:44:16 +0200 |
parents | 571ad3639468 |
children | e1cfbfb0b64a |
files | faptool.php |
diffstat | 1 files changed, 30 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/faptool.php Wed Jan 25 12:29:27 2017 +0200 +++ b/faptool.php Wed Jan 25 21:44:16 2017 +0200 @@ -865,25 +865,39 @@ // // File cleanup / deletion // - $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) + $mode = stCArgLC(2, 3); + switch ($mode) { - wtPrintCompoHeader($compo); - wtPrintDivider(); + case "del": + case FALSE: + 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) + { + wtPrintCompoHeader($compo); + wtPrintDivider(); - 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["deleted"] != 0) + foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) { - echo "X"; + foreach (stExecSQL("SELECT * FROM files WHERE entry_id=".$entry["id"]) as $efile) + { + if ($efile["deleted"] != 0) + { + echo "X"; + } + } } + echo "\n"; + wtPrintDivider(); } - } - echo "\n"; - wtPrintDivider(); + break; + + case "cra": + echo "Not implemented. :D\n"; + break; + + default: + die("ERROR! Invalid entry sub-command '".stCArg(2)."'.\n"); + break; } break; @@ -968,7 +982,7 @@ break; default: - if ($mode == "") + if ($mode == FALSE) die("ERROR! Entry command requires a sub-command argument.\n"); else die("ERROR! Invalid entry sub-command '".stCArg(2)."'.\n"); @@ -1016,7 +1030,7 @@ break; default: - if ($mode == "") + if ($mode == FALSE) die("ERROR! Previews command requires a sub-command argument.\n"); else die("ERROR! Invalid previews sub-command '".stCArg(2)."'.\n");