This commit is contained in:
Javier Casares 2026-03-28 10:06:54 +00:00
commit 5add9b5e84
7 changed files with 372 additions and 21 deletions

View file

@ -86,7 +86,7 @@ class Two_Factor_Extended_Audit_Log {
$logs = $this->get_logs();
$log_entry = array(
'timestamp' => current_time( 'timestamp' ),
'timestamp' => time(),
'action' => sanitize_key( $action ),
'description' => sanitize_text_field( $description ),
'user_id' => $user_id,
@ -302,7 +302,7 @@ class Two_Factor_Extended_Audit_Log {
*/
public function cleanup_old_logs(): void {
$logs = $this->get_logs();
$cutoff_time = current_time( 'timestamp' ) - ( self::RETENTION_DAYS * DAY_IN_SECONDS );
$cutoff_time = time() - ( self::RETENTION_DAYS * DAY_IN_SECONDS );
$filtered_logs = array_filter(
$logs,
@ -429,7 +429,7 @@ class Two_Factor_Extended_Audit_Log {
'recent_count' => 0,
);
$recent_cutoff = current_time( 'timestamp' ) - ( 7 * DAY_IN_SECONDS );
$recent_cutoff = time() - ( 7 * DAY_IN_SECONDS );
foreach ( $logs as $log ) {
$action = isset( $log['action'] ) && is_string( $log['action'] ) ? $log['action'] : '';