don't just assume we get a valid title object
[lhc/web/wiklou.git] / includes / MessageCache.php
index 8af4484..a623050 100755 (executable)
@@ -67,7 +67,11 @@ class MessageCache
                global $wgAllMessagesEn;
 
                if ( $this->mDisable ) {
-                       wfDebug( "MessageCache::load(): disabled\n" );
+                       static $shownDisabled = false;
+                       if ( !$shownDisabled ) {
+                               wfDebug( "MessageCache::load(): disabled\n" );
+                               $shownDisabled = true;
+                       }
                        return true;
                }
                $fname = 'MessageCache::load';
@@ -179,7 +183,7 @@ class MessageCache
        }
 
        /**
-        * Obsolete
+        * @deprecated
         */
        function isCacheable( $key ) {
                return true;
@@ -234,7 +238,7 @@ class MessageCache
                }
                # If uninitialised, someone is trying to call this halfway through Setup.php
                if( !$this->mInitialised ) {
-                       return "<$key>";
+                       return '<' . htmlspecialchars($key) . '>';
                }
                # If cache initialization was deferred, start it now.
                if( $this->mDeferred ) {
@@ -277,7 +281,7 @@ class MessageCache
                
                # Final fallback
                if( !$message ) {
-                       $message = "<$key>";
+                       return '<' . htmlspecialchars($key) . '>';
                }
 
                # Replace brace tags
@@ -332,10 +336,21 @@ class MessageCache
        function disableTransform() { $this->mDisableTransform = true; }
        function enableTransform() { $this->mDisableTransform = false; }
 
+       /**
+        * Add a message to the cache
+        *
+        * @param mixed $key
+        * @param mixed $value
+        */
        function addMessage( $key, $value ) {
                $this->mExtensionMessages[$key] = $value;
        }
 
+       /**
+        * Add an associative array of message to the cache
+        *
+        * @param array $messages An associative array of key => values to be added
+        */
        function addMessages( $messages ) {
                foreach ( $messages as $key => $value ) {
                        $this->mExtensionMessages[$key] = $value;