BatchEdit is an admin plugin that allows you to use regular expressions to search and replace text on DokuWiki pages. As it works with raw DokuWiki text, the plugin can be also used to modify markup of the pages. This can be very helpful when there are multiple pages with similar markup. For example, you can update pages created from a namespace template if you decide to change the template.
Download and install the plugin using the Plugin Manager using the following URL. Refer to plugins on how to install plugins manually.
After installation BatchEdit shows up on the Administration page.
When started, the plugin displays a form with four edit fields:
Below the edit fields there are two buttons:
BatchEdit displays every match of the search results in a separate box. On top of the box the plugin shows a check box with the page name and a character offset where the match occurred. The check box is used to select matches for the replacement. To the right from the page name there are two icons: the first one links to the page itself and the second one to the editor. The rest of the box is split in two parts: matched text with some context on the left side; and the same fragment with applied replacement on the right. Both the matched text and the replacement are highlighted.
After the replacement, the matches show up with no check box in the caption and replaced text is highlighted with green.
BatchEdit does not rely on any caching to do the search, so every time Preview or Apply button is clicked the DokuWiki server reads all the pages from a hard drive. To reduce the server load and search time use Namespace field that limits the search scope.
While BatchEdit locks pages during replacement, there is still a small possibility for the data corruption. The replacement is performed in two stages:
If the page is modified between these two stages, BatchEdit will apply the replacement to random data in the updated page. Though the chances of such corruption are rather small, the administrators should take care to minimize DokuWiki activity when Batchedit is used.
BatchEdit uses DokuWiki page index to get the list of existing pages instead of going through the data directories. If the index is incomplete the plugin will not see some pages. This also applies to the “special” pages, for example, namespace templates.
Please report bugs or feature requests at the bug tracker.
Added via the plugin manager. Got following error message when trying to load the Admin page:
Parse error: syntax error, unexpected '{' in .../plugins/batchedit/admin.php on line 89
Back-paged and deleted the plugin. Sorry. — Anonymous 2009/03/21
Let me guess: PHP4? — Mykola Ostrovskyy 2009/03/29 12:47
Enter the following in the regexp field
'|'a'
click on Preview and you get this warning:
PHP Warning: preg_match_all() [<a href='function.preg-match-all'>function.preg-match-all</a>]: Unknown modifier 'a' in \lib\plugins\batchedit\admin.php on line 291
— Anonymous 2009/09/25 17:09
First of all it's an invalid regexp. You shouldn't do that
That said, it's, of course, not nice to throw PHP warnings in the face of unsuspecting user. It will be fixed in the next release, thanks for reporting. — Mykola Ostrovskyy 2009/10/01 19:19
first: this is a very usable plugin, thank you, Mykola! when you use this plugin for the first time, consider this:
Would you please be so kind and provide a simple example for both a DokuWiki text and a full set of parameters for your plugin, so that any non-regexpression expert can check if the plugin is properly installed? The given example in the graphics cannot be “typed in” by a rookie user, as it is graphics, and the search string might even be too long so that it is not displayed completely. So a much more simple example “as text” would be great. Rolf Hemmerling 2010/01/02 08:46
Would you please be so kind and tell the rookie users, how to detect if the necessary PHP extension is loaded on his server. (a) by a look at conf/http.conf (b) if http.conf is not accessable. Rolf Hemmerling 2010/01/02 08:46
I believe that if you follow the links in the user interface description you will find enough information about both regexp syntax and the extension (it's a built-in one, no installation needed) — Mykola Ostrovskyy 2010/01/14 08:18