You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However on one of our client websites the database tables have more than 9 million entries (2 million rows in wp_simple_history and 7 million in wp_simple_history_contexts) and it's taking 2 GB of space in SQL. And we only started to use your plugin 6 months ago.
I can see there is a note like "Items in the database are automatically removed after 60 days." in Settings -> Simple History, but it doesn't seem to work.
So I checked that and found that 256M of PHP memory is not enough and it fails on these lines in inc/SimpleHistory.php:
// Get id of rows to delete
$sql = $wpdb->prepare(
"SELECT id FROM $table_name WHERE DATE_ADD(date, INTERVAL %d DAY) < now()",
$days
);
$ids_to_delete = $wpdb->get_col( $sql );
So I set a limit for that query to 100,000 rows and let it run in loop until all the old logs are purged. For really big tables it might time out eventually, but then the next cron run will take care of that.
Could you please check our pull request here? #142
Thanks,
Martin
The text was updated successfully, but these errors were encountered:
Thanks Martin! I will add this to the next update.
Usually when the log grows big it's because of a lot of failed login attempts because of brute force attacks. Do you know if this was the case for you - or was it something else that was logged a really lot of times?
Hello bonny,
we like your plugin a lot!
However on one of our client websites the database tables have more than 9 million entries (2 million rows in wp_simple_history and 7 million in wp_simple_history_contexts) and it's taking 2 GB of space in SQL. And we only started to use your plugin 6 months ago.
I can see there is a note like "Items in the database are automatically removed after 60 days." in Settings -> Simple History, but it doesn't seem to work.
So I checked that and found that 256M of PHP memory is not enough and it fails on these lines in inc/SimpleHistory.php:
So I set a limit for that query to 100,000 rows and let it run in loop until all the old logs are purged. For really big tables it might time out eventually, but then the next cron run will take care of that.
Could you please check our pull request here? #142
Thanks,
Martin
The text was updated successfully, but these errors were encountered: