*/
use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\Database;
/**
* Displays information about a page.
$revid = $revision ? $revision->getId() : null;
}
if ( $revid !== null ) {
- $key = self::getCacheKey( $title, $revid );
- ObjectCache::getMainWANInstance()->delete( $key );
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ $key = self::getCacheKey( $cache, $title, $revid );
+ $cache->delete( $key );
}
}
// Messages:
// pageinfo-header-basic, pageinfo-header-edits, pageinfo-header-restrictions,
// pageinfo-header-properties, pageinfo-category-info
- $content .= $this->makeHeader( $this->msg( "pageinfo-${header}" )->escaped() ) . "\n";
+ $content .= $this->makeHeader(
+ $this->msg( "pageinfo-${header}" )->escaped(),
+ "mw-pageinfo-${header}"
+ ) . "\n";
$table = "\n";
foreach ( $infoTable as $infoRow ) {
$name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0];
* @param string $header The header text.
* @return string The HTML.
*/
- protected function makeHeader( $header ) {
+ protected function makeHeader( $header, $canonicalId ) {
$spanAttribs = [ 'class' => 'mw-headline', 'id' => Sanitizer::escapeId( $header ) ];
+ $h2Attribs = [ 'id' => Sanitizer::escapeId( $canonicalId ) ];
- return Html::rawElement( 'h2', [], Html::element( 'span', $spanAttribs, $header ) );
+ return Html::rawElement( 'h2', $h2Attribs, Html::element( 'span', $spanAttribs, $header ) );
}
/**
$prefixIndex = SpecialPage::getTitleFor(
'Prefixindex', $title->getPrefixedText() . '/' );
$pageInfo['header-basic'][] = [
- Linker::link( $prefixIndex, $this->msg( 'pageinfo-subpages-name' )->escaped() ),
+ $linkRenderer->makeLink(
+ $prefixIndex,
+ $this->msg( 'pageinfo-subpages-name' )->text()
+ ),
$this->msg( 'pageinfo-subpages-value' )
->numParams(
$pageCounts['subpages']['total'],
protected function pageCounts( Page $page ) {
$fname = __METHOD__;
$config = $this->context->getConfig();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
- return ObjectCache::getMainWANInstance()->getWithSetCallback(
- self::getCacheKey( $page->getTitle(), $page->getLatest() ),
+ return $cache->getWithSetCallback(
+ self::getCacheKey( $cache, $page->getTitle(), $page->getLatest() ),
WANObjectCache::TTL_WEEK,
function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
$title = $page->getTitle();
}
/**
+ * @param WANObjectCache $cache
* @param Title $title
* @param int $revId
* @return string
*/
- protected static function getCacheKey( Title $title, $revId ) {
- return wfMemcKey( 'infoaction', md5( $title->getPrefixedText() ), $revId, self::VERSION );
+ protected static function getCacheKey( WANObjectCache $cache, Title $title, $revId ) {
+ return $cache->makeKey( 'infoaction', md5( $title->getPrefixedText() ), $revId, self::VERSION );
}
}