Table of Contents

BatchEdit Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" yes
  • 2023-04-04 "Jack Jackrum" yes
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Edit wiki pages using regular expressions

Last updated on
2024-02-12
Provides
Admin
Repository
Source

Tagged with editing, regexp, replace, search

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 Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

User Interface

After installation BatchEdit shows up on the Administration page. When started, the plugin displays a form with four primary edit fields:

Main UI

Below the edit fields there are two buttons:

Match box

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.

Configuration

BatchEdit uses two types of configuration options:

Technical details

Performance

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.

Concurrent page edits

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.

Page lookup

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.

Version History

2024-02-12

2023-06-16

2022-02-20

2021-04-17

2020-07-31

2019-06-02

2018-11-25

2018-08-18

2018-02-11

2017-12-09

2014-05-24

2009-02-14

2008-12-07

2008-10-27

Bugs and Feature Requests

Please report bugs or feature requests at the bug tracker.