Tasking System?

One of the developers of MyBB has recently hinted at the existence of a feature known as the tasking system. The exact post (which can be found here) says that in MyBB 1.4, sessions will be cleared out of the database on a regular bases via the tasking system. That’s all very well and good, no one wants there forum being slowed down because of an overly bloated database, but what other uses could this tasking system be put to and in the end what use is it to you, the end user? Although we do not have the exact details of this system to show you, with the help of Tikitiki answering some of my questions, we have conjectured up some possible uses and functionality of this system.

Besides the lower level stuff that MyBB itself needs to schedule to keep itself up and running in top condition there is also the possibility the user could give commands to it and have the command execute at a specified time. A little like a cron job. What capabilities would this provide? You could for example make a command that would check for all threads that haven’t had any replies for six or so weeks and then move them into an archive forum. You could then set this to run once at the end of each day or if your forum isn’t very active you could run it once a week.

Plugins might also be able to use the system. Some plugins require total words to be added up to achieve there overall function (be that generating in depth statistics or awarding poodle points). The problem with this is it can take a vast amount of time to recount every word in every post and to force MyBB to do it every time a page is requested is just unacceptable and would lead to monstrous loading times for the user. The simple solution would be to put the recounting command into the task system and let it occur once every day/week automatically.

Of course one limit of PHP is that it requires someone to visit the website and request the pages with a browser before any code will run. This is fine, as if a task is over due to run when a user visits the task will simply run before any content is fed to the user. This will appear as though the task has run on schedule and the user will be none the wiser. However some tasks like the previous example can take an age to complete. To burden this on a user is unacceptable and a better method must be used. Luckily the tasking system will be able to be tied into a cron job on your server. Upon questioning Tikitiki, he said if an external cronjob is run, it would…

call on task.php?tid=x and it will detect it and run it

The cron job will call up task.php and pass via an argument which task to run. Then the PHP takes over and as if a user had triggered it the task executes and the next time a user visits they see the changes.

For all the security freaks out there, Tikitiki also mentioned…

users can’t call on it via a browser and expect it to run without it being within the time frame

You cant expect tasks to run if you call the php page yourself in a browser. It has to be the correct time at which the task is expected to run. If the page is called then simply nothing will happen, cutting down on potential security risks. You make be thinking that any disgruntled users still have a slight window of opportunity as to get the task to do something its not supposed to. If the user can find out the task number and find out when a task is supposed to run then you could potentially have a broken forum on your hands! Not so, Tiki said it better than I can phrase it so once again…

(users) can’t bypass faking it as a cron job because it’ll only work if called via CLI on a cron job.

In conclusion the tasking system looks like it will prove to be an exciting addition to MyBB for both forum admins and plugin developers. Personally I can’t wait to get a hold of source code and see the true extent of what it is capable of. For further information on this feature and other exciting MyBB 1.4 news check back at MyBB Fans for updates. That’s just about everything I have to say about this at the moment except I’ll just mention that this blog post has a lot more fact to it than my last one :P

See you for now, MiNT

Leave a Reply

  • Please login to post a comment so that your comment does not get sent to the moderation queue.
  • Don't have an account? Register for free!