DB_TYPE, 'database_name' => DB_NAME, 'server' => DB_SERVER, 'username' => DB_USER, 'password' => DB_PASS, 'charset' => DB_CHARSET ]); } catch (Exception $ex) { echo "Database error: $ex\n"; exit(1); } $reminders = $database->select('reminders', [ 'reminderid (id)', 'noteid', 'when' ], [ 'when[<]' => date("Y-m-d H:i:s", strtotime("now + 15 minutes")) ]); echo "Start sending " . count($reminders) . " reminder notifications...\n"; $deleteids = []; $linelimit = 3; foreach ($reminders as $r) { $note = Note::loadNote($r['noteid']); $lines = explode("\n", $note->getText(), $linelimit); if (count($lines) == $linelimit) { array_pop($lines); $lines[] = $Strings->build("Open {app} to read more", ["app" => SITE_TITLE], false); } $content = implode("\n", $lines); Notifications::add($note->getOwner(), $Strings->get("Note Reminder", false), $content); $deleteids[] = $r['id']; } echo "Sent " . count($reminders) . " notifications.\n"; $deleted = $database->delete('reminders', ['reminderid' => $deleteids]); echo "Outdated reminder cleanup complete: " . $deleted->rowCount() . " records removed.\n";