getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.59k stars 1.41k forks source link

Problem with Cron Backups via Admin Panel: Resulting in Backups every minute #3841

Open chraebsli opened 5 months ago

chraebsli commented 5 months ago

After I added Backup profiles with automated job execution enabled, I got an enormous number of backups today.

Description

Last week, I added automated backups to my existing backup profiles. I did this on my production server directly, since I wanted to see if it worked over the weekend since I had to do some editing to cron execution on the server (managed).

My two backup profiles:

This morning I was a bit confused since I had more than 100 backups. After checking the user/config/backups.yaml file, I noticed that there was a misconfiguration:

Because of that, Grav did a backup every day at 00:00 AND every minute past that hour, resulting in 60 backups per day instead of one.

Resolution

Please fix this issue by adding a minute field or replace the cron field with a text field like in the scheduler. I'd prefer the text field, although I really like how simple the cron field is for not experienced users.
But I could do some fancy stuff like 0 */6 * * * which isn't possible with the cron field and it will render as an error in the admin panel.

chraebsli commented 5 months ago

I just tried and checked if this only was an issue with backups but it seems it is a bigger problem.

All settings in themes, plugins, and configs depending on this cron type field are affected. In my setup, these are the ones:

Every of this and probably more fields saved via admin panel which aren't looked at from the file have this misconfiguration.

pamtbaau commented 5 months ago

It seems to be a problem caused by the jqCron utility in cron-ui.js provided by Admin. The incorrect schedule (missing minute 0) is already incorrect when received by the server.

Since it is an Admin issue and not a server issue, you could use the following workaround:

chraebsli commented 5 months ago

I only rarely use the admin panel for configuration, so for me, it's not a big problem. But I created this issue to let the Grav team & community know that this problem exists.

There surely are users who only work with the admin panel and don't know anything about cron, at latest when it comes to a client who thinks he knows he does.

Since this is an admin issue, could anyone from the Grav team transfer this issue to the admin plugins? Thanks.