Use ParserOptions::newFromContext in MessageCache
The context is already called, just reuse it. This avoids unstub of $wgLang in ParserOptions constructor Change-Id: I3ac6abf6237db7c1c09740c1fec1224779e86888
This commit is contained in:
parent
fdaf95c524
commit
43a1a61c1e
1 changed files with 3 additions and 2 deletions
5
includes/cache/MessageCache.php
vendored
5
includes/cache/MessageCache.php
vendored
|
|
@ -204,7 +204,8 @@ class MessageCache implements LoggerAwareInterface {
|
||||||
*/
|
*/
|
||||||
private function getParserOptions() {
|
private function getParserOptions() {
|
||||||
if ( !$this->mParserOptions ) {
|
if ( !$this->mParserOptions ) {
|
||||||
$user = RequestContext::getMain()->getUser();
|
$context = RequestContext::getMain();
|
||||||
|
$user = $context->getUser();
|
||||||
if ( !$user->isSafeToLoad() ) {
|
if ( !$user->isSafeToLoad() ) {
|
||||||
// It isn't safe to use the context user yet, so don't try to get a
|
// It isn't safe to use the context user yet, so don't try to get a
|
||||||
// ParserOptions for it. And don't cache this ParserOptions
|
// ParserOptions for it. And don't cache this ParserOptions
|
||||||
|
|
@ -214,7 +215,7 @@ class MessageCache implements LoggerAwareInterface {
|
||||||
return $po;
|
return $po;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->mParserOptions = new ParserOptions( $user );
|
$this->mParserOptions = ParserOptions::newFromContext( $context );
|
||||||
// Messages may take parameters that could come
|
// Messages may take parameters that could come
|
||||||
// from malicious sources. As a precaution, disable
|
// from malicious sources. As a precaution, disable
|
||||||
// the <html> parser tag when parsing messages.
|
// the <html> parser tag when parsing messages.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue