$maxRecursionDepth

From Linux Web Expert

Revision as of 03:38, 20 March 2023 by >Kghbln (chg)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Template:Interlanguagelink: en
Configuration parameter details:
Name $maxRecursionDepth
Description Sets the recursion depth for a template output
Default setting 2
Software Semantic MediaWiki
Since version
Until version still available
Configuration Query settings · inline queries
Keyword query · template output · template format


__NOBREADCRUMBLINKS__

$maxRecursionDepth [sic!] is a configuration parameter that sets the recursion depth for a template output, e.g. for result format "Plainlist"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements).. The configuration parameter was introduced in Semantic MediaWiki 1.4.0Released on an unknown date unknown versions of MediaWiki.

Some query printers may return wiki code from other pages, e.g., templates used in formatting or embedded result pages. Both pages may contain inline queries that again use new pages, so we must care about recursion. We do so by simply counting how often this method starts a subparse and stops at depth "2".

There is one particular case: if this method is called outside parsing, and the concrete printer returns wiki text, and wiki text is requested, then we may return wiki text with sub-queries to the caller. If the caller parses this (which is likely), then this will again call us in parse-context, and all recursion checks catch. Only the first level of parsing is done outside and thus not counted. Thus you can effectively get down to level 3.

Default setting

$maxRecursionDepth = 2;

A recursion depth of two is permitted by default, effectively working until the third parsing level.

The default setting for this configuration parameter is not done in the "DefaultSettings.php" file but in the "ResultPrinter.php" file around line 148, which is located at /includes/queryprinters. Also, note that it differs from standard configuration parameters about naming and changing the setting.

Changing the default setting

To modify the setting to this configuration parameter, add the following to your "LocalSettings.php" file after the enableSemantics() call:

Allow a recursion depth of e.g. three
\SMW\Query\ResultPrinters\ResultPrinter::$maxRecursionDepth = 3;
The setting of this configuration parameter should be adjusted very carefully to avoid unbalanced recursive loops. Do changes at your own risk.
Before Semantic MediaWiki 4.0.0Released on an unknown date unknown versions of MediaWiki one had to use SMWResultPrinter::$maxRecursionDepth to change the recursion depth.1

See also

#scite could not render a citation text for reference "gh:smw:5169" because type "pullrequest" was not assigned to a template.

References

  1. ^ gh:smw:5169