http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100229
Revision: 100229
Author: ialex
Date: 2011-10-19 14:52:26 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
Don't reinvent the wheel in LegacyTemplate::pageStats(), just use them items
from SkinTemplate
Modified Paths:
--------------
trunk/phase3/includes/SkinLegacy.php
Modified: trunk/phase3/includes/SkinLegacy.php
===================================================================
--- trunk/phase3/includes/SkinLegacy.php 2011-10-19 14:32:55 UTC (rev
100228)
+++ trunk/phase3/includes/SkinLegacy.php 2011-10-19 14:52:26 UTC (rev
100229)
@@ -183,56 +183,16 @@
}
function pageStats() {
- global $wgOut, $wgLang, $wgRequest, $wgUser;
- global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax,
$wgPageShowWatchingUsers;
+ $ret = array();
+ $items = array( 'viewcount', 'credits', 'lastmod',
'numberofwatchingusers', 'copyright' );
- if ( !is_null( $wgRequest->getVal( 'oldid' ) ) || !is_null(
$wgRequest->getVal( 'diff' ) ) ) {
- return '';
- }
-
- $title = $this->getSkin()->getTitle();
-
- if ( !$wgOut->isArticle() || !$title->exists() ) {
- return '';
- }
-
- $article = new Article( $title, 0 );
-
- $s = '';
-
- if ( !$wgDisableCounters ) {
- $count = $wgLang->formatNum( $article->getCount() );
-
- if ( $count ) {
- $s = wfMsgExt( 'viewcount', array(
'parseinline' ), $count );
+ foreach( $items as $item ) {
+ if ( $this->data[$item] !== false ) {
+ $ret[] = $this->data[$item];
}
}
- if ( $wgMaxCredits != 0 ) {
- $s .= ' ' . Action::factory( 'credits', $article
)->getCredits( $wgMaxCredits, $wgShowCreditsIfMax );
- } else {
- $s .= $this->data['lastmod'];
- }
-
- if ( $wgPageShowWatchingUsers && $wgUser->getOption(
'shownumberswatching' ) ) {
- $dbr = wfGetDB( DB_SLAVE );
- $res = $dbr->select(
- 'watchlist',
- array( 'COUNT(*) AS n' ),
- array(
- 'wl_title' => $dbr->strencode(
$title->getDBkey() ),
- 'wl_namespace' => $title->getNamespace()
- ),
- __METHOD__
- );
- $x = $dbr->fetchObject( $res );
-
- $s .= ' ' . wfMsgExt(
'number_of_watching_users_pageview',
- array( 'parseinline' ), $wgLang->formatNum(
$x->n )
- );
- }
-
- return $s . ' ' . $this->getSkin()->getCopyright();
+ return implode( ' ', $ret );
}
function topLinks() {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs