Sanitize your Moodle production data for testing environments using Data Cleaner plugin #MoodlePlugins

AI in Education Leaderboard Post Page
Ai In Education Square Post Page

--- Advertisement ---

Its a standard practice to have multiple environments in a ‘pipeline’ leading to production at the end in the IT industry and similarly almost all Moodle users may have multiple Moodle environments for testing and development of new features in Moodle.
The developers/testers also need real data to test the new features but there are many downsides for that also like:

  • Usually production can be quite massive, we don’t need or want it all and disk space can be a pain with multiple copies.
  • There may be sensitive data we don’t want to expose to developers or testers, eg personal data, grades, uploaded assignments etc
  • Moodle is integrated with 3rd party systems and we don’t want test systems interacting with real systems, eg sending emails, or touching assignments in Turnitin etc, ie we want to remove any API keys and other related config

To overcome this problem Marcus Boon, Brendan Heywood, Dmitrii Metelkin & Nigel Cunningham came up with a new Moodle plugin – Data Cleaner, which can be used for multiple tasks like:

  • Refresh the Moodle database,
  • Reduce the size of the data
  • Remove anything sensitive

The plugin consists of multiple ‘cleaners’ which process different types of data in moodle. Each one can be enabled individually and may have additional config settings.
Sanitize your Moodle™ production data for testing environments using Data Cleaner plugin #Moodle™Plugins
The plugin also have multiple safeguards to prevent it from accidentally running in the production environment like:

  • It can only be run from the CLI. There is no GUI.
  • We store the hostname in the cleaning configuration data. If the hostname matches production, Data Cleaner will not run. If this data is missing then it will not run.
  • Typically a refreshed database will be from a nightly snapshot and so the data should be slightly stale. If a non admin user has logged in recently, that’s a sign this moodle is being used, and the Data Cleaner will not run.
  • If cron has run recently, Data Cleaner will not run. This should only be run on a data washing instance, cron should not be needed here.
  • It can only be run if and only if a ‘local_datacleaner_allowexecution = true;’ has been added to config.php

You can download the Data Cleaner plugin from the Moodle plugins database here. The plugin comes up with a good documentation along with it which can be referred to find more details about the other configuration options of the plugin.
Please note that this plugin is only meant for Moodle Site Administrators and Developers and should be used on the sandbox sites first before using on production environments. We will not be responsible for any loss arise due to usage of this plugin.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

The Latest

The eLearn Podcast

--- Advertisement ---

Subscribe to our newsletter

Education technology has the power to change lives. 

To get the latest news, information and resources about online learning from around the world by clicking on the button below.