Lines 412-418
if ($pLogs) {
Link Here
|
412 |
DELETE FROM action_logs |
412 |
DELETE FROM action_logs |
413 |
WHERE timestamp < date_sub(curdate(), INTERVAL ? DAY) |
413 |
WHERE timestamp < date_sub(curdate(), INTERVAL ? DAY) |
414 |
}; |
414 |
}; |
415 |
my @query_params = (); |
415 |
my @query_params = ($pLogs); |
416 |
if (@preserve_logs) { |
416 |
if (@preserve_logs) { |
417 |
$log_query .= " AND module NOT IN (" . join( ',', ('?') x @preserve_logs ) . ")"; |
417 |
$log_query .= " AND module NOT IN (" . join( ',', ('?') x @preserve_logs ) . ")"; |
418 |
push @query_params, @preserve_logs; |
418 |
push @query_params, @preserve_logs; |
Lines 432-447
if ($pLogs) {
Link Here
|
432 |
$sth = $dbh->prepare($log_query); |
432 |
$sth = $dbh->prepare($log_query); |
433 |
if ($confirm) { |
433 |
if ($confirm) { |
434 |
if ($logs_batch) { |
434 |
if ($logs_batch) { |
435 |
my $counter = 0; |
435 |
my $rows_deleted = 0; |
436 |
my $rows = 0; |
436 |
do { |
437 |
while ( $counter <= $rows ) { |
437 |
$sth->execute(@query_params) or die $dbh->errstr; |
438 |
$sth->execute( $pLogs, @query_params ) or die $dbh->errstr; |
438 |
$rows_deleted = $sth->rows; |
439 |
sleep 3; |
439 |
sleep 3; # Adjust sleep time as needed |
440 |
$rows += $sth->rows; |
440 |
} while ( $rows_deleted == $logs_batch ); |
441 |
$counter += $logs_batch; |
|
|
442 |
} |
443 |
} else { |
441 |
} else { |
444 |
$sth->execute( $pLogs, @query_params ) or die $dbh->errstr; |
442 |
$sth->execute(@query_params) or die $dbh->errstr; |
445 |
} |
443 |
} |
446 |
} |
444 |
} |
447 |
print "Done with purging action_logs.\n" if $verbose; |
445 |
print "Done with purging action_logs.\n" if $verbose; |
448 |
- |
|
|