Learn about DokuWiki
Learn about DokuWiki
Compatible with DokuWiki
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.
After installation BatchEdit shows up on the Administration page. When started, the plugin displays a form with four primary edit fields:
Below the edit fields there are two buttons:
BatchEdit displays search matches in separate boxes, which are grouped per page. Next to the page identifier and on every match box there is a check box, which is used to mark matches for replacement. In order to prevent unexpected results the check box is unchecked by default requiring the user to confirm every replacement. The match 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 uses two types of configuration options:
BatchEdit performs caching of the search results to avoid repeating the search when replacement is applied. Yet on every preview attempt 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 or limit the number of search results in Advanced options.
Because of two-staged approach of Preview&Apply, there is a possibility that while one user verifies and marks matches for replacement some other user modifies one of the involved pages. To prevent any data corruption BatchEdit locks pages during replacement and verifies that matched text is still located at the match offset. If any of the marked matches cannot be found at expected offsets, replacement for that page is rejected.
This verification still leaves a possibility that replacement will be applied to a different instance of the original text that happened to be at the exactly right offset after the edit, but likelihood of that is rather small. Anyway, it's recommended that administrators 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. Because of the missing or incomplete index BatchEdit may show less search results than expected. This is often the case for a freshly migrated wiki. You can use Searchindex Manager plugin to get the index up to date.
This limitation also applies to the “special” pages (e.g. namespace templates), which are not listed in the index and therefore cannot be edited by BatchEdit.
Please report bugs or feature requests at the bug tracker.