Partial fix to bug 23167
[lhc/web/wiklou.git] / includes / Title.php
index ea5373c..09d68b2 100644 (file)
@@ -127,9 +127,9 @@ class Title {
                }
 
                /**
-                * Convert things like é ā or 〗 into real text...
+                * Convert things like é ā or 〗 into normalized(bug 14952) text
                 */
-               $filteredText = Sanitizer::decodeCharReferences( $text );
+               $filteredText = Sanitizer::decodeCharReferencesAndNormalize( $text );
 
                $t = new Title();
                $t->mDbkeyform = str_replace( ' ', '_', $filteredText );
@@ -3644,10 +3644,8 @@ class Title {
                        // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes
                        // the full l10n of that language to be loaded. That takes much memory and
                        // isn't needed. So we strip the language part away.
-                       // Also, extension messages which are not loaded, are shown as red, because
-                       // we don't call MessageCache::loadAllMessages.
                        list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
-                       return wfMsgWeirdKey( $basename );  // known system message
+                       return (bool)wfMsgWeirdKey( $basename );  // known system message
                default:
                        return false;
                }
@@ -3665,6 +3663,28 @@ class Title {
                return $this->exists() || $this->isAlwaysKnown();
        }
 
+       /**
+        * Does this page have source text?
+        *
+        * @return Boolean
+        */
+       public function hasSourceText() {
+               if ( $this->exists() )
+                       return true;
+
+               if ( $this->mNamespace == NS_MEDIAWIKI ) {
+                       // If the page doesn't exist but is a known system message, default
+                       // message content will be displayed, same for language subpages
+                       // Also, if the page is form Mediawiki:message/lang, calling wfMsgWeirdKey
+                       // causes the full l10n of that language to be loaded. That takes much
+                       // memory and isn't needed. So we strip the language part away.
+                       list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
+                       return (bool)wfMsgWeirdKey( $basename );
+               }
+
+               return false;
+       }
+
        /**
        * Is this in a namespace that allows actual pages?
        *