An admin tool for Moodle. Intended to provide a way to generate reports for columns that may contain base64 encoded data.
- Clone this repository into admin/tool/encoded
- Install the plugins through the moodle GUI
- Configure the plugin
- Configure the size of the files to flag in the report default is 10kb
- Navigate to 'Site admin > Plugins > Admin tools > Base64 Encoder > Generate report'
- Select a table to generate the report
- An option exists to generate reports for every identified table
- The task will be queued and the report will be generated
- A notice will be displayed to inform you that a report will be generated
- No feedback is given currently on the status of the task
- Navigate to 'Site admin > Plugins > Admin tools > Base64 Encoder > Display report'
- You can also navigate to this page from a link in the report generation page
- Any found records will be displayed in a report builder table that can be filtered and sorted
- From this table you can choose to run additional actions (where supported):
- View the problematic record in a text editor
- Queue an attempt to automatically migrate the base64 data to a pluginfile
This tool will detect base64 data in all tables, but at this time view and migrate support has only been implemented for a few specific tables/columns. To add a new table:
- Add mapping to the get_all_mapping function in the helper class. The mapping should include the table name, column name, and the file info that corresponds to where a file uploaded in the GUI would be stored in mdl_files. You can get these values by saving a file in the GUI.
- The view link in the mapping should lead to the page where the text field can be edited in the GUI. This is highly recommended as saving over an item in the GUI will usually convert the base64 data to a pluginfile without requiring a migration (aside from questions where versioning is involved).
- Migrations also require the instance id, which is the id of the context i.e. CONTEXT_COURSE uses course id and CONTEXT_MODULE uses module id. If a module id can be found in the same table you can specify a 'simplejoin' with the field name in the mapping, otherwise specific handling will need to be added to the helper functions in get_instance_id().
This plugin is GDPR-compliant as it only stores the reference to records and does not restore user data.
Issues, and pull requests using github are welcome and encouraged!