Add MWNamespace::isNonincludableNamespace
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 5 May 2012 08:22:28 +0000 (10:22 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 5 May 2012 08:22:28 +0000 (10:22 +0200)
Method is a wrapper around $wgNonincludableNamespaces,
replaced the one place in parser and
add it as info to api's meta=siteinfo

Change-Id: I501b811137c39f5c2d9ea35c78fef8ae22d21bfe

includes/Namespace.php
includes/api/ApiQuerySiteinfo.php
includes/parser/Parser.php

index ac788aa..bdccca1 100644 (file)
@@ -354,4 +354,16 @@ class MWNamespace {
                return $index == NS_USER || $index == NS_USER_TALK;
        }
 
+       /**
+        * It is not possible to use pages from this namespace as template?
+        *
+        * @since 1.20
+        * @param $index int Index to check
+        * @return bool
+        */
+       public static function isNonincludableNamespace( $index ) {
+               global $wgNonincludableNamespaces;
+               return $wgNonincludableNamespaces && in_array( $index, $wgNonincludableNamespaces );
+       }
+
 }
index e11d110..9c1bef7 100644 (file)
@@ -206,6 +206,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        if ( MWNamespace::isContent( $ns ) ) {
                                $data[$ns]['content'] = '';
                        }
+
+                       if ( MWNamespace::isNonincludableNamespace( $ns ) ) {
+                               $data[$ns]['nonincludable'] = '';
+                       }
                }
 
                $this->getResult()->setIndexedTagName( $data, 'ns' );
index d5868a7..39f9509 100644 (file)
@@ -3071,7 +3071,7 @@ class Parser {
         * @private
         */
        function braceSubstitution( $piece, $frame ) {
-               global $wgNonincludableNamespaces, $wgContLang;
+               global $wgContLang;
                wfProfileIn( __METHOD__ );
                wfProfileIn( __METHOD__.'-setup' );
 
@@ -3301,7 +3301,7 @@ class Parser {
                                                $isHTML = true;
                                                $this->disableCache();
                                        }
-                               } elseif ( $wgNonincludableNamespaces && in_array( $title->getNamespace(), $wgNonincludableNamespaces ) ) {
+                               } elseif ( MWNamespace::isNonincludableNamespace( $title->getNamespace() ) ) {
                                        $found = false; # access denied
                                        wfDebug( __METHOD__.": template inclusion denied for " . $title->getPrefixedDBkey() );
                                } else {