pluginkollektiv / statify

Statify – statistics plugin for WordPress
https://wordpress.org/plugins/statify/
GNU General Public License v3.0
76 stars 22 forks source link

Adding a possibility to not delete old data #244

Open 2ndkauboy opened 1 year ago

2ndkauboy commented 1 year ago

Currently, there is an option to set the number of days of data to keep. This option value will always be used to delete old data. There is no way to not delete data. The cron doesn't even check if the setting is valid at all.

I'd like to see an option that would enable someone to not have Statify delete data. This could be done by settings the value to something like 0. Or we use a "toggle" to activate/deactivete deletion in general and only then check the numeric value for the actual deletion.

2ndkauboy commented 1 year ago

The UI could be similar to something we have in ASB 3.0: image

florianbrinkmann commented 1 year ago

I like the idea and proposed UI implementation

stklcode commented 1 year ago

The cron doesn't even check if the setting is valid at all.

I'd consider this a minor flaw.

We do sanitize the options during update and only accept numeric values greater than zero:

https://github.com/pluginkollektiv/statify/blob/develop/inc/class-statify-settings.php#L301-L306

But a quick sanity check before executing the deletion statement would definitely make sense.

Or we use a "toggle" to activate/deactivate deletion in general [...]

Think I'd prefer this approach. Just add an "keep infinite" checkbox next to the numeric value for convenience (0, -1 or similar works, too, but not very convenient)

Like this: statify_data_infinite