Other parameters: Difference between revisions

Content added Content deleted
imported>FrozenPlum
(Some minor fixes)
imported>FrozenPlum
m (Fix a couple more things I couldn't see on first edit)
Line 9: Line 9:
}}
}}



Syntax:
'''Syntax:'''


<code>debug=<i>n</i></code>, where ''n'' is one of:
<code>debug=<i>n</i></code>, where ''n'' is one of:
Line 18: Line 19:
* <code>''4''</code> &mdash; Dump raw SQL Query; only if ''$wgDebugDumpSql'' is set to true.
* <code>''4''</code> &mdash; Dump raw SQL Query; only if ''$wgDebugDumpSql'' is set to true.
* <code>''5''</code> &mdash; Show wiki text output from DPL instead of parsed wiki text.
* <code>''5''</code> &mdash; Show wiki text output from DPL instead of parsed wiki text.



'''If debug param is used, 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.
'''If debug param is used, 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:
'''Example:'''


<pre><nowiki>
<pre><nowiki>
Line 43: Line 46:
|purpose= Cache query results to improve performance, keep servers from crashing under high load.
|purpose= Cache query results to improve performance, keep servers from crashing under high load.
}}
}}



'''Syntax:'''
'''Syntax:'''


<code>allowcachedresults=''value''</code> where ''value'' is one of:
<code>allowcachedresults=''value''</code> where ''value'' is one of:

* <code>''true''</code> &mdash; ('''default''', need not be set)
* <code>''true''</code> &mdash; ('''default''', need not be set)
* <code>''false''</code>
* <code>''false''</code>



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.
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.
Line 59: Line 63:
|purpose= Define the expiration period for the dplcache
|purpose= Define the expiration period for the dplcache
}}
}}



'''Syntax:'''
'''Syntax:'''
Line 70: Line 75:
|purpose= Set the overall goal for DPL to either show '''pages''' (default) or '''categories''' these pages belong to
|purpose= Set the overall goal for DPL to either show '''pages''' (default) or '''categories''' these pages belong to
}}
}}



'''Syntax:'''
'''Syntax:'''
Line 79: Line 85:


DPL produces a list of pages by default, and this is precisely what the name DPL promises.
DPL produces a list of pages by default, and this is precisely what the name DPL promises.



If the goal parameter is set to 'categories' the list of pages is still be produced, but is not seen. Instead, it is be used to '''calculate a unique ordered list of all categories these pages belong to'''.
If the goal parameter is set to 'categories' the list of pages is still be produced, but is not seen. Instead, it is be used to '''calculate a unique ordered list of all categories these pages belong to'''.



This allows the asking of question like: Given all pages that are a member of category X with a title matching "y%" and which use template "Z": to which categories do these pages belong?
This allows the asking of question like: Given all pages that are a member of category X with a title matching "y%" and which use template "Z": to which categories do these pages belong?



One of the more useful applications would be a question like: "To which categories do the pages belong which contain a reference to the current page?"
One of the more useful applications would be a question like: "To which categories do the pages belong which contain a reference to the current page?"



The output of "goal=categories" is technically a ''list of pages of type category''. This means that all DPL formatting options can be used (mode=userformat, listseparators, columns etc.) and pseudo variables (<code>%TITLE%</code>, <code>%PAGE%</code>) to customize the layout of the report.
The output of "goal=categories" is technically a ''list of pages of type category''. This means that all DPL formatting options can be used (mode=userformat, listseparators, columns etc.) and pseudo variables (<code>%TITLE%</code>, <code>%PAGE%</code>) to customize the layout of the report.



'''Technical Note:'''
'''Technical Note:'''
Line 98: Line 109:
|purpose= Suppress references to pages, templates, images, categories in DPL output
|purpose= Suppress references to pages, templates, images, categories in DPL output
}}
}}



'''Syntax:'''
'''Syntax:'''


<code>eliminate=''keyword,..''</code> where ''keyword'' is one of:
<code>eliminate=''keyword,..''</code> where ''keyword'' is one of:

* <code>''categories''</code>
* <code>''categories''</code>
* <code>''templates''</code>
* <code>''templates''</code>
Line 108: Line 119:
* <code>''links''</code>
* <code>''links''</code>
* <code>''all''</code> &mdash; a synonym for all of the above
* <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 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:
Line 114: Line 126:
* shares their references to images
* shares their references to images
* shares their references to other articles
* shares their references to other articles



In some cases, this may be useful. But in many cases, this is not wanted. Especially when DPL is used to create a printable document which contains the full text of other articles, duplicating all links, template uses etc., of those articles is probably undesired.
In some cases, this may be useful. But in many cases, this is not wanted. Especially when DPL is used to create a printable document which contains the full text of other articles, duplicating all links, template uses etc., of those articles is probably undesired.
Line 121: Line 134:
For further explanation, see {{DPL|reset}}.
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.
'''Note:''' 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.




Line 129: Line 142:
|purpose= Suppress references to pages, templates, images, categories in DPL output
|purpose= Suppress references to pages, templates, images, categories in DPL output
}}
}}



'''Syntax:'''
'''Syntax:'''
Line 138: Line 152:
*<code>''links''</code>
*<code>''links''</code>
*<code>''all''</code> &mdash; a synonym for all of the above
*<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 'include') normally has the consequence
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 'include') normally has the consequence
Line 144: Line 159:
* that it shares their references to images
* that it shares their references to images
* that it shares their references to other articles.
* that it shares their references to other articles.



In some cases, this may be useful. But in many cases, this is not wanted. Especially when DPL is used to create a printable document which contains the full text of other articles, duplicateing all links, template uses etc., of those articles is probably undesired.
In some cases, this may be useful. But in many cases, this is not wanted. Especially when DPL is used to create a printable document which contains the full text of other articles, duplicateing all links, template uses etc., of those articles is probably undesired.
Line 159: Line 175:
...
...
</nowiki></pre>
</nowiki></pre>



<u>In parser extension mode (DPL3 '''tag''' like &lt;DPL&gt;):</u>
<u>In parser extension mode (DPL3 '''tag''' like &lt;DPL&gt;):</u>
Line 165: Line 182:
;reset=templates: will ignore templates used in included contents but keep 'own' template usage ('Q Template').
;reset=templates: will ignore templates used in included contents but keep 'own' template usage ('Q Template').
;reset=links: will throw away all references to other pages, i.e., links contained in included contents and links like 'Q Link' will be ignored. This means that all links can be used in the normal "FORWARD" way, but no "BACKLINKS" are available for them.
;reset=links: will throw away all references to other pages, i.e., links contained in included contents and links like 'Q Link' will be ignored. This means that all links can be used in the normal "FORWARD" way, but no "BACKLINKS" are available for them.



To avoid the above described effect of <code>reset</code> on one's 'own' links, {{DPL|eliminate}} can be used. However, it is important to note that ''eliminate'' is rather expensive in terms of computer power, as it does a second parse for all included contents.
To avoid the above described effect of <code>reset</code> on one's 'own' links, {{DPL|eliminate}} can be used. However, it is important to note that ''eliminate'' is rather expensive in terms of computer power, as it does a second parse for all included contents.


<u>In parser function mode ('''<nowiki>{{#DPL:....}}</nowiki>'''):</u>


<u>In parser function mode ('''<nowiki>{{#DPL:....}}</nowiki>'''):</u>
;reset=categories: will ignore all categories
;reset=categories: will ignore all categories
;reset=images: will throw away all references to images
;reset=images: will throw away all references to images
;reset=templates: will ignore all template invocations
;reset=templates: will ignore all template invocations
;reset=links: will throw away all references to other pages
;reset=links: will throw away all references to other pages



Using <code>reset</code> in parser function mode clears everything, regardless of whether it comes from included contents or whether it is direct part of the document containing the DPL3 query.
Using <code>reset</code> in parser function mode clears everything, regardless of whether it comes from included contents or whether it is direct part of the document containing the DPL3 query.
Line 187: Line 206:
|purpose= Assign the article containing a DPL3 statement to a category, although <code>reset</code> was used.
|purpose= Assign the article containing a DPL3 statement to a category, although <code>reset</code> was used.
}}
}}



'''Syntax:'''
'''Syntax:'''

<code>fixcategory=''category name''</code>
<code>fixcategory=''category name''</code>



Use multiple commands to assign the article to more than one category.
Use multiple commands to assign the article to more than one category.
Line 204: Line 226:
|purpose= Process the command given as an argument and then exit immediately.
|purpose= Process the command given as an argument and then exit immediately.
}}
}}



'''Syntax:'''
'''Syntax:'''
Line 210: Line 233:
<br>or<br>
<br>or<br>
<code>execandexit=''geturlargs''</code>
<code>execandexit=''geturlargs''</code>



If no wiki text is given, the command will be ignored. Otherwise, DPL3 will output the wiki text and exit immediately.
If no wiki text is given, the command will be ignored. Otherwise, DPL3 will output the wiki text and exit immediately.
Line 217: Line 241:


Using this command, DPL3 can be prevented from executing a database query; this may be useful if a necessary parameter was not given by the user. Note that an ''#if'' function call would NOT help in that case because ''#if'' evaluates its complete content before taking the "if" or the "else" path. So, emebdding a DPL3 call within a #if is much less efficient than using the ''execandexit'' function.
Using this command, DPL3 can be prevented from executing a database query; this may be useful if a necessary parameter was not given by the user. Note that an ''#if'' function call would NOT help in that case because ''#if'' evaluates its complete content before taking the "if" or the "else" path. So, emebdding a DPL3 call within a #if is much less efficient than using the ''execandexit'' function.



A typical use would look like this (note the double pipe symbols within the #if.
A typical use would look like this (note the double pipe symbols within the #if.
Line 231: Line 256:
</nowiki></pre>
</nowiki></pre>


See also: [[Template:Extension DPL scroll]] and {{DPL|scrolling}}


''See also:''' [[Template:Extension DPL scroll]] and {{DPL|scrolling}}
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.


'''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.




Line 242: Line 269:
{{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}}
{{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:'''
'''Syntax:'''
Line 251: Line 279:


Where rule is one of the following:
Where rule is one of the following:

# '''Rules for batch update of articles'''
# '''Rules for batch update of articles'''
#* A DPL3 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.
#* A DPL3 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.