Skip to content

wikimedia/mediawiki-extensions-PageNameFormula

Repository files navigation

Table of Contents

PageNameFormula — a MediaWiki extension

PageNameFormula is an extension that provides a page_name_formula that will rename a page based on a formula if any template field within the formula has changed.

The idea comes from Yaron Koren during EMWCon Spring 2017 as a project for the Create Camp day.

I (Mark Hershberger) decided to use the extension as an example for how to build an extension.

Examples

Supppose you have a page with the name Main_Page and it includes {{#page_name_formula:{{Main_Page_Name}}}} in the wikitext of the page.

first save

The first time you save,

  1. the result of the {{Main_Page_Name}} template would be checked,
  2. the current name (Main_Page) and revision number is stored in the page_name_mapping database table, and
  3. if the template resulted in anything but Main_Page, then the page is added to the job queue to be renamed.

renaming job

When a page renaming job is found in the job queue,

  1. the page is renamed using the MovePage class,
  2. the new name (Main_Page) and revision number is stored in the page_name_mapping database table, and
  3. unless otherwise specified, a redirect is left in place, and
  4. any double redirects are fixed, unless [https://www.mediawiki.org/wiki/Manual:$wgFixDoubleRedirects $wgFixDoubleRedirects] is false.

when page renames are made

About

Github mirror of MediaWiki extension PageNameFormula - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published