Daniel Kinzler has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/98511


Change subject: (bug 57746) Allow entity pages to use parser cache
......................................................................

(bug 57746) Allow entity pages to use parser cache

This fragments the parser cache be user language.

Change-Id: I1e68bace119a4adcf822e4c13ca8d5806bd27a51
---
M repo/includes/EntityView.php
M repo/includes/content/EntityHandler.php
2 files changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/11/98511/1

diff --git a/repo/includes/EntityView.php b/repo/includes/EntityView.php
index 3df2b44..ed4d654 100644
--- a/repo/includes/EntityView.php
+++ b/repo/includes/EntityView.php
@@ -301,8 +301,9 @@
                //      $editable = false;
                //}
 
-               // fresh parser output with entity markup
+               // fresh parser output for entity markup
                $pout = new ParserOutput();
+               $pout->recordOption( 'userlang' );
 
                $allSnaks = $entityRevision->getEntity()->getAllSnaks();
 
diff --git a/repo/includes/content/EntityHandler.php 
b/repo/includes/content/EntityHandler.php
index 9c25746..27ea580 100644
--- a/repo/includes/content/EntityHandler.php
+++ b/repo/includes/content/EntityHandler.php
@@ -165,20 +165,20 @@
        }
 
        /**
-        * Returns false to indicate that the parser cache should not be used 
for data items.
-        * The html representation of Items depends on the user language, 
splitting the parser
-        * cache by user language is currently problematic and would need some 
core changes.
+        * Returns true to indicate that the parser cache can be used for data 
items.
         *
-        * @note: see also note on getPageLanguage()
+        * @note: The html representation of entities depends on the user 
language, so
+        * EntityContent::getParserOutput needs to call 
ParserOutput::recordOption( 'userlang' )
+        * to split the cache by language.
         *
         * @see ContentHandler::isParserCacheSupported
         *
         * @since 0.1
         *
-        * @return bool false
+        * @return bool true
         */
        public function isParserCacheSupported() {
-               return false;
+               return true;
        }
 
        /**
@@ -207,8 +207,7 @@
         * currently doesn't support that.
         *
         * @note: in several places in mediawiki, most importantly the parser 
cache, getPageLanguage
-        * is used in places where getPageViewLanguage would be more 
appropriate. This is the reason that
-        * isParserCacheSupported() is overridden to return false.
+        * is used in places where getPageViewLanguage would be more 
appropriate.
         *
         * @param Title        $title the page to determine the language for.
         * @param Content|null $content the page's content, if you have it 
handy, to avoid reloading it.

-- 
To view, visit https://gerrit.wikimedia.org/r/98511
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e68bace119a4adcf822e4c13ca8d5806bd27a51
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to