Fixed MaintenanceinfoApi

This commit is contained in:
Frank Schubert
2025-08-04 12:03:07 +02:00
parent 3718ceefdf
commit 6cc7080ee5
3 changed files with 8 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ class MaintenanceinfoApicontroller extends mfBaseApicontroller {
protected function getCurrentMaintenance() { protected function getCurrentMaintenance() {
$results = []; $results = [];
foreach(\MaintenanceNotification::searchActive([]) as $notification) { foreach(\MaintenanceNotification::searchOpen([]) as $notification) {
$item = []; $item = [];
$from = new DateTime("@".$notification->from); $from = new DateTime("@".$notification->from);

View File

@@ -355,7 +355,12 @@ class MaintenanceNotification extends mfBaseModel {
return 0; return 0;
} }
public static function searchActive($filter, $limit = false, $order = false) { public static function searchOpen($filter = [], $limit = false, $order = false) {
$filter["to>"] = date("U");
return self::search($filter, $limit, $order);
}
public static function searchActiveOpen($filter = [], $limit = false, $order = false) {
$filter["to>"] = date("U"); $filter["to>"] = date("U");
$filter["sent"] = false; $filter["sent"] = false;

View File

@@ -16,6 +16,6 @@ define("INTERNAL_USER_ID", $me->id);
define("INTERNAL_USER_USERNAME", $me->username); define("INTERNAL_USER_USERNAME", $me->username);
define("MFBASE_BYPASS_LOGIN", true); define("MFBASE_BYPASS_LOGIN", true);
foreach(MaintenanceNotification::searchActive(["send_ts<" => date("U")]) as $notification) { foreach(MaintenanceNotification::searchActiveOpen() as $notification) {
$notification->sendToRecipients(); $notification->sendToRecipients();
} }