From b9d0790834a72a77b79d02fded07e4a4863fe744 Mon Sep 17 00:00:00 2001 From: Dendy Date: Thu, 24 Dec 2020 10:26:30 +0100 Subject: [PATCH] "I don't really know" I don't really know but i forgot to add the new file int the previous commit anyway, oops. Just making this to have a stable ground to make another commit tbh --- actions/delete-unused.php | 45 +++++++++++++++++++++++++++++++++++++++ index.php | 3 --- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 actions/delete-unused.php diff --git a/actions/delete-unused.php b/actions/delete-unused.php new file mode 100644 index 0000000..60231ef --- /dev/null +++ b/actions/delete-unused.php @@ -0,0 +1,45 @@ +&1", $count, $return); + + if($return !== 0){ + $message = 'Could not execute deletion command: "' . $count[0] . '"'; + break; + } + + if(intval($count[0]) == 0){ + $output = ""; + exec($tmsu . "delete " . $tag, $output); + + $deleted_tags .= $tag . " "; + } +} + +if($deleted_tags !== "") $message = "Deleted unused tags: (" . $deleted_tags . ")"; + +array_push($_SESSION["msg"], $message); + +if(isset($_GET["_back"])){ + header("Location: " . $_GET["_back"]); +} +else{ + //header("Location: " . $BASE_PATH . "/?msg[0]=" , $message); + header("Location: " . $BASE_PATH . "/");} diff --git a/index.php b/index.php index ea6e073..678f79d 100644 --- a/index.php +++ b/index.php @@ -33,9 +33,6 @@ exec($tmsu . "files -c '" . addcslashes($tag . $exclude_query, '(..)') . "'", $count); echo("(" . $count[0] .") " . $tag .", "); } - - echo("

"); - echo("<"); ?>