-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nathan Nguyen
committed
Sep 24, 2024
1 parent
8dbc0cb
commit eef87a9
Showing
1 changed file
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
@@ -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` |