Upload via GUI (396 Dateien)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
// Direkter Web-Zugriff wird geblockt (nur CLI oder Einbindung aus dem Backend/Pseudo-Cron).
|
||||
if (php_sapi_name() !== 'cli' && !defined('DESKHUB_CRON_RUNNER')) { http_response_code(403); exit('Kein Web-Zugriff.'); }
|
||||
/**
|
||||
* cron/send_scheduled_replies.php
|
||||
*
|
||||
* Sendet zeitversetzt geplante Antworten, sobald ihr Zeitpunkt erreicht ist. Läuft jede Minute, z. B. per Cronjob:
|
||||
* * * * * * /usr/bin/php /pfad/zu/deskhub/cron/send_scheduled_replies.php
|
||||
*/
|
||||
require_once __DIR__ . '/../includes/bootstrap.php';
|
||||
|
||||
/** @return array{sent:int, failed:int, log:string[]} */
|
||||
function run_send_scheduled_replies(PDO $pdo, bool $verbose = false): array
|
||||
{
|
||||
$r = scheduled_replies_run_due($pdo);
|
||||
set_setting('cron_send_scheduled_replies_last_run', db_now());
|
||||
return $r + ['log' => ['[' . date('Y-m-d H:i:s') . "] Geplante Antworten: {$r['sent']} gesendet, {$r['failed']} fehlgeschlagen."]];
|
||||
}
|
||||
|
||||
if (php_sapi_name() === 'cli' && realpath($_SERVER['SCRIPT_FILENAME'] ?? '') === __FILE__) {
|
||||
foreach (run_send_scheduled_replies(get_db(), true)['log'] as $line) echo $line . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user