This is a Moodle plugin that allows administrators to search and replace strings in the Moodle database.
Administrators can search and replace strings in tables and columns of the Moodle database. They can use simple text search or regular expressions.
The plugin does not store any personal data.
Moodle version | Branch | PHP |
---|---|---|
Moodle 4.1+ | MOODLE_401_STABLE |
7.4+ |
-
Install the plugin the same as any standard Moodle plugin, you can use git to clone it into your source:
git clone git@github.com:catalyst/moodle-tool_advancedreplace.git admin/tool/advancedreplace
Find all occurrences of "http://example.com/" followed by any number of digits on tables:
cd admin/tool/advancedreplace/cli/
php find.php --regex-match="http://example.com/\d+" --output=result.csv
Find all occurrences of "http://example.com/" in a table:
php find.php --regex-match="http://example.com/\d+" --tables=page --output=result.csv
Find all occurrences of "http://example.com/" in multiple tables:
php find.php --regex-match="http://example.com/\d+" --tables=page,forum --output=result.csv
Find all occurrences of "http://example.com/" in different tables and columns:
php find.php --regex-match="http://example.com/\d+" --tables=page:content,forum:message --output=result.csv
Find all occurrences of "http://example.com/" in all tables except the ones specified:
php find.php --regex-match="http://example.com/\d+" --skip-tables=page,forum --output=result.csv
Find all occurrences of "http://example.com/" in all columns except the ones specified:
php find.php --regex-match="http://example.com/\d+" --tables=page --skip-columns=intro,display --output=result.csv