$content .= $this->msg( 'pageinfo-footer' )->parse();
}
- // Page credits
- /*if ( $this->page->exists() ) {
- $content .= Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $this->getContributors() );
- }*/
-
return $content;
}
* @return string The table with the row added
*/
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 $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 )
+ );
}
/**
$pageCounts = $this->pageCounts( $this->page );
- // Get page properties
- $dbr = wfGetDB( DB_SLAVE );
- $result = $dbr->select(
- 'page_props',
- array( 'pp_propname', 'pp_value' ),
- array( 'pp_page' => $id ),
- __METHOD__
- );
-
$pageProperties = array();
- foreach ( $result as $row ) {
- $pageProperties[$row->pp_propname] = $row->pp_value;
+ $props = PageProps::getInstance()->getProperties( $title );
+ if ( isset( $props[$id] ) ) {
+ $pageProperties = $props[$id];
}
// Basic information
$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']}" )
+ $this->msg( 'pageinfo-robot-policy' ),
+ $this->msg( "pageinfo-robot-${policy['index']}" )
);
$unwatchedPageThreshold = $config->get( 'UnwatchedPageThreshold' );
// Subpages of this page, if subpages are enabled for the current NS
if ( MWNamespace::hasSubpages( $title->getNamespace() ) ) {
- $prefixIndex = SpecialPage::getTitleFor( 'Prefixindex', $title->getPrefixedText() . '/' );
+ $prefixIndex = SpecialPage::getTitleFor(
+ 'Prefixindex', $title->getPrefixedText() . '/' );
$pageInfo['header-basic'][] = array(
Linker::link( $prefixIndex, $this->msg( 'pageinfo-subpages-name' )->escaped() ),
$this->msg( 'pageinfo-subpages-value' )
// Is this page affected by the cascading protection of something which includes it?
if ( $title->isCascadeProtected() ) {
$cascadingFrom = '';
- $sources = $title->getCascadeProtectionSources(); // Array deferencing is in PHP 5.4 :(
+ $sources = $title->getCascadeProtectionSources()[0];
- foreach ( $sources[0] as $sourceTitle ) {
- $cascadingFrom .= Html::rawElement( 'li', array(), Linker::linkKnown( $sourceTitle ) );
+ foreach ( $sources as $sourceTitle ) {
+ $cascadingFrom .= Html::rawElement(
+ 'li', array(), Linker::linkKnown( $sourceTitle ) );
}
$cascadingFrom = Html::rawElement( 'ul', array(), $cascadingFrom );
$this->msg( 'pageinfo-lasttime' ),
Linker::linkKnown(
$title,
- htmlspecialchars( $lang->userTimeAndDate( $this->page->getTimestamp(), $user ) ),
+ htmlspecialchars(
+ $lang->userTimeAndDate( $this->page->getTimestamp(), $user )
+ ),
array(),
array( 'oldid' => $this->page->getLatest() )
)
// Recent number of edits (within past 30 days)
$pageInfo['header-edits'][] = array(
- $this->msg( 'pageinfo-recent-edits', $lang->formatDuration( $config->get( 'RCMaxAge' ) ) ),
+ $this->msg( 'pageinfo-recent-edits',
+ $lang->formatDuration( $config->get( 'RCMaxAge' ) ) ),
$lang->formatNum( $pageCounts['recent_edits'] )
);
// Recent number of distinct authors
$pageInfo['header-edits'][] = array(
- $this->msg( 'pageinfo-recent-authors' ), $lang->formatNum( $pageCounts['recent_authors'] )
+ $this->msg( 'pageinfo-recent-authors' ),
+ $lang->formatNum( $pageCounts['recent_authors'] )
);
// Array of MagicWord objects
return ObjectCache::getMainWANInstance()->getWithSetCallback(
self::getCacheKey( $page->getTitle(), $page->getLatest() ),
+ 86400 * 7,
function ( $oldValue, &$ttl, &$setOpts ) use ( $page, $config, $fname ) {
$title = $page->getTitle();
$id = $title->getArticleID();
+ $dbr = wfGetDB( DB_SLAVE );
$dbrWatchlist = wfGetDB( DB_SLAVE, 'watchlist' );
+
+ $setOpts += Database::getCacheSetOptions( $dbr, $dbrWatchlist );
+
$result = array();
// Number of page watchers
array(
'wl_namespace' => $title->getNamespace(),
'wl_title' => $title->getDBkey(),
- 'wl_notificationtimestamp >= ' . $dbrWatchlist->addQuotes( $threshold ) .
- ' OR wl_notificationtimestamp IS NULL'
+ 'wl_notificationtimestamp >= ' .
+ $dbrWatchlist->addQuotes( $threshold ) .
+ ' OR wl_notificationtimestamp IS NULL'
),
$fname
);
$result['visitingWatchers'] = $visitingWatchers;
}
- $dbr = wfGetDB( DB_SLAVE );
// Total number of edits
$edits = (int)$dbr->selectField(
'revision',
$fname
);
- $setOpts = array( 'since' => $dbr->trxTimestamp() );
-
return $result;
- },
- 86400 * 7
+ }
);
}
# "ThisSite user(s) A, B and C"
if ( count( $user_names ) ) {
- $user = $this->msg( 'siteusers' )->rawParams( $lang->listToText( $user_names ) )->params(
- count( $user_names ) )->escaped();
+ $user = $this->msg( 'siteusers' )
+ ->rawParams( $lang->listToText( $user_names ) )
+ ->params( count( $user_names ) )->escaped();
} else {
$user = false;
}
if ( count( $anon_ips ) ) {
- $anon = $this->msg( 'anonusers' )->rawParams( $lang->listToText( $anon_ips ) )->params(
- count( $anon_ips ) )->escaped();
+ $anon = $this->msg( 'anonusers' )
+ ->rawParams( $lang->listToText( $anon_ips ) )
+ ->params( count( $anon_ips ) )->escaped();
} else {
$anon = false;
}