Index: trunk/phase3/includes/SkinLegacy.php |
— | — | @@ -183,56 +183,16 @@ |
184 | 184 | } |
185 | 185 | |
186 | 186 | function pageStats() { |
187 | | - global $wgOut, $wgLang, $wgRequest, $wgUser; |
188 | | - global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers; |
| 187 | + $ret = array(); |
| 188 | + $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' ); |
189 | 189 | |
190 | | - if ( !is_null( $wgRequest->getVal( 'oldid' ) ) || !is_null( $wgRequest->getVal( 'diff' ) ) ) { |
191 | | - return ''; |
192 | | - } |
193 | | - |
194 | | - $title = $this->getSkin()->getTitle(); |
195 | | - |
196 | | - if ( !$wgOut->isArticle() || !$title->exists() ) { |
197 | | - return ''; |
198 | | - } |
199 | | - |
200 | | - $article = new Article( $title, 0 ); |
201 | | - |
202 | | - $s = ''; |
203 | | - |
204 | | - if ( !$wgDisableCounters ) { |
205 | | - $count = $wgLang->formatNum( $article->getCount() ); |
206 | | - |
207 | | - if ( $count ) { |
208 | | - $s = wfMsgExt( 'viewcount', array( 'parseinline' ), $count ); |
| 190 | + foreach( $items as $item ) { |
| 191 | + if ( $this->data[$item] !== false ) { |
| 192 | + $ret[] = $this->data[$item]; |
209 | 193 | } |
210 | 194 | } |
211 | 195 | |
212 | | - if ( $wgMaxCredits != 0 ) { |
213 | | - $s .= ' ' . Action::factory( 'credits', $article )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ); |
214 | | - } else { |
215 | | - $s .= $this->data['lastmod']; |
216 | | - } |
217 | | - |
218 | | - if ( $wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' ) ) { |
219 | | - $dbr = wfGetDB( DB_SLAVE ); |
220 | | - $res = $dbr->select( |
221 | | - 'watchlist', |
222 | | - array( 'COUNT(*) AS n' ), |
223 | | - array( |
224 | | - 'wl_title' => $dbr->strencode( $title->getDBkey() ), |
225 | | - 'wl_namespace' => $title->getNamespace() |
226 | | - ), |
227 | | - __METHOD__ |
228 | | - ); |
229 | | - $x = $dbr->fetchObject( $res ); |
230 | | - |
231 | | - $s .= ' ' . wfMsgExt( 'number_of_watching_users_pageview', |
232 | | - array( 'parseinline' ), $wgLang->formatNum( $x->n ) |
233 | | - ); |
234 | | - } |
235 | | - |
236 | | - return $s . ' ' . $this->getSkin()->getCopyright(); |
| 196 | + return implode( ' ', $ret ); |
237 | 197 | } |
238 | 198 | |
239 | 199 | function topLinks() { |