Lines 401-407
if ($pLogs) {
Link Here
|
401 |
DELETE FROM action_logs |
401 |
DELETE FROM action_logs |
402 |
WHERE timestamp < date_sub(curdate(), INTERVAL ? DAY) |
402 |
WHERE timestamp < date_sub(curdate(), INTERVAL ? DAY) |
403 |
}; |
403 |
}; |
404 |
my @query_params = (); |
404 |
my @query_params = ($pLogs); |
405 |
if (@preserve_logs) { |
405 |
if (@preserve_logs) { |
406 |
$log_query .= " AND module NOT IN (" . join( ',', ('?') x @preserve_logs ) . ")"; |
406 |
$log_query .= " AND module NOT IN (" . join( ',', ('?') x @preserve_logs ) . ")"; |
407 |
push @query_params, @preserve_logs; |
407 |
push @query_params, @preserve_logs; |
Lines 421-436
if ($pLogs) {
Link Here
|
421 |
$sth = $dbh->prepare($log_query); |
421 |
$sth = $dbh->prepare($log_query); |
422 |
if ($confirm) { |
422 |
if ($confirm) { |
423 |
if ($logs_batch) { |
423 |
if ($logs_batch) { |
424 |
my $counter = 0; |
424 |
my $rows_deleted = 0; |
425 |
my $rows = 0; |
425 |
do { |
426 |
while ( $counter <= $rows ) { |
426 |
$sth->execute(@query_params) or die $dbh->errstr; |
427 |
$sth->execute( $pLogs, @query_params ) or die $dbh->errstr; |
427 |
$rows_deleted = $sth->rows; |
428 |
sleep 3; |
428 |
sleep 3; # Adjust sleep time as needed |
429 |
$rows += $sth->rows; |
429 |
} while ( $rows_deleted == $logs_batch ); |
430 |
$counter += $logs_batch; |
|
|
431 |
} |
432 |
} else { |
430 |
} else { |
433 |
$sth->execute( $pLogs, @query_params ) or die $dbh->errstr; |
431 |
$sth->execute(@query_params) or die $dbh->errstr; |
434 |
} |
432 |
} |
435 |
} |
433 |
} |
436 |
print "Done with purging action_logs.\n" if $verbose; |
434 |
print "Done with purging action_logs.\n" if $verbose; |
437 |
- |
|
|