Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Nguyen committed Sep 24, 2024
1 parent 8dbc0cb commit eef87a9
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<a href="https://github.com/catalyst/moodle-tool_advancedreplace/actions/workflows/ci.yml?query=branch%3AMOODLE_401_STABLE">
<img src="https://github.com/catalyst/moodle-tool_advancedreplace/workflows/ci/badge.svg?branch=MOODLE_401_STABLE">
</a>


# moodle-tool_advancedreplace

This is a Moodle plugin that allows administrators to search and replace strings in the Moodle database.
Expand All @@ -8,18 +13,38 @@ They can use simple text search or regular expressions.
## GDPR
The plugin does not store any personal data.

## Branches

| Moodle version | Branch | PHP |
|-------------------|--------------------|-----------|
| Moodle 4.1+ | `main` | 7.4+ |

## Installation

1. Install the plugin the same as any standard Moodle plugin, you can use
git to clone it into your source:

```sh
git clone [email protected]:catalyst/moodle-tool_advancedreplace.git admin/tool/advancedreplace

## Examples
- Find all occurrences of "http://example.com/" followed by any number of digits on tables:

`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+"`
`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+" --output=/tmp/result.csv`
- Find all occurrences of "http://example.com/" on a table:

`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/" --tables=page`
`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+" --tables=page --output=/tmp/result.csv`

- Find all occurrences of "http://example.com/" on multiple tables:

`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/" --tables=page,forum`
`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+" --tables=page,forum --output=/tmp/result.csv`

- Find all occurrences of "http://example.com/" on different tables and columns:

`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+" --tables=page:content,forum:message --output=/tmp/result.csv`
- Find all occurrences of "http://example.com/" on all tables except the ones specified:

- Replace all occurrences of "http://example.com/" on different tables and columns:
`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+" --skip-tables=page,forum --output=/tmp/result.csv`
- Find all occurrences of "http://example.com/" on all columns except the ones specified:

`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/" --tables=page:content,forum:message`
`php admin/tool/advancedreplace/cli/find.php --regex-match="http://example.com/\d+" --tables=page --skip-columns=intro,display --output=/tmp/result.csv`

0 comments on commit eef87a9

Please sign in to comment.