Sloodle Cron Job

From SLIS Second Life Wiki

Jump to: navigation, search

Sloodle Versions: 0.3 (?)

[edit] What is a cron job?

A cron job is simply a task which runs on a regular basis on your server. In the case of Moodle, it should regularly run the 'admin/cron.php' script, which will handle various regular tasks, such as emailing notifications and forum posts to course members. You can find out more about setting up your Moodle cron job from the documentation at Moodle.org.


[edit] How does Sloodle use it?

As of Sloodle 0.3, the Moodle cron job will also execute some code in the Sloodle module (as such, if you already have your Moodle cron job setup, then there is nothing else to do). Sloodle primarily uses it to clear out old data, to prevent the database from becoming unnecessarily overcrowded:


  • Purge pending avatar entries -- if an avatar in Second Life attempted to register their avatar with your Moodle site using a registration object in-world, but never finished the process (i.e. never logged-in to Moodle), then their avatar details will be taking up unnecessary space in the database. Entries which are more than 30 minutes old will be removed by the cron job.
  • Purge expired LoginZone allocations -- if a Moodle user attempted to register their avatar with your Moodle site using a course LoginZone, but never completed the process (i.e. never teleported to the location in Second Life), then their allocated position in the LoginZone will be taking up unnecessary space in the database, and will reduce the available locations for other users. Entries which are more than 15 minutes old will be removed by the cron job.
  • Purge unauthorised course/user objects -- if a user begins trying to authorise a Sloodle object for your Moodle site, but does not complete the process, then the object's details will be taking up unecessary space in the database. Entries which are more than 1 hour old will be removed by the cron job. (This applies
  • Purge expired course/user objects -- any authorised object which has not been used or rezzed for a period of time will be automatically deleted by the cron job. This prevents the database getting overcrowded with objects, and reduces any security risk of old objects being maliciously used. The period of time before expiry can be customized by a Moodle administrator in the Sloodle module configuration. (Note: expired objects can easily be re-authorised by anybody with teacher status or higher).
  • Dispatch login notifications -- if an avatar is auto registered on your Moodle site while using some Sloodle object, their automatically-generated login details are temporarily stored until the cron job dispatches them into Second Life via email. This feature is experimental though, and not essential, as the Sloodle Password Reset object can be used to generate a new password for auto-registered users, without relying on the cron job or email system.


[edit] Where is it?

The Sloodle cron function is called "sloodle_cron()", and can be found in the "lib.php" file in the root of the Sloodle module folder. Note: this function cannot be renamed or moved to another file, nor can lib.php itself be moved/renamed, otherwise the Moodle framework will be unable to find it.


This page is part of the Sloodle documentation
SloodleDocs Home | User Documentation | Administrator Documentation | Developer Documentation | Sloodle Wiki Home
Personal tools