Extension:DynamicPageList3

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

Release status:Extension status stable

ImplementationTemplate:Extension#type Tag, Parser function
DescriptionTemplate:Extension#description Create lists of other articles based on their category, namespace, title, references or template usage and include contents or arguments of template calls of those articles into your page.
Author(s)Template:Extension#username Alexia E. Smith, Algorithmix, Dangerville, IlyaHaykinson, Theaitetos, Unendlich
Latest versionTemplate:Extension#version 3.1.0 (2017-03-14)
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.6+
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ExampleTemplate:Extension#example DPL:Manual - Gamepedia Help Wiki
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

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

Check usage and version matrix.
Note Note: This is a continuation and fork of DynamicPageList (third-party). It is a fully reworked object oriented code base, significant code and database speed improvements, and is fully backwards compatible with previous versions.

The DynamicPageList3 extension is a reporting tool for MediaWiki, listing category members and intersections with various formats and details. For full documentation, see the manual.

When invoked with a basic set of selection parameters DPL displays a list of pages in one or more categories. Selections may also be based on factors such as author, namespace, date, name pattern, usage of templates, or references to other articles. Output takes a variety of forms, some of which incorporate elements of selected articles.

This extension is invoked with the parser function {{#dpl: .... }} or parser tag <DPL>. A Wikimedia-compatible implementation of certain features can be invoked with <DynamicPageList>.

Complex look ups can result in computationally expensive database queries. However, by default all output is cached for a period of one hour to reduce the need to rerun the query every page load. The DPL:Parameters: Other Parameters manual page contains information on parameters that can be used to disable the cache and allow instant updates.

Manual and Complete Documentation
Documentation at Gamepedia Help Wiki
Source Code
Source code at Github
Bugs and Feature Requests
Issues at Github
Licensing
DynamicPageList3 is released under GNU General Public License, version 2.


Installation[edit]

  • Download, extract and place the file(s) in a directory called DynamicPageList in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'DynamicPageList' );
    
  • If necessary configure as required.
  • 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( 'DynamicPageList' );, you need to use:

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

Configuration[edit]

These are DPL's configuration settings and along with their default values. To change them make sure they are defined before including the extension on the wiki. More configuration information is available on the Source and Installation manual page.

Note: In release 3.0.4 the configuration variable name was changed from $dplSettings to $wgDplSettings. This was to faciliate compatibility with Mediawiki 1.25's extension registration change.

Setting Default Description
$wgDplSettings['allowedNamespaces'] null By default all existing namespaces are used when DPL initializes. Customize this setting with an array of namespace constants to restrict DPL to work only in those namespaces.
$wgDplSettings['allowUnlimitedCategories'] false Set this to true to ignore 'maxCategoryCount' and allow unlimited categories. Please note that large amounts of categories in a query can slow down or crash servers.
$wgDplSettings['allowUnlimitedResults'] false Set this to true to ignore 'maxResultCount' and allow unlimited results. Please note that large result sets may result in slow or failed page loads.
$wgDplSettings['behavingLikeIntersection'] false Set DPL to always behave like Extension:Intersection.
$wgDplSettings['categoryStyleListCutoff'] 6 Maximum number of items in a category list before being cut off.
$wgDplSettings['fixedCategories'] empty array This does something with preventing DPL from "looking" at these categories.
$wgDplSettings['functionalRichness'] 3, 0 if $dplMigrationTesting is set to true Set the level of parameters available to end users.
$wgDplSettings['maxCategoryCount'] 4 Maximum number of categories to allow in queries.
$wgDplSettings['minCategoryCount'] 0 Minimum number of categories to allow in queries.
$wgDplSettings['maxResultCount'] 500 Maximum number of results to return from a query.
$wgDplSettings['recursiveTagParse'] false Do recursive tag parsing on <dpl> parser tags converting tags and functions such as magic words like {{PAGENAME}}. This is similar to the {{#dpl}} parser function call, but may not work exactly the same in all cases.
$wgDplSettings['runFromProtectedPagesOnly'] false Set this to true to allow DPL to run from protected pages only. This is recommend if wiki administrators are having issues with malicious users creating computationally intensive queries.
$wgDplSettings['handleSectionTag'] false Set this to true to have DPL handle <section> tags outside of DPL parser tags.

The global variable $wgNonincludableNamespaces is automatically respected by DPL. It will prevent the contents of the listed namespaces from appearing in DPL's output.

Note: $wgDplSettings['maxResultCount'] is a LIMIT on the SQL query itself. Some DPL query parameters like includematch are applied after the SQL query, however, so results here may easily be misleading.

Functional Richness[edit]

DynamicPageList has many features which are unlocked based on the maximum functional richness level. There are some that can cause high CPU or database load and should be used sparingly.

  • $wgDplSettings['functionalRichness'] = 0 is equivalent to Wikimedia's Wikimedia
  • $wgDplSettings['functionalRichness'] = 1 adds additional formatting parameters
  • $wgDplSettings['functionalRichness'] = 2 adds performance equivalent features for templates and pagelinks
  • $wgDplSettings['functionalRichness'] = 3 allows more-expensive page inclusion features and regular expression queries.
  • $wgDplSettings['functionalRichness'] = 4 permits exotic and potentially dangerous batch update and delete operations; not recommended for public websites. Includes debugging parameters for testing and development.


Usage[edit]

Extended DPL Functionality[edit]

Extended DPL is invoked by using the parser function {{#dpl: .... }}, or the parser extension tag <DPL> .... </DPL>.

See: Manual - General Usage and Invocation Syntax and DPL:Parameters: Criteria for Page Selection

Backwards Compatibility[edit]

Functionality compatible with Wikimedia's DPL extension can be invoked with <DynamicPageList> .... </DynamicPageList>. Further information can be found on the Compatibility manual page.

Usage Philosophy and Overview[edit]

With the assumption there are some articles written about countries those articles will typically have three things in common:

  • They will belong to a common category
  • They will have a similar chapter structure, i.e. they will contain paragraphs named 'Religion' or 'History'
  • They will use a template which is used to present highly structured short data items ('Capital', 'Inhabitants', ..) in a nice way (e.g. as a wikitable)

Generate a Report Based on countries[edit]

If there was a need to assemble a report of what countries practice a certain religion this could be easily done with the category and linksto parameters.

{{#dpl:
category=countries
|linksto=Pastafarianism
}}

With DPL one could:

  • Generate a list of all those articles (or a random sample)
  • Show metadata of the articles (popularity, date of last update, ..)
  • Show one or more chapters of the articles ('transclude' content)
  • Show parameter values which are passed to the common template
  • Order articles appropriately
  • Present the result in a sortable table (e.g.)
  • Generate multiple column output

Which steps are necessary?[edit]

Find the articles you want to list:

  • Select by a logical combination (AND,OR,NOT) of categories
  • Specify a range for the number of categories the article must be assigned to
  • Select by a logical combination (AND,OR,NOT) of namespaces
  • Define a pattern which must match the article's name
  • Name a page to which the article must or must not link
  • Name a template which the article must or must not use
  • Name a text pattern which must occur within external links from a page
  • Exclude or include redirections
  • Restrict your search to stable pages or quality pages ("flagged revisions")
  • Use other criteria for selection like author, date of last change etc.
  • Define regular expressions to match the contents of pages you want to include

Order the result list of articles according to

  • Article Name
  • Article Size
  • Date of last change
  • Last User to Make an Edit

Define attributes you want to see

  • Article Name
  • Article Namespace
  • Article Size
  • Date of Last Change
  • Date of Last Access
  • Last User to Make an Edit

Define contents you want to show

  • Whole Article
  • Contents of Certain Sections (Identified by headings)
  • Text Portions (Defined by special marker tags in the article)
  • Values of template calls
  • Use a custom template to show output

Define the output format

  • Specify header and footer for the default output
  • Use ordered list, unordered list
  • Use tables
  • Format table fields individually by applying templates to their content
  • Use category style listing
  • Truncate title or contents to a certain maximum length
  • Add a link to the article or to one or more of its sections

Considerations[edit]

Performance[edit]

DPL's code execution and database access is typically fast for typical category and article look ups. However, using loose LIKE and REGEXP match parameters and/or requesting large data sets can result in long database access times. Parser time should also be kept in consideration. For example, having the query of image results go into a template that displays them will result in a parser media transform for each one. This can quickly eat up 2MBs of RAM per media transform.

See Also[edit]

Further Reading[edit]

DPL can do much more than we can explain here. A complete manual is available with full parameter documentation.