Rules
Automate MediaWiki page categorization based on rules

On this page
External links
Rules for MediaWiki
Automate MediaWiki page categorization based on rules defined via a user-friendly configuration interface.
Define rules to categorize pages based on the categories they already contain. Combine conjunctions (AND) and disjunctions (OR) as needed.
For example, place all pages that are in the ISO 27001 category AND in the Policy category AND in the "Doc Status - Final" category into the ISO 27001 category, omitting any policies not yet marked as final. Or create a DACH Customers category with all pages that are in the Customers category AND in at least one of Germany, Austria, OR Switzerland.

The first version of the extension only supports categorization based on categories. Future versions might contain additional types of conditions and actions.
Professional Wiki created Rules. We are MediaWiki developers that provide professional MediaWiki services.
Usage Documentation
Define rules via the MediaWiki:Rules
page. You can find a link to this page on Special:SpecialPages
.
Only users with the interface-admin
right can edit the rules. On standard MediaWiki, users in the sysop
group have this right.

Edits to rules are visible in the page version history and can thus be audited or reverted.
Automatic categorization does not change the wikitext content of pages and is applied on page save. Regular wiki users thus do not have to do anything. Categories added by rules are removed as soon as their conditions are no longer met.
After defining new rules, you might wish to automatically apply them to all pages. To do this, you must run the
refreshLinks.php
script. This
can only be done with someone who has command-line access to the wiki. Typical command:
php maintenance/run.php refreshLinks
While the rules are shown and edited via a user-friendly user-interface, they are stored in the page as JSON. You can directly edit the JSON at your own risk, which is particularly useful when copying rules between wikis or AI-generating your initial rules based on documentation. The JSON is validated against the Rules JSON Schema.
Installation
Requirements
- PHP 8.1 or later
- MediaWiki 1.43 or later
Load and enable
Load the extension using Composer:
COMPOSER=composer.local.json composer require --no-update professional-wiki/rules:~1.0
Enable the extension by adding the following to your LocalSettings.php:
wfLoadExtension( 'Rules' );
You can verify the installation by checking your wiki's Special:Version page.
Configuration
Rules does not have any customizability via PHP configuration.
More MediaWiki Extensions
Professional MediaWiki Services
MediaWiki services by the authors of Rules

Get superior results from the best MediaWiki developers with a proven track record of creating MediaWiki extensions & integrations.

Make your wiki look great! Use a time-tested responsive MediaWiki theme, or have us create a custom MediaWiki skin for you.

Let us take care of your wiki. We are MediaWiki hosting experts and provide cloud hosting, dedicated hosting, and on-premise hosting.

Bring your wiki to the next level by leveraging our MediaWiki expertise. From strategic planning to wikitext, we have you covered.

Migrate your wiki with confidence. We move your MediaWiki to a new home, or we help you migrate from another system to MediaWiki.

Keep your MediaWiki up-to-date and secure. We offer MediaWiki maintenance services to keep your wiki running smoothly.