Upload via GUI (65 Dateien)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
// VirusTotal-Anhangsprüfung: hält Anhänge neuer Tickets und Antworten zurück, bis VirusTotal sie geprüft hat.
|
||||
require_once __DIR__ . '/lib.php';
|
||||
vt_ensure_schema();
|
||||
try {
|
||||
vt_start_id(get_db()); // Startmarke beim ersten Laden setzen: was vorher schon da war, bleibt unberührt (und der erste neue Anhang wird sicher erfasst)
|
||||
} catch (Throwable $e) {
|
||||
error_log('virustotal start: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
foreach (['ticket.created', 'ticket.replied'] as $hook) {
|
||||
plugin_add_hook($hook, function (array $payload) {
|
||||
// Nur zurückhalten, wenn ein Schlüssel eingetragen ist: ohne Schlüssel gäbe es nie ein Ergebnis und die Anhänge blieben für immer gesperrt
|
||||
if (!empty($payload['ticketId']) && vt_config()['key'] !== '') vt_hold_ticket(get_db(), (int) $payload['ticketId']);
|
||||
});
|
||||
}
|
||||
// Abfragen: jede Minute (wenn der Hintergrunddienst es kann), sonst alle 5 Minuten
|
||||
plugin_add_hook('cron.minute', function () {
|
||||
vt_tick(get_db());
|
||||
});
|
||||
plugin_add_hook('cron.run', function () {
|
||||
vt_tick(get_db());
|
||||
});
|
||||
|
||||
plugin_register_menu('VirusTotal', 'virustotal', null, 'admin');
|
||||
Reference in New Issue
Block a user