From b97b5d9d6780952a59730b09a905067755a0a348 Mon Sep 17 00:00:00 2001 From: Roman Date: Mon, 21 Feb 2022 15:57:15 +0100 Subject: [PATCH] Clean Up --- cli.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/cli.php b/cli.php index 8ee3347..23bd7e1 100644 --- a/cli.php +++ b/cli.php @@ -106,13 +106,13 @@ function handleDatabase(array $argv) { } else if ($action === "export" || $action === "import") { // database config - $dbConfig = getDatabaseConfig(); - $dbType = $dbConfig->getProperty("type") ?? null; - $user = $dbConfig->getLogin(); - $password = $dbConfig->getPassword(); - $database = $dbConfig->getProperty("database"); - $host = $dbConfig->getHost(); - $port = $dbConfig->getPort(); + $config = getDatabaseConfig(); + $dbType = $config->getProperty("type") ?? null; + $user = $config->getLogin(); + $password = $config->getPassword(); + $database = $config->getProperty("database"); + $host = $config->getHost(); + $port = $config->getPort(); // subprocess config $env = []; @@ -172,7 +172,7 @@ function handleDatabase(array $argv) { } $command = array_merge([$command_bin], $command_args); - if ($dbConfig->getProperty("isDocker", false)) { + if ($config->getProperty("isDocker", false)) { $command = array_merge(["docker", "exec", "-it", "db"], $command); } @@ -603,15 +603,6 @@ function onMail($argv) { _exit("Error syncing mails: " . $req->getLastError()); } - _exit("Done."); - } else if ($action === "send_news") { - $user = getUser() or die(); - $debug = in_array("debug", $argv); - $req = new \Api\Mail\SendNews($user); - if (!$req->execute(["debug" => $debug])) { - _exit("Error sending news mails: " . $req->getLastError()); - } - _exit("Done."); } else if ($action === "send_queue") { $user = getUser() or die();