Con­figu­ration para­meter "$maxRecursionDepth"

From semantic-mediawiki.org
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


$maxRecursionDepth is a configuration parameter that sets the recursion depth for a template output, e.g. result format "Template"Uses a specified template to format and display the results. The configuration parameter was introduced in Semantic MediaWiki 1.4.0Released on 21 November 2008 and compatible with MW 1.13.x - 1.16.x..

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

There is one special 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 effectively can get down to level 3.

Default setting[edit]

$maxRecursionDepth = 2;

This means that by default a recursion depth of two is permitted which effectively works until the third level of parsing.

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 with regard of naming as well as changing the setting.

Changing the default setting[edit]

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

Allow a recursion depth of e.g. three
SMWResultPrinter::$maxRecursionDepth = 3;
The setting of this configuration parameter should be adjusted very carefully to avoid unbalanced recursive loops. Do changes at your own risk.

See also[edit]