Extension:Disambiguator

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Disambiguator

Release status:Extension status stable

ImplementationTemplate:Extension#type Special page
DescriptionTemplate:Extension#description Enables the designation of disambiguation pages with a magic word
Author(s)Template:Extension#username Ryan Kaldari
Latest versionTemplate:Extension#version 1.2
MediaWikiTemplate:Extension#mediawiki 1.21+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license MIT License
Download
Hooks usedTemplate:Extension#hook
GetDoubleUnderscoreIDsManual:Hooks/GetDoubleUnderscoreIDs
wgQueryPagesManual:Hooks/wgQueryPages

Translate the Disambiguator extension if it is available at translatewiki.net

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The Disambiguator extension is designed to make disambiguation pages easier to work with programmatically. It allows you to designate all disambiguation pages with the __DISAMBIG__ magic word (or an equivalent alias), which then marks them as such in the database. This allows other extensions to handle disambiguation pages as a separate class of page.

Installation[edit]

  • Download and place the file(s) in a directory called Disambiguator in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Disambiguator' );
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'Disambiguator' );, you need to use:

require_once "$IP/extensions/Disambiguator/Disambiguator.php";

Features[edit]

Disambiguator provides the following features:

  • Programmatic identification of disambiguation pages via the __DISAMBIG__ magic word
  • New special pages for listing all disambiguation pages and pages linking to disambiguation pages
  • New API functions equivalent to the above special pages as well as an API function for querying whether or not a page is a disambiguation page
  • Modifies Special:LonelyPages to ignore disambiguation pages
  • Modifies Special:Random to ignore disambiguation pages (requires MediaWiki 1.26.0)
  • If VisualEditor is enabled, allows marking a page as a disambiguation page via the page properties interface
  • If VisualEditor is enabled, shows whether a page is a disambiguation page or not in the link inspector
  • If WikiEditor is enabled, shows whether a page is a disambiguation page or not in the link dialog
  • If configured, add a 'mw-disambig' CSS class to links to disambiguation pages (See #Configuration below)

Configuration[edit]

The following configuration variables can be set from your LocalSettings.php file.

  • $wgDisambiguatorIndicateLinks: whether to add a 'mw-disambig' CSS class to links to disambiguation pages (default is true)

Usage[edit]

Once Disambiguator is installed, the best way to use it is to add the __DISAMBIG__ magic word to a template that is then included in all of your disambiguation pages.

Once the magic word is in place, your disambiguation pages will all have the 'disambiguation' page property assigned to them in the database. This property resides in the page_props table.

You will also have two new special pages:

  • Special:DisambiguationPages, which lists all the disambiguation pages on your wiki.
  • Special:DisambiguationPageLinks, which lists all of the pages on your wiki that link to disambiguation pages. (This is a replacement for the old Special:Disambiguations page which is deprecated.)

API usage[edit]

To list all the disambiguation pages:

api.php?action=query&list=querypage&qppage=DisambiguationPages

To list all the disambiguation page links:

api.php?action=query&list=querypage&qppage=DisambiguationPageLinks

Note that on wikis running in MiserMode (all WMF wikis), both the special page and API interface for DisambiguationPageLinks are limited to a certain number of results (typically 1000–5000).

To see if an individual page is a disambiguation page:

api.php?action=query&titles=Bug&prop=pageprops&ppprop=disambiguation

If it is a disambiguation page it will include 'disambiguation' in its pageprops. Note that the disambiguation pageprop, if present, will have its value set to an empty string, so be careful about testing it as a boolean.

Possible future plans[edit]