fixed check for old cache values in commons, and some other stuff
[lhc/web/wiklou.git] / includes / MessageCache.php
index 2627f09..6d4b788 100755 (executable)
@@ -2,6 +2,7 @@
 /**
  *
  * @package MediaWiki
+ * @subpackage Cache
  */
 
 /** */
@@ -130,23 +131,13 @@ class MessageCache
         * Loads all or main part of cacheable messages from the database
         */
        function loadFromDB() {
-               global $wgPartialMessageCache;
                $fname = 'MessageCache::loadFromDB';
                $dbr =& wfGetDB( DB_SLAVE );
                $conditions = array( 'page_is_redirect' => 0, 
                                        'page_namespace' => NS_MEDIAWIKI);
-               if ($wgPartialMessageCache) {
-                       wfDebugDieBacktrace( "Confused about how this works." );
-                       if (is_array($wgPartialMessageCache)) {
-                               $conditions['page_title']=$wgPartialMessageCache;
-                       } else {
-                               require_once("MessageCacheHints.php");
-                               $conditions['page_title']=MessageCacheHints::get();
-                       }
-               }
-               $res = $dbr->select( array( 'page', 'text' ),
+               $res = $dbr->select( array( 'page', 'revision', 'text' ),
                        array( 'page_title', 'old_text', 'old_flags' ),
-                       'page_is_redirect=0 AND page_namespace = '.NS_MEDIAWIKI.' AND page_latest = old_id',
+                       'page_is_redirect=0 AND page_namespace='.NS_MEDIAWIKI.' AND page_latest=rev_id AND rev_text_id=old_id',
                        $fname
                );
 
@@ -243,7 +234,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 ) {
@@ -286,7 +277,7 @@ class MessageCache
                
                # Final fallback
                if( !$message ) {
-                       $message = "<$key>";
+                       return '<' . htmlspecialchars($key) . '>';
                }
 
                # Replace brace tags