# HG changeset patch # User Matti Hamalainen # Date 1485373456 -7200 # Node ID 1f77195b4f9523e01c43cbaf5bdc9ae623ecf1b7 # Parent 571ad36394682bb300f29720addf1fa9ce23a6e4 Some work on faptool. diff -r 571ad3639468 -r 1f77195b4f95 faptool.php --- 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");