Merge pull request #10414 from appwrite/check-audits

Check audits logs
This commit is contained in:
Jake Barnby 2025-09-02 23:08:49 +12:00 committed by GitHub
commit a63e486d79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -131,21 +131,23 @@ class Audits extends Action
return new NoCommit();
}
try {
foreach ($this->logs as $sequence => $projectLogs) {
$dbForProject = $getProjectDB($projectLogs['project']);
foreach ($this->logs as $sequence => $projectLogs) {
try {
Console::log('Processing Project "' . $sequence . '" batch with ' . count($projectLogs['logs']) . ' events');
Console::log('Processing batch with ' . count($projectLogs['logs']) . ' events');
$projectDocument = $projectLogs['project'];
$dbForProject = $getProjectDB($projectDocument);
$audit = new Audit($dbForProject);
$audit->logBatch($projectLogs['logs']);
Console::success('Audit logs processed successfully');
Console::success('Audit logs processed successfully');
} catch (Throwable $e) {
Console::error('Error processing audit logs for Project "' . $sequence . '": ' . $e->getMessage());
} finally {
unset($this->logs[$sequence]);
}
} catch (Throwable $e) {
Console::error('Error processing audit logs: ' . $e->getMessage());
}
$this->lastTriggeredTime = time();
return new Commit();
}