Extension:DynamicPageList3

This page is a translated version of the page Extension:DynamicPageList3 and the translation is 11% complete.
Outdated translations are marked like this.
MediaWiki扩展手册
DynamicPageList3
发行状态: 稳定版
实现 标签 , 解析器函数
描述 创建其他條目的列表,根据其「类别、命名空间、标题、引用」、或「模板使用」和包含内容或这些文章的模板调用的参数。
作者 Universal Omega, Alexia E. Smith, Algorithmix, Dangerville, IlyaHaykinson, Theaitetos, Unendlich~dewiki
最新版本 3.5.2 (2023-01-14)
MediaWiki 1.39.0+
数据库更改
Composer universal-omega/dynamic-page-list3
许可协议 GNU通用公眾授權條款3.0或更新版本
下載
示例 DynamicPageList3 Manual
  • $wgDplSettings
  • dpl_param_update_rules
  • dpl_param_delete_rules
翻译DynamicPageList3扩展
这是Extension:DynamicPageList (第三方) 的延续以及分支。 它是一个完全重新设计的面向对象的代码基底,重大的代码和数据库速度的改进,并完全向后兼容以前的版本。

DynamicPageList3 扩展是一個MediaWiki的回报工具,以各种格式和细节列出类别成员和intersections。 有关完整文档,请参阅[[1]]。

當DPL被一组基本选择参数调用时,会以一个或多个类别显示页面列表。 也可根据作者、命名空间、日期、名称模式、模板使用、或其他文章的引用等因素进行选择。 产出的形式多种多样,其中一些包含了所选文章的内容。

该扩展被解析器函数{{#dpl: .... }}或解析器标记‎<DPL>调用。 维基媒体兼容特定功能的实现可以被‎<DynamicPageList>调用。

复杂的查询会可能会导致计算密集型的数据库查询。 不过,默认情况下,所有输出都会缓存一小时,以减少每次页面加载时重新运行查询的需要。 [[2]]手册页面包含可用于禁用缓存并允许即时更新的参数信息。

Manual and Complete Documentation
DynamicPageList3 manual
Source Code
Source code
Bugs and Feature Requests
Issue and request tracker

配置

These are DPL3's configuration settings, along with their default values.

To change them, ensure they are defined before including the extension on the wiki.

In release 3.0.4, the configuration variable name was changed from $dplSettings to $wgDplSettings. This was to facilitate compatibility with MediaWiki 1.25's extension registration change.
Setting Default Description
$wgDplSettings['allowedNamespaces'] null By default, all existing namespaces are used when DPL3 initializes. Customize this setting with an array of namespace constants to restrict DPL3 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['alwaysCacheResults'] false Set this to true to ignore 'allowcachedresults' and always enable the parser cache.
$wgDplSettings['categoryStyleListCutoff'] 6 Maximum number of items in a category list before being cut off.
$wgDplSettings['functionalRichness'] 3 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 the same in all cases.
$wgDplSettings['runFromProtectedPagesOnly'] false Set this to true to allow DPL3 to run from protected pages only. This is recommended if wiki administrators are having issues with malicious users creating computationally intensive queries.
$wgDplSettings['handleSectionTag'] false Set this to true to have DPL3 handle ‎<section> tags outside of DPL parser tags.
$wgDplSettings['maxQueryTime'] 10000 Maximum allowed time for database queries in milliseconds.
$wgDplSettings['queryCacheTime'] 0 Configure query cache time. The query cache cannot be purged. Suggested value between 30 to 600.

The global variable $wgNonincludableNamespaces is automatically respected by DynamicPageList3.

It will prevent the contents of the listed namespaces from appearing in DynamicPageList3's output.

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

Functional Richness

DynamicPageList3 has many features unlocked based on the maximum functional richness level.

Some can cause high CPU or database load and should be used sparingly.

  • $wgDplSettings['functionalRichness'] = 0 - equivalent to Wikimedia's DynamicPageList (Intersection)
  • $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.


用法

Extended DPL Functionality

DPL扩展被解析器函数{{#dpl: .... }}或解析器扩展标记‎<DPL>...‎</DPL>调用。

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

Backwards Compatibility

Functionality compatible with Wikimedia's DynamicPageList extension can be invoked with ‎<DynamicPageList>...‎</DynamicPageList>.

Further information can be found on the Compatibility manual page.


Usage Philosophy and Overview

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', ..) nicely (e.g., as a wikitable)

Generate a report based on countries

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 DynamicPageList3, 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
  • Generate multiple column output

Which steps are necessary?

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 that 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 the 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 one or more of its sections

Considerations

Performance

DPL3's code execution and database access are typically fast for category and article lookups.

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 taken into 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.

Version 3.4.0 introduces two new configuration options, $wgDplSettings['maxQueryTime'], which allows configuration of the max execution length for queries, in milliseconds, and $wgDplSettings['queryCacheTime'], which allows configuration of the query cache. It also supports PoolCounter to limit query concurrency.

参阅

Further reading

DynamicPageList3 can do much more than we can explain here.

A complete manual is available with full parameter documentation.