$res = $dbr->select(
$revQuery['tables'],
$revQuery['fields'],
- array_merge( $conds, [ 'page_len <= ' . intval( $wgMaxMsgCacheEntrySize ) ] ),
+ array_merge( $conds, [
+ 'page_len <= ' . intval( $wgMaxMsgCacheEntrySize ),
+ 'page_latest = rev_id' // get the latest revision only
+ ] ),
__METHOD__ . "($code)-small",
[],
$revQuery['joins']
$this->wanCache->touchCheckKey( $this->getCheckKey( $code ) );
// Purge the messages in the message blob store and fire any hook handlers
- $resourceloader = RequestContext::getMain()->getOutput()->getResourceLoader();
- $blobStore = $resourceloader->getMessageBlobStore();
+ $blobStore = MediaWikiServices::getInstance()->getResourceLoader()->getMessageBlobStore();
foreach ( $replacements as list( $title, $msg ) ) {
$blobStore->updateMessage( $this->contLang->lcfirst( $msg ) );
Hooks::run( 'MessageCacheReplace', [ $title, $newTextByTitle[$title] ] );
* @return Parser
*/
public function getParser() {
- global $wgParser, $wgParserConf;
-
- if ( !$this->mParser && isset( $wgParser ) ) {
+ global $wgParserConf;
+ if ( !$this->mParser ) {
+ $parser = MediaWikiServices::getInstance()->getParser();
# Do some initialisation so that we don't have to do it twice
- $wgParser->firstCallInit();
+ $parser->firstCallInit();
# Clone it and store it
$class = $wgParserConf['class'];
if ( $class == ParserDiffTest::class ) {
# Uncloneable
$this->mParser = new $class( $wgParserConf );
} else {
- $this->mParser = clone $wgParser;
+ $this->mParser = clone $parser;
}
}