目次

Delete Page Guard Plugin

Compatible with DokuWiki

  • 2025-05-14 "Librarian" yes
  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown

plugin Prevent deletion of pages by empty saves when page IDs or file paths match configured regular expressions. Only administrators and optionally exempt groups may delete such pages.

Last updated on
2025-11-02
Provides
Action
Repository
Source

Description

The Delete Page Guard plugin prevents accidental or intentional deletion of wiki pages in your DokuWiki installation by blocking the “empty save” operation when certain pages are protected. A page is considered for protection when its ID or relative file path matches one or more regular expressions configured via the DokuWiki Configuration Manager.

Features

Installation

Install the plugin using the Extension Manager and the download URL above, which points to the latest version. Or download the package manually and extract it into your DokuWiki's lib/plugins/ directory.

After installation, visit the Configuration Manager in your DokuWiki admin panel and adjust the plugin settings under the “Delete Page Guard” section.

Configuration

The following options are available in the Configuration Manager:

Setting Description
Protected page patterns Regular expression patterns to protect pages from deletion. Enter one pattern per line. When a page matches any pattern, only administrators (and optionally configured groups) can delete it via empty save. Invalid patterns are automatically skipped with warnings shown to administrators.
Match against Choose whether the patterns should match against the page ID (e.g. users:john:home) or the relative file path (e.g. users/john/home.txt).
Extra groups allowed to delete Comma separated list of user groups that are allowed to delete protected pages, in addition to administrators. Leave empty to restrict deletion to admins only.
Treat whitespace-only pages as empty If enabled, pages containing only whitespace will be treated as empty and deletion will be blocked on protected pages.

Pattern Examples

Pattern Validation

The plugin includes comprehensive pattern validation:

How It Works

When a page is saved, DokuWiki triggers the COMMON_WIKIPAGE_SAVE event just before writing to disk. For normal edits, the plugin does nothing. However, when the new content is empty (after optional trimming) the plugin checks the configured patterns against the chosen target (ID or file path). If a match occurs and the current user is not an administrator and not in one of the exempt groups, the plugin prevents the deletion and displays an error message.

Development

The plugin includes a comprehensive test suite for developers:

# Run all tests
php tests/test_runner.php
 
# Check syntax of all files
make check
 
# See all available commands
make help

The test suite includes 32 comprehensive tests covering pattern validation, matching logic, security features, and edge cases without requiring a DokuWiki installation.

For maintainers and contributors, see the RELEASE.md file for the complete release workflow.

Compatibility

This plugin has been tested with DokuWiki “Librarian” (2025-05-14b).

It hooks into the COMMON_WIKIPAGE_SAVE event, which was introduced in DokuWiki release “Detritus” (2016-02-24) and is marked as preventable. The plugin uses only stable, public APIs and the documented event system that have been available since “Detritus”, so it should work with most recent DokuWiki versions. Please report any compatibility issues on GitHub.

Changelog

See CHANGELOG.md for detailed release notes.

License

This plugin is released under the GNU General Public License v2.

Support