Other parameters: Difference between revisions

Put in an order that actually makes sense, rather than least exotic first that's rarely enabled on any wiki
imported>FrozenPlum
m (Add a category sortkey, so these can be displayed in the correct order on the parameter quick reference page)
imported>FrozenPlum
(Put in an order that actually makes sense, rather than least exotic first that's rarely enabled on any wiki)
Line 2:
{{DPL manual|section=Parameters|subsection=Other parameters}}
{{tocright}}
 
==updaterules==
 
==debug==
{{DPL Parameter
|name = updaterulesdebug
|purpose= Sets debugging level.
|purpose= define a set of rules which are executed to perform an update on selected articles (''bulk update'' or ''template value editing'')
}}
 
Syntax:
 
<code>debug=<i>n</i></code>, where ''n'' is one of:
updaterules=
* ''0'' &mdash; Silent mode, shows nothing
<i>rule</i>;
* ''1'' &mdash; Quiet mode, shows (fatal) errors
...
* ''2'' &mdash; Default mode, like 1 + shows warnings; &mdash; '''(default)'''
<i>rule</i>;
* ''3'' &mdash; Verbose mode, like 2
* ''4'' &mdash; Dump raw SQL Query; only if $wgDebugDumpSql is set to true.
* ''5'' &mdash; Show wiki text output from DPL instead of parsed wiki text.
 
'''If you use debug param but not in first position in the DPL element, the new debug settings are not applied before all previous parameters have been parsed and checked.''' This will generate a warning for <code>debug=2</code> and above.
Where rule is one of the following:
 
Example:
* rules for batch update of articles
replace ''pattern'';
by ''replacement'';
before ''pattern'';
insert ''text'';
after ''pattern'';
insert ''text'';
 
<pre><nowiki>
* rules for interactive update of articles
{{#dpl:
template ''template name'';
| namespace = Media
legend ''legend article name'';
| debug = 0
table ''table format'';
| namespace = Special
editform ''form parameters'';
}}
action ''form action'';
</nowiki></pre>
hidden ''value'';
submit ''submit button'';
commit ''commit button'';
parameter ''parameter name'';
value ''value'';
format ''display format'';
tooltip ''text'';
optional ''value'';
afterparm ''parameter name'';
 
This list will output the error for the first namespace: ''Media'' is not a valid namespace value (pseudo-namespace). Assuming you haven't changed the default debug value (2), you will also get a warning: <code>debug=1</code> is not input first (before <code>namespace=Media</code>). So, it did not apply to <code>namespace=Media</code> but only to what's after. Indeed, you won't get the warning for the second namespace (''Special'') since <code>debug=0</code> changed debug settings to silent mode.
* common rules
summary ''edit summary text'';
exec ''value'';
 
DPL debug messages are translatable in <code>DynamicPageList2.i18n.php</code>.
The first group of rules is intended for batch updates of articles. A DPL query can select a group of articles and perform updates like inserting a piece of text at a certain position or changing text portions based on regular expressions.
 
<code>debug=1</code> will suppress warning messages (e.g., if the result set of a DPL query is empty). As an alternative, you can use the <code>{{DPL|suppresserrors}}=</code> statement.
The second group of rules is intended for interactive form-based editing of template values.
 
The third group of rules is common to both other groups and controls the update process.
 
==allowcachedresults==
The <code>updaterules</code> feature is intended for wiki expert users only. It is recommended that articles using this statement are 'protected':
{{DPL Parameter
|name = allowcachedresults
|purpose= Cache query results to improve performance, keep servers from crashing under high load.
}}
 
Syntax:
===Rules for batch update in detail:===
====replace ''pattern'';====
Defines a regular expression which matches text portions that shall be replaced. It is in the responsibility of the user to provide enclosing characters for the regexp; modifiers line 'U' or 'm' can be used.
 
<code>allowcachedresults=<i>true | false</i></code>
====by ''replacement'';====
Defines the replacement for the above pattern; back references like \1 can be used.
 
Explanation:
====before ''pattern'';====
Defines locations where text will be inserted. The location(s) will be immediately before the match(es) of the pattern. If a pattern matches multiple times, multiple inserts will be performed.
 
Default: true
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
All queries are cached by default to reduce server load, as generally articles do not change often enough to require updating every page load. If immediate updates are required every page load, then set this parameter to false. The cache period is handled by the [[#cacheperiod]] parameter.
 
====after ''pattern'';====
Defines locations where text will be inserted. The location(s) will be immediately after the match(es) of the pattern. If a pattern matches multiple times, multiple inserts will be performed.
 
==cacheperiod==
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
 
====insert ''text'';====
Defines the text to be inserted.
 
A DPL statement may contain replacement, insertion before and after at the same time.
replace /([a-z]+])-cat/;
by \1-dog;
before foo;
insert bar;
after foo;
insert bar2;
 
Only one 'replace'-'by' sequence, one insertion 'before' and one insertion 'after' can be specified. 'replace' is always executed first, followed by 'insert before' and 'insert after', regardless of the sequence in which the rules appear in the DPL source ´text.
 
===Rules for interactive update in detail:===
====template ''template name'';====
The name of the template; the prefix "Template:" must be given.
 
be inserted. The location(s) will be immediately before the match(es) of the pattern. If a pattern matches multiple times, multiple inserts will be performed.
 
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
 
a regular expression
after ''pattern'';
insert ''text'';
replace ''pattern'';
by ''replacement'';
 
For safety reasons, the update statements will only be performed if "exec yes" is specified. So, leaving this away, you can check what would happen if the update were to be executed.
 
Note that if "exec yes" is present, the update will be performed each time the page is rendered which contains the DPL statement with the <code>updaterules</code>. So it is advisable to set "exec yes" only via a command line argument and not as part of the static article text. Thus, you stay in control when the update happens. Typically, one would use a URL parameter like ''DPL_arg1'' for that purpose.
 
The size of the form fields will dapt to the size of the displayed content.
 
<!--To make the use of the <code>updaterules</code> feature easier, we provide a [[Template:Bulk Update|special user interface]].
Note: This template is deliberately not present, as it can apparently alter lots of wiki content. The line above is retained as a comment, since it was part of the original DPL documentation. -->
 
''text'' is plain text; ''replacement'' is text which may contain references (like \1) to the matching ''pattern'' (provided that this pattern contains match groups).
 
==deleterules==
{{DPL Parameter
|name = deleterulescacheperiod
|purpose= allowdefine the massexpiration deletionperiod offor wikithe pagesdplcache
}}
 
Syntax:
deleterules=
reason <i>text</i>;
exec true;
 
<code>cacheperiod=<i>number of seconds</i></code>
This command is experimental at the moment.
 
The default is 3600 seconds which is one hour.
 
This will delete the selected pages; If "exec true" is missing, nothing will happen.
 
==goal==
Line 148 ⟶ 94:
Due to some limitations in MySQL, it is currently not possible to restrict the intermediate result set of pages to a certain maximum (using the LIMIT clause). In addition, the generated SQL code is not in all cases optimal (as its structure provides for complex selection criteria and therefore is unnecessarily complex in simple cases). So be careful and apply precise selection criteria.
 
 
==allowcachedresults==
==eliminate==
{{DPL Parameter
|name = allowcachedresultseliminate
|purpose= Cachesuppress query resultsreferences to improvepages, performancetemplates, keep servers fromimages, crashingcategories underin highDPL load.output
}}
 
Syntax:
 
<code>allowcachedresultseliminate=<i>true | false</i>keyword,..</code>
 
Where <code>keyword</code> is one of:
Explanation:
 
* <code>categories</code>
* <code>templates</code>
* <code>images</code>
* <code>links</code>
* <code>all</code> &mdash; a synonym for all of the above
 
The output of a DPL statement typically creates links to all pages which are part of the result set. The inclusion of contents from other pages via DPL (using {{DPL|include}}) normally has these consequences:
* the page containing the DPL query becomes part of the categories of the transcluded page
* shares ('adopts') their use of templates
* shares their references to images
* shares their references to other articles
 
In some cases, this may be useful. But in many cases, this is not wanted. Especially when you use DPL to create a printable document which contains the full text of other articles, you will probably not want to duplicate all links, template uses etc., of those articles.
 
The <code>eliminate</code> parameter will suppress all or some of the effects described above.
 
For further explanation, see {{DPL|reset}}.
 
Please note that the use of <code>eliminate</code> needs a considerable amount of extra computing power as it performs a second parser step for each included document.
 
Default: true
All queries are cached by default to reduce server load, as generally articles do not change often enough to require updating every page load. If immediate updates are required every page load, then set this parameter to false. The cache period is handled by the [[#cacheperiod]] parameter.
 
==reset==
Line 219 ⟶ 184:
 
If you have '''more than one DPL query''' in a document the effects will depend on the exact mode (parser extension or parser function mode), on the sequence of the statements and on the presence of 'reset' or 'eliminate' statements in each of the queries and on their individual arguments. As this is a very rare case, we only give a simple rule of thumb here: Once you have used 'reset' in parser function mode or 'reset=links' in parser extension mode, the effect of these statements will dominate the rest.
 
 
==fixcategory==
Line 236 ⟶ 202:
The <code>fixcategory</code> allows you to make a category assignment which is not blocked by the {{DPL|reset}} command.
 
==eliminate==
{{DPL Parameter
|name = eliminate
|purpose= suppress references to pages, templates, images, categories in DPL output
}}
 
Syntax:
 
<code>eliminate=keyword,..</code>
 
Where <code>keyword</code> is one of:
 
* <code>categories</code>
* <code>templates</code>
* <code>images</code>
* <code>links</code>
* <code>all</code> &mdash; a synonym for all of the above
 
The output of a DPL statement typically creates links to all pages which are part of the result set. The inclusion of contents from other pages via DPL (using {{DPL|include}}) normally has these consequences:
* the page containing the DPL query becomes part of the categories of the transcluded page
* shares ('adopts') their use of templates
* shares their references to images
* shares their references to other articles
 
In some cases, this may be useful. But in many cases, this is not wanted. Especially when you use DPL to create a printable document which contains the full text of other articles, you will probably not want to duplicate all links, template uses etc., of those articles.
 
The <code>eliminate</code> parameter will suppress all or some of the effects described above.
 
For further explanation, see {{DPL|reset}}.
 
Please note that the use of <code>eliminate</code> needs a considerable amount of extra computing power as it performs a second parser step for each included document.
 
==debug==
{{DPL Parameter
|name = debug
|purpose= Sets debugging level.
}}
 
Syntax:
 
<code>debug=<i>n</i></code>, where ''n'' is one of:
* ''0'' &mdash; Silent mode, shows nothing
* ''1'' &mdash; Quiet mode, shows (fatal) errors
* ''2'' &mdash; Default mode, like 1 + shows warnings; &mdash; '''(default)'''
* ''3'' &mdash; Verbose mode, like 2
* ''4'' &mdash; Dump raw SQL Query; only if $wgDebugDumpSql is set to true.
* ''5'' &mdash; Show wiki text output from DPL instead of parsed wiki text.
 
'''If you use debug param but not in first position in the DPL element, the new debug settings are not applied before all previous parameters have been parsed and checked.''' This will generate a warning for <code>debug=2</code> and above.
 
Example:
 
<pre><nowiki>
{{#dpl:
| namespace = Media
| debug = 0
| namespace = Special
}}
</nowiki></pre>
 
This list will output the error for the first namespace: ''Media'' is not a valid namespace value (pseudo-namespace). Assuming you haven't changed the default debug value (2), you will also get a warning: <code>debug=1</code> is not input first (before <code>namespace=Media</code>). So, it did not apply to <code>namespace=Media</code> but only to what's after. Indeed, you won't get the warning for the second namespace (''Special'') since <code>debug=0</code> changed debug settings to silent mode.
 
DPL debug messages are translatable in <code>DynamicPageList2.i18n.php</code>.
 
<code>debug=1</code> will suppress warning messages (e.g., if the result set of a DPL query is empty). As an alternative, you can use the {{DPL|suppresserrors}} statement.
 
==execandexit==
Line 340 ⟶ 241:
Note <code>execandexit</code> acts like a short-circuit evaluation. This means, for example, that successive statements to influence caching behaviour (like {{DPL|allowcachedresults}}) will not be interpreted.
 
 
==cacheperiod==
==updaterules==
{{DPL Parameter
|name = cacheperiodupdaterules
|purpose= define a set of rules which are executed to perform an update on selected articles (''bulk update'' or ''template value editing'')
|purpose= define the expiration period for the dplcache
{{note|'''Important:''' The <code>updaterules</code> feature is intended for wiki expert users only. It is recommended that articles using this statement are '[[mw:Help:Protecting and unprotecting pages|protected]]'.|error}}
}}
 
Syntax:
 
updaterules=
<code>cacheperiod=<i>number of seconds</i></code>
<i>rule</i>;
...
<i>rule</i>;
 
Where rule is one of the following:
The default is 3600 seconds which is one hour.
 
# '''Rules for batch update of articles'''
#* A DPL query can select a group of articles and perform updates, like inserting a piece of text at a certain position, or changing text portions based on regular expressions.
 
replace ''pattern'';
by ''replacement'';
before ''pattern'';
insert ''text'';
after ''pattern'';
insert ''text'';
<ol>
<li value="2">'''Rules for interactive update of articles'''</li>
</ol>
:* For interactive form-based editing of template values.
template ''template name'';
legend ''legend article name'';
table ''table format'';
editform ''form parameters'';
action ''form action'';
hidden ''value'';
submit ''submit button'';
commit ''commit button'';
parameter ''parameter name'';
value ''value'';
format ''display format'';
tooltip ''text'';
optional ''value'';
afterparm ''parameter name'';
 
<ol>
<li value="3">'''Common rules'''</li>
</ol>
:* Common to both other groups (batch update or interactive update of articles) and controls the update process.
summary ''edit summary text'';
exec ''value'';
 
{{note|'''Important:''' The <code>updaterules</code> feature is intended for wiki expert users only. It is recommended that articles using this statement are '[[mw:Help:Protecting and unprotecting pages|protected]]'.|error}}
 
 
===Rules for batch update in detail:===
====replace ''pattern'';====
Defines a regular expression which matches text portions that shall be replaced. It is in the responsibility of the user to provide enclosing characters for the regexp; modifiers line 'U' or 'm' can be used.
 
 
====by ''replacement'';====
Defines the replacement for the above pattern; back references like \1 can be used.
 
 
====before ''pattern'';====
Defines locations where text will be inserted. The location(s) will be immediately before the match(es) of the pattern. If a pattern matches multiple times, multiple inserts will be performed.
 
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
 
 
====after ''pattern'';====
Defines locations where text will be inserted. The location(s) will be immediately after the match(es) of the pattern. If a pattern matches multiple times, multiple inserts will be performed.
 
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
 
 
====insert ''text'';====
Defines the text to be inserted.
 
A DPL statement may contain replacement, insertion before and after at the same time.
replace /([a-z]+])-cat/;
by \1-dog;
before foo;
insert bar;
after foo;
insert bar2;
 
Only one 'replace'-'by' sequence, one insertion 'before' and one insertion 'after' can be specified. 'replace' is always executed first, followed by 'insert before' and 'insert after', regardless of the sequence in which the rules appear in the DPL source ´text.
 
 
===Rules for interactive update in detail:===
====template ''template name'';====
The name of the template; the prefix "Template:" must be given.
 
be inserted. The location(s) will be immediately before the match(es) of the pattern. If a pattern matches multiple times, multiple inserts will be performed.
 
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
 
a regular expression
after ''pattern'';
insert ''text'';
replace ''pattern'';
by ''replacement'';
 
For safety reasons, the update statements will only be performed if "exec yes" is specified. So, leaving this away, you can check what would happen if the update were to be executed.
 
Note that if "exec yes" is present, the update will be performed each time the page is rendered which contains the DPL statement with the <code>updaterules</code>. So it is advisable to set "exec yes" only via a command line argument and not as part of the static article text. Thus, you stay in control when the update happens. Typically, one would use a URL parameter like ''DPL_arg1'' for that purpose.
 
The size of the form fields will dapt to the size of the displayed content.
 
<!--To make the use of the <code>updaterules</code> feature easier, we provide a [[Template:Bulk Update|special user interface]].
Note: This template is deliberately not present, as it can apparently alter lots of wiki content. The line above is retained as a comment, since it was part of the original DPL documentation. -->
 
''text'' is plain text; ''replacement'' is text which may contain references (like \1) to the matching ''pattern'' (provided that this pattern contains match groups).
 
 
==deleterules==
{{DPL Parameter
|name = deleterules
|purpose= allow the mass deletion of wiki pages
}}
 
deleterules=
reason <i>text</i>;
exec true;
 
This command is experimental at the moment.
 
This will delete the selected pages; If "exec true" is missing, nothing will happen.
 
[[Category:Primary Module|05]]
Anonymous user