This commit is contained in:
Roman 2022-02-21 15:57:15 +01:00
parent fb0c7a55cf
commit b97b5d9d67

25
cli.php

@ -106,13 +106,13 @@ function handleDatabase(array $argv) {
} else if ($action === "export" || $action === "import") { } else if ($action === "export" || $action === "import") {
// database config // database config
$dbConfig = getDatabaseConfig(); $config = getDatabaseConfig();
$dbType = $dbConfig->getProperty("type") ?? null; $dbType = $config->getProperty("type") ?? null;
$user = $dbConfig->getLogin(); $user = $config->getLogin();
$password = $dbConfig->getPassword(); $password = $config->getPassword();
$database = $dbConfig->getProperty("database"); $database = $config->getProperty("database");
$host = $dbConfig->getHost(); $host = $config->getHost();
$port = $dbConfig->getPort(); $port = $config->getPort();
// subprocess config // subprocess config
$env = []; $env = [];
@ -172,7 +172,7 @@ function handleDatabase(array $argv) {
} }
$command = array_merge([$command_bin], $command_args); $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); $command = array_merge(["docker", "exec", "-it", "db"], $command);
} }
@ -603,15 +603,6 @@ function onMail($argv) {
_exit("Error syncing mails: " . $req->getLastError()); _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."); _exit("Done.");
} else if ($action === "send_queue") { } else if ($action === "send_queue") {
$user = getUser() or die(); $user = getUser() or die();