Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+11 votes
in Plugins by
edited by
This is a simple plugin that is mostly intended for developers. Basically, Q2A has no support for cron, although it allows its integration. However, configuring a cron process is something the average user does not know how to do. So I thought that, although cron is ireplaceable, a workround could be implemented that would work for most scenarios in which cron is needed.
So suppose you need to perform an action. Let's take, for instance, a table clean up. You could perform a DELETE statement on every request. Or maybe you could implement a counter that would execute the DELETE statement after a given amount of requests, in order to decrease server load.
Well, this plugin does exactly that. It fires an event after a given amount of requests. So all it is needed is to register an event module and make sure it listens to the event the plugin fires. This way, you just need to focus on the actions you need to perform (the DELETE) and how often you want them to be run (every 400 requests).
Additionally, the plugin can fire events on a daily, weekly and monthly basis. These events are, again, generated based on a request, however, they are limited to run only once per time period.
Again, the plugin does not care at all about time. Only about server requests, which may or may not be the same for the actions needed by other plugins.
There are more technical details that should not be overlooked in the GitHub repo: https://github.com/pupi1985/q2a-fake-cron
Q2A version: 1.6+
@q2apro.com I don't fully get your comment. The server will execute the process regardless of the fact that the request belongs to a logged in user or not. It doesn't also matter whether the site is left quickly or not (the server just doesn't know what happens in the client side unless it is notified)

@Scott The plugin was originally thought to handle maintenance tasks, which are focused on site usage, rather than functional requirements. Anyway, it is true that there could be some time dependant (but not strictly time sensitive) scenarios in which that would make sense. For example, if you wanted to show a daily quote and you already have a plugin that fetched the quote and displays it in the site having the quote change more than once a day can be controlled within the plugin itself. However, as you say, if the amount of requests don't hit the minimum in the day the quote change won't be fired. I'll look into this
Thanks... Nice plugin.
Nice try. I will also use CRON in automatic maintenance feature of my DMP.
Virtual CRON of wordpress will help to improvement. However, although you already know, this mechanism is not suitable for heavy synchronization processing. And, there will be required to consider event log plugin. I will cheer your development.
Thanks @sama @Funrunna.

I ended up adding the daily, weekly and monthly execution limits as well. I hope it is more useful this way :)

Please log in or register to answer this question.