Your Moodle version

General plugins (Local): Sandbox

Maintained by Picture of Alexander Bias Alexander Bias
Moodle plugin which programatically restores courses to predefined course states. It can be used to provide playground moodle courses which will be cleaned periodically.

After installing local_sandbox, the plugin doesn't do anything until it is configured. To configure the plugin, please visit Plugins -> Local plugins -> Sandbox.

There, you are able to define on which days and when on each day local_sandbox should restore the courses. 

You also define the directory where the course backup files to use for course restoring are. local_sandbox takes every file in this directory with a .mbz filename extension, takes the file's name, searches for a existing course with a shortname equal to the file's name and finally, uses the course backup file to restore / reset this course.

Additionally, there is an option to set the course start date to today instead of setting it to the date saved in the course backup file. Use this option if you need to provide playground courses in Moodle which pretend to be up-to-date.

As local_sandbox acts automatically, it can inform you by mail when failures or problems occur.

See README file for details.


Picture of Alexander Bias
Alexander Bias (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Alexander Bias
    Wed, Feb 13, 2013, 3:22 PM
    Aparup, thanks for the Moodle Hat award smile
  • Picture of German Valero
    Tue, Feb 19, 2013, 1:27 AM
    Hi Alexander,
    I just uploaded the mexican spanish translation of your sandbox add-on to AMOS in
    I think it is a very useful plugin.
  • Picture of Alexander Bias
    Tue, Feb 19, 2013, 3:08 PM
    German, thank you for the translation!
  • Carol walking in the Howgills
    Wed, Dec 11, 2013, 7:46 PM
    Alexander, this looks great. Pardon my ignorance but I can't find any documentation on using the plugin once it's installed. I've installed and configured. Now, where do I and my users go to actually play in our sandbox? thanks!
  • Picture of Alexander Bias
    Thu, Dec 12, 2013, 3:45 PM
    Dear Carol,

    the purpose of the plugin is to programatically restore courses to predefined course states. It does _not_ create any sandbox course after installing, you have to do that yourself.

    Please see the README file ( for details.

    If you have any questions after reading, please let me know.
  • Carol walking in the Howgills
    Mon, Feb 10, 2014, 9:11 PM
    Hi Alexander
    Thanks very much and sorry for not acknowledging your reply - I expected to get an automatic email but must not have correct settings in my profile. The readme file is helpful - and of course it is there in the plugin files, so sorry I failed to find it! I will go play with it now. Thanks.
  • Carol walking in the Howgills
    Thu, Feb 13, 2014, 6:38 PM
    Sorry Alexander, I'm a bit stuck! Sandbox installed and configured, one course backup in moodledata/sandbox and I edited the course after taking the backup but it doesn't restore. Cron log shows:

    Processing customized cron scripts ...Processing cron function for local_sandbox...
    ... started 10:00:13. Current memory use 124.3MB.

    No need for restoring sandbox courses so far, let's wait for next cron run time, exiting...

    Have I missed something else simple?
    Thanks - Carol
  • Picture of Alexander Bias
    Thu, Feb 13, 2014, 7:19 PM
    Dear Carol,

    the message you are citing appears if
    a) the current day is not one of the days you have configured sandbox to run.
    b) the current time is before the time you have configured sandbox to run or if sandbox has already run today.

    So, assuming that you have configured sandbox with correct day and time when it should run, I can think of these problems:
    - You are looking at a manually started cron run output, but there was already a automatic cron run today before your manual start. Please check if the cron run you are looking at is the only cron run on your server.
    - There is something wrong with timezones. Actually, the sandbox settings as well as the sandbox run functions should use the timezone of the admin user. But I can't tell if my code is timezone-bulletproof. Please check if the sandbox works if you are scheduling the cron run some hourse before or after your current local time. If yes, I will try to fix the problem.

    After that, I have no more simple ideas at the moment...

  • Carol walking in the Howgills
    Wed, Feb 26, 2014, 4:40 PM
    HI Alexander
    Again sorry for the delay in my reply and thank you for your assistance. I think the answer may be much simpler - I got an email from my server:
    WARNING: There is no existing course with shortname
    "backup-moodle2-course-90-features_demo-20140210-1315", skipping file...

    I had put the course backup into the sandbox directory without renaming but I think I should have just named it 'shortname.mbz'?
    I will do this now and hopefully not bother you again!
  • Picture of Alexander Bias
    Wed, Feb 26, 2014, 4:54 PM
    I think you are on the right track. That's a reason for the problem which I didn't think of.

Please login to post comments