r19934 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19933‎ | r19934 | r19935 >
Date:01:23, 15 February 2007
Author:daniel
Status:old
Tags:
Comment:
wgNonincludableNamespaces option to disable inclusion for specific namespaces. Helps to make read-protection work
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -2887,7 +2887,7 @@
28882888 * @private
28892889 */
28902890 function braceSubstitution( $piece ) {
2891 - global $wgContLang, $wgLang, $wgAllowDisplayTitle;
 2891+ global $wgContLang, $wgLang, $wgAllowDisplayTitle, $wgNonincludableNamespaces;
28922892 $fname = __METHOD__ /*. '-L' . count( $this->mArgStack )*/;
28932893 wfProfileIn( $fname );
28942894 wfProfileIn( __METHOD__.'-setup' );
@@ -3065,6 +3065,9 @@
30663066 $isHTML = true;
30673067 $this->disableCache();
30683068 }
 3069+ } else if ( $wgNonincludableNamespaces && in_array( $title->getNamespace(), $wgNonincludableNamespaces ) ) {
 3070+ $found = false; //access denied
 3071+ wfDebug( "$fname: template inclusion denied for " . $title->getPrefixedDBkey() );
30693072 } else {
30703073 $articleContent = $this->fetchTemplate( $title );
30713074 if ( $articleContent !== false ) {
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1038,6 +1038,13 @@
10391039 $wgNamespaceProtection = array();
10401040 $wgNamespaceProtection[ NS_MEDIAWIKI ] = array( 'editinterface' );
10411041
 1042+/**
 1043+* Pages in namespaces in this array can not be used as templates.
 1044+* Elements must be numeric namespace ids.
 1045+* Among other things, this may be useful to enforce read-restrictions
 1046+* which may otherwise be bypassed by using the template machanism.
 1047+*/
 1048+$wgNonincludableNamespaces = array();
10421049
10431050 /**
10441051 * Number of seconds an account is required to age before