// Clear page info.
$revision = WikiPage::factory( $title )->getRevision();
if ( $revision !== null ) {
- $memcKey = wfMemcKey( 'infoaction', $title->getPrefixedText(), $revision->getId() );
- $wgMemc->delete( $memcKey );
+ $key = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $revision->getId() );
+ $wgMemc->delete( $key );
}
}
// Render page information
foreach ( $pageInfo as $header => $infoTable ) {
+ // 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";
$table = "\n";
foreach ( $infoTable as $infoRow ) {
$name = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->escaped() : $infoRow[0];
$value = ( $infoRow[1] instanceof Message ) ? $infoRow[1]->escaped() : $infoRow[1];
- $table = $this->addRow( $table, $name, $value ) . "\n";
+ $id = ( $infoRow[0] instanceof Message ) ? $infoRow[0]->getKey() : null;
+ $table = $this->addRow( $table, $name, $value, $id ) . "\n";
}
$content = $this->addTable( $content, $table ) . "\n";
}
* @param string $table The table that will be added to the content
* @param string $name The name of the row
* @param string $value The value of the row
+ * @param string $id The ID to use for the 'tr' element
* @return string The table with the row added
*/
- protected function addRow( $table, $name, $value ) {
- return $table . Html::rawElement( 'tr', array(),
+ protected function addRow( $table, $name, $value, $id ) {
+ return $table . Html::rawElement( 'tr', $id === null ? array() : array( 'id' => 'mw-' . $id ),
Html::rawElement( 'td', array( 'style' => 'vertical-align: top;' ), $name ) .
Html::rawElement( 'td', array(), $value )
);
* @return array
*/
protected function pageInfo() {
- global $wgContLang, $wgRCMaxAge, $wgMemc, $wgUnwatchedPageThreshold, $wgPageInfoTransclusionLimit;
+ global $wgContLang, $wgRCMaxAge, $wgMemc,
+ $wgUnwatchedPageThreshold, $wgPageInfoTransclusionLimit;
$user = $this->getUser();
$lang = $this->getLanguage();
$title = $this->getTitle();
$id = $title->getArticleID();
- $memcKey = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $this->page->getLatest() );
+ $memcKey = wfMemcKey( 'infoaction',
+ sha1( $title->getPrefixedText() ), $this->page->getLatest() );
$pageCounts = $wgMemc->get( $memcKey );
$version = isset( $pageCounts['cacheversion'] ) ? $pageCounts['cacheversion'] : false;
if ( $pageCounts === false || $version !== self::CACHE_VERSION ) {
// Use robot policy logic
$policy = $this->page->getRobotPolicy( 'view', $pOutput );
$pageInfo['header-basic'][] = array(
+ // Messages: pageinfo-robot-index, pageinfo-robot-noindex
$this->msg( 'pageinfo-robot-policy' ), $this->msg( "pageinfo-robot-${policy['index']}" )
);
$message = $this->msg( 'protect-default' )->escaped();
} else {
// Administrators only
+ // Messages: protect-level-autoconfirmed, protect-level-sysop
$message = $this->msg( "protect-level-$protectionLevel" );
if ( $message->isDisabled() ) {
// Require "$1" permission
}
}
+ // Messages: restriction-edit, restriction-move, restriction-create,
+ // restriction-upload
$pageInfo['header-restrictions'][] = array(
$this->msg( "restriction-$restrictionType" ), $message
);
if ( !$wgDisableCounters ) {
// Number of views
- $views = (int) $dbr->selectField(
+ $views = (int)$dbr->selectField(
'page',
'page_counter',
array( 'page_id' => $id ),
}
// Number of page watchers
- $watchers = (int) $dbr->selectField(
+ $watchers = (int)$dbr->selectField(
'watchlist',
'COUNT(*)',
array(
$result['watchers'] = $watchers;
// Total number of edits
- $edits = (int) $dbr->selectField(
+ $edits = (int)$dbr->selectField(
'revision',
'COUNT(rev_page)',
array( 'rev_page' => $id ),
$result['edits'] = $edits;
// Total number of distinct authors
- $authors = (int) $dbr->selectField(
+ $authors = (int)$dbr->selectField(
'revision',
'COUNT(DISTINCT rev_user_text)',
array( 'rev_page' => $id ),
$threshold = $dbr->timestamp( time() - $wgRCMaxAge );
// Recent number of edits
- $edits = (int) $dbr->selectField(
+ $edits = (int)$dbr->selectField(
'revision',
'COUNT(rev_page)',
array(
$result['recent_edits'] = $edits;
// Recent number of distinct authors
- $authors = (int) $dbr->selectField(
+ $authors = (int)$dbr->selectField(
'revision',
'COUNT(DISTINCT rev_user_text)',
array(
// Subpages of this page (redirects)
$conds['page_is_redirect'] = 1;
- $result['subpages']['redirects'] = (int) $dbr->selectField(
+ $result['subpages']['redirects'] = (int)$dbr->selectField(
'page',
'COUNT(page_id)',
$conds,
// Subpages of this page (non-redirects)
$conds['page_is_redirect'] = 0;
- $result['subpages']['nonredirects'] = (int) $dbr->selectField(
+ $result['subpages']['nonredirects'] = (int)$dbr->selectField(
'page',
'COUNT(page_id)',
$conds,
}
// Counts for the number of transclusion links (to/from)
- $result['transclusion']['to'] = (int) $dbr->selectField(
+ $result['transclusion']['to'] = (int)$dbr->selectField(
'templatelinks',
'COUNT(tl_from)',
array(
__METHOD__
);
- $result['transclusion']['from'] = (int) $dbr->selectField(
+ $result['transclusion']['from'] = (int)$dbr->selectField(
'templatelinks',
'COUNT(*)',
array( 'tl_from' => $title->getArticleID() ),