* (bug 26187) Confirmrecreate no longer parses the edit summary
[lhc/web/wiklou.git] / includes / Namespace.php
index a2d4386..3db1938 100644 (file)
@@ -117,7 +117,6 @@ class MWNamespace {
                return isset( $nslist[$index] );
        }
 
-
        /**
         * Returns array of all defined namespaces with their canonical
         * (English) names.
@@ -135,6 +134,7 @@ class MWNamespace {
                                $namespaces = $wgCanonicalNamespaceNames;
                        }
                        $namespaces[NS_MAIN] = '';
+                       wfRunHooks( 'CanonicalNamespaces', array( &$namespaces ) );
                }
                return $namespaces;
        }
@@ -238,6 +238,21 @@ class MWNamespace {
                return !empty( $wgNamespacesWithSubpages[$index] );
        }
 
+       /**
+        * Get a list of all namespace indices which are considered to contain content
+        * @return array of namespace indices
+        */
+       public static function getContentNamespaces() {
+               global $wgContentNamespaces;
+               if( !is_array( $wgContentNamespaces ) || $wgContentNamespaces === array() ) {
+                       return NS_MAIN;
+               } elseif ( !in_array( NS_MAIN, $wgContentNamespaces ) ) {
+                       // always force NS_MAIN to be part of array (to match the algorithm used by isContent)
+                       return array_merge( array( NS_MAIN ), $wgContentNamespaces );
+               } else {
+                       return $wgContentNamespaces;
+               }
+       }
        /**
         * Is the namespace first-letter capitalized?
         *