Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/312967
Change subject: Clean up remote parsing of wikitext ...................................................................... Clean up remote parsing of wikitext * Use formatversion=2, use a different cache key to invalidate cache * Use BagOStuff::makeGlobalCacheKey() * Add 'jsconfigvars' from the API/remote ParserOutput Bug: T146729 Change-Id: I15bc51207f7ea564800cc4dfe9a4b3e3ca93b1ec --- M GlobalUserPage.body.php 1 file changed, 15 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalUserPage refs/changes/67/312967/1 diff --git a/GlobalUserPage.body.php b/GlobalUserPage.body.php index 71804db..419a74c 100644 --- a/GlobalUserPage.body.php +++ b/GlobalUserPage.body.php @@ -3,6 +3,12 @@ class GlobalUserPage extends Article { /** + * Cache version of action=parse + * output + */ + const PARSED_CACHE_VERSION = 2; + + /** * @var Config */ private $config; @@ -44,11 +50,11 @@ // If the user page is empty or the API request failed, show the normal // missing article page - if ( !$parsedOutput || !trim( $parsedOutput['text']['*'] ) ) { + if ( !$parsedOutput || !trim( $parsedOutput['text'] ) ) { parent::showMissingArticle(); return; } - $out->addHTML( $parsedOutput['text']['*'] ); + $out->addHTML( $parsedOutput['text'] ); $out->addModuleStyles( 'ext.GlobalUserPage' ); $footerKey = $this->config->get( 'GlobalUserPageFooterKey' ); @@ -86,6 +92,8 @@ } } } + + $out->addJsConfigVars( $parsedOutput['jsconfigvars'] ); } /** @@ -226,7 +234,9 @@ $langCode = $this->getContext()->getLanguage()->getCode(); // Need language code in the key since we pass &uselang= to the API. - $key = "globaluserpage:parsed:$touched:$langCode:" . md5( $this->getUsername() ); + $key = $this->cache->makeGlobalKey( 'globaluserpage', 'parsed', + self::PARSED_CACHE_VERSION, $touched, $langCode, md5( $this->getUsername() ) + ); $data = $this->cache->get( $key ); if ( $data === false ){ $data = $this->parseWikiText( $this->getTitle(), $langCode ); @@ -363,7 +373,8 @@ 'disableeditsection' => 1, 'disablelimitreport' => 1, 'uselang' => $langCode, - 'prop' => 'text|modules' + 'prop' => 'text|modules|jsconfigvars', + 'formatversion' => 2 ); $data = $this->makeAPIRequest( $params ); return $data !== false ? $data['parse'] : false; -- To view, visit https://gerrit.wikimedia.org/r/312967 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I15bc51207f7ea564800cc4dfe9a4b3e3ca93b1ec Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GlobalUserPage Gerrit-Branch: master Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits