Skip to content

Commit

Permalink
Merge pull request #106 from Shaswat975/audit-log-deletion
Browse files Browse the repository at this point in the history
Created script in workers to clear old audit logs
  • Loading branch information
hakasapl authored May 29, 2024
2 parents 2dc8b05 + c86ae33 commit dbe4bb4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workers/clear-audit-log.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

require_once "../resources/autoload.php";
require_once "../resources/init.php";

# Days to keep
$days = 30;

$daysAgo = date('Y-m-d', strtotime("-$days days"));

$SQL->getConn()->prepare("DELETE FROM audit_log WHERE timestamp < :daysAgo")->execute(['daysAgo' => $daysAgo]);

0 comments on commit dbe4bb4

Please sign in to comment.