Merge "(bug 41292) Fix "containing..." search option"
[lhc/web/wiklou.git] / includes / Namespace.php
index 2e2b8d6..e8d5632 100644 (file)
@@ -48,6 +48,7 @@ class MWNamespace {
         * @param $index
         * @param $method
         *
+        * @throws MWException
         * @return bool
         */
        private static function isMethodValidFor( $index, $method ) {
@@ -209,12 +210,14 @@ class MWNamespace {
         * Returns array of all defined namespaces with their canonical
         * (English) names.
         *
+        * @param bool $rebuild rebuild namespace list (default = false). Used for testing.
+        *
         * @return array
         * @since 1.17
         */
-       public static function getCanonicalNamespaces() {
+       public static function getCanonicalNamespaces( $rebuild = false ) {
                static $namespaces = null;
-               if ( $namespaces === null ) {
+               if ( $namespaces === null || $rebuild ) {
                        global $wgExtraNamespaces, $wgCanonicalNamespaceNames;
                        $namespaces = array( NS_MAIN => '' ) + $wgCanonicalNamespaceNames;
                        if ( is_array( $wgExtraNamespaces ) ) {