I want to re-save all user accounts on my site weekly because I wrote some code in hook_user_presave()
that I want to update every week.
Specifically, my hook_user_presave()
code updates the values of some fields like Total number of comments posted and Total number of articles posted, and it sends an email if the user hasn't logged in for more than a month. (This info is only available to the site admin, which is me, so it doesn't need to be perfectly in sync.)
Right now, I have a View with VBO that I can use to re-save all the user accounts manually. I want to automate this process by saving all the users automatically at 3 am on Sunday.
How do I schedule all user accounts to be saved? Is this a task for Queue API or does core/contrib provide something more appropriate for this use case?
hook_user_presave()
code (mainly because this includes Flag module flaggings). The fields that are set by the code are only needed to send the email, which won't happen more than once a week, so I want to minimize load on the server by only saving the user accounts (automatically) once a week or so instead of every time.