Core Update 1.4.0

This commit is contained in:
2022-02-20 16:53:26 +01:00
parent 918244125c
commit bd1f302433
86 changed files with 3301 additions and 41128 deletions

35
cli.php
View File

@@ -590,14 +590,42 @@ function onMail($argv) {
}
_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();
$req = new \Api\Mail\SendQueue($user);
$debug = in_array("debug", $argv);
if (!$req->execute(["debug" => $debug])) {
_exit("Error processing mail queue: " . $req->getLastError());
}
} else {
_exit("Usage: cli.php mail <sync> [options...]");
_exit("Usage: cli.php mail <sync|send_news|send_queue> [options...]");
}
}
function onImpersonate($argv) {
if (count($argv) < 3) {
_exit("Usage: cli.php impersonate <user_id>");
}
$user = getUser() or exit;
$user->createSession(intval($argv[2]));
$session = $user->getSession();
$session->setData(["2faAuthenticated" => true]);
echo "session=" . $session->getCookie() . PHP_EOL;
}
$argv = $_SERVER['argv'];
if (count($argv) < 2) {
_exit("Usage: cli.php <db|routes|settings|maintenance> [options...]");
_exit("Usage: cli.php <db|routes|settings|maintenance|impersonate> [options...]");
}
$command = $argv[1];
@@ -623,6 +651,9 @@ switch ($command) {
case 'settings':
onSettings($argv);
break;
case 'impersonate':
onImpersonate($argv);
break;
default:
printLine("Unknown command '$command'");
printLine();