General plugins (Local): Sandbox

local_sandbox
Maintained by Picture of Ulm University Ulm University, 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.
182 sites
138 downloads
17 fans

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 when 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.

Contributors

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

Comments RSS

Show comments
  • Picture of Bernhard Hiegl
    Mon, 25 May 2015, 8:17 PM
    Hi Alex, do you have plans to update this tool for Moodle 2.9 soon?
  • Picture of Alexander Bias
    Tue, 26 May 2015, 1:21 AM
    Hi Bernhard,

    up to now, we didn't have the time to check our plugins on 2.9 thoroughly. I assume our testing period will start in June.

    Did you test Sandbox on 2.9 and did encounter any problems? If yes, I might be able to have a look at it earlier and provide some quick fix.

    Thanks,
    Alex
  • Picture of Michael Milette
    Tue, 29 Sep 2015, 10:30 PM
    Hi Sebastien,

    > If so, is there a way to have moodle's course backup automatically be stored there?

    Give Moosh a try. It's a command line tool and one of its functions, course-backup, allows you to specify the location where you want the backup file to be saved as well as the file name.

    For more information, see http://moosh-online.com/commands/#course-backup

    Best regards,

    Michael
  • Picture of Jon Bolton
    Wed, 18 Nov 2015, 8:18 PM
    Thanks for this plugin! Is there a way to force the course ID to be the same as my 'original' sandbox course (happy to change code) - two reasons:
    1. my sandbox is hardcoded into menus, so when the course id changes, the link breaks sad
    2. the sandbox will reset every day, so my course ID number is going to increment very rapidly.

    Obviously, the second is not a huge issue, but the first is quite important.

    The course ID seems to in classes/task/restore_courses.php - I tried...

    $newcourseid = $oldcourseid;

    and

    $newcourseid = '19';

    at the start of the // Create new course section, but neither option works.

    Any advice?
  • Picture of Alexander Bias
    Wed, 18 Nov 2015, 8:33 PM
    Jon,

    I can't do anything about 2., that's just how the plugin works at the moment.

    But for 1., you can change your hardcoded link form https://yourmoodle.com/course/view.php?id=1234 to https://yourmoodle.com/course/view.php?name=courseshortname. As the course's shortname will be kept for the resetted course, this link will continue to work. And you don't have to hack the plugin ;)

    Alex
  • Picture of Jon Bolton
    Wed, 18 Nov 2015, 9:00 PM
    Oh yeh, why didn't I think of that! Doh!
    Thanks smile
  • Picture of james aco
    Mon, 28 Mar 2016, 6:40 PM
    Hello,
    Testing the plugin with:
    moodle 3.03.
    v3.0-r2 (2016021000)
    /var/www/clients/client1/web1/private/moodledata/sandbox - (permission: -R 777)
    getting email sandbox notification :
    1 NOTICE: Sandbox has restored 0 courses
    1 WARNING: There is no existing course with shortname "demo_lms", skipping
    file...
    backupfile name - backup-moodle2-course-6-demo_lms-20160328-1326.mbz
    sandbox backup file "demo_lms.mbz"
    what i'm doing wrong?
    Thank you
  • Picture of Alexander Bias
    Tue, 29 Mar 2016, 3:31 AM
    James,

    based on your posted message, local_sandbox is looking for a course which has a shortname called "demo_lms" which it can reset to the state saved in demo_lms.mbz. If such a course does not exist, you can either change the shortname of the course you want to reset to "demo_lms" or you can rename demo_lms.mbz to the shortname of the course you want to reset.

    Alex
  • Picture of Matt Polaniecki
    Wed, 25 May 2016, 3:53 AM
    Is this the plugin that is in effect on demo.moodle.net to reset the course every hour?

    Thanks!
  • Picture of Alexander Bias
    Wed, 25 May 2016, 4:00 AM
    Hi Matt,

    no, it isn't.
  • Picture of Majid Hussain
    Tue, 28 Jun 2016, 11:40 PM
    Hello. I've just installed this plugin on my Moodle 3.1 and have noticed that new courses are being created instead of existing courses being reset. Instead of resetting the existing courses, the plugin seems to be deleting the existing course and creating a new one. I know this because the restored course has a new course ID. Not sure if I have set this up correctly. Any advice will be much appreciated.
  • Picture of Alexander Bias
    Wed, 29 Jun 2016, 2:44 AM
    Hi Abdul,

    you're right, that's just how the plugin works at the moment. This topic has been discussed before in this comment seciton here, please have a look at the other comments - especially from Jon Bolton - if you like.

    Thanks,
    Alex
  • Picture of Majid Hussain
    Thu, 30 Jun 2016, 12:50 AM
    Thanks for the suggestion Alex!
  • Picture of Sanjeet Chand
    Wed, 11 Jan 2017, 1:21 AM
    Hi Alexander,

    This is a nice plugin, I was wondering if it is possible to choose which courses are restored at what time. For example, only restore some courses weekly and some on a monthly basis if it is possible.

    Thank you.
    Sanjeet
  • Picture of Alexander Bias
    Wed, 11 Jan 2017, 4:02 AM
    Hi Sanjeet,

    thanks for your proposal.

    Your proposal is feasible, I would imagine to let the admin add a schedule for every course backup file like he can configure scheduled tasks in Moodle core. However, we don't have any need for this feature at Ulm University and thus don't have resources to implement it.

    If you are a developer or have an experienced developer near you, I would be happy to discuss possible implementations with you on https://github.com/moodleuulm/moodle-local_sandbox/issues and get a pull request from you on https://github.com/moodleuulm/moodle-local_sandbox/pulls.

    Thanks for understanding,
    Alex
1 2 3
Please login to post comments