- // If the text was fetched without an error, convert it
- if ( $text !== false ) {
- $text = self::decompressRevisionText( $text, $flags );
+ if ( isset( $row->old_id ) && $wiki === false ) {
+ // Make use of the wiki-local revision text cache
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ // The cached value should be decompressed, so handle that and return here
+ return $cache->getWithSetCallback(
+ $cache->makeKey( 'revisiontext', 'textid', $row->old_id ),
+ self::getCacheTTL( $cache ),
+ function () use ( $url, $wiki, $flags ) {
+ // No negative caching per Revision::loadText()
+ $text = ExternalStore::fetchFromURL( $url, [ 'wiki' => $wiki ] );
+
+ return self::decompressRevisionText( $text, $flags );
+ },
+ [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => $cache::TTL_PROC_LONG ]
+ );
+ } else {
+ $text = ExternalStore::fetchFromURL( $url, [ 'wiki' => $wiki ] );
+ }