I am new to PHP OOP. There is a members section, an admin section, and a public section on my website. I want a task to be executed on the website every day. There is no need for the task to be executed when there is no visit. Therefore I am not using a cron job.
I am trying to achieve it by keeping a record of the last time the task was executed. For this, I want to use a method to check if the task timestamp is from today. If not, this method should perform the task and update the timestamp.
Website structure: Both in the members and the admin section, there are separate module files that contain DB connection details. Then there are respective class files that extend the module files and have methods performing CRUD operations on AJAX requests.
My question is, how can I efficiently call the daily task method every time any page from any of the sections (members, admin, or public) is loaded? An ajax call can be made from every page’s JS, but that’s not very elegant.
