Index: trunk/phase3/includes/specials/SpecialStatistics.php |
— | — | @@ -37,11 +37,10 @@ |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function execute( $par ) { |
41 | | - global $wgOut, $wgMemc; |
42 | | - global $wgDisableCounters, $wgMiserMode; |
| 41 | + global $wgMemc, $wgDisableCounters, $wgMiserMode; |
43 | 42 | |
44 | 43 | $this->setHeaders(); |
45 | | - $wgOut->addModuleStyles( 'mediawiki.special' ); |
| 44 | + $this->getOutput()->addModuleStyles( 'mediawiki.special' ); |
46 | 45 | |
47 | 46 | $this->views = SiteStats::views(); |
48 | 47 | $this->edits = SiteStats::edits(); |
— | — | @@ -103,7 +102,7 @@ |
104 | 103 | $text .= "\n" . $footer->parse(); |
105 | 104 | } |
106 | 105 | |
107 | | - $wgOut->addHTML( $text ); |
| 106 | + $this->getOutput()->addHTML( $text ); |
108 | 107 | } |
109 | 108 | |
110 | 109 | /** |
— | — | @@ -136,60 +135,53 @@ |
137 | 136 | * @return string |
138 | 137 | */ |
139 | 138 | private function getPageStats() { |
140 | | - global $wgLang; |
141 | 139 | return Xml::openElement( 'tr' ) . |
142 | 140 | Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-pages', array( 'parseinline' ) ) ) . |
143 | 141 | Xml::closeElement( 'tr' ) . |
144 | 142 | $this->formatRow( wfMsgExt( 'statistics-articles', array( 'parseinline' ) ), |
145 | | - $wgLang->formatNum( $this->good ), |
| 143 | + $this->getLang()->formatNum( $this->good ), |
146 | 144 | array( 'class' => 'mw-statistics-articles' ) ) . |
147 | 145 | $this->formatRow( wfMsgExt( 'statistics-pages', array( 'parseinline' ) ), |
148 | | - $wgLang->formatNum( $this->total ), |
| 146 | + $this->getLang()->formatNum( $this->total ), |
149 | 147 | array( 'class' => 'mw-statistics-pages' ), |
150 | 148 | 'statistics-pages-desc' ) . |
151 | 149 | $this->formatRow( wfMsgExt( 'statistics-files', array( 'parseinline' ) ), |
152 | | - $wgLang->formatNum( $this->images ), |
| 150 | + $this->getLang()->formatNum( $this->images ), |
153 | 151 | array( 'class' => 'mw-statistics-files' ) ); |
154 | 152 | } |
155 | 153 | private function getEditStats() { |
156 | | - global $wgLang; |
157 | 154 | return Xml::openElement( 'tr' ) . |
158 | 155 | Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-edits', array( 'parseinline' ) ) ) . |
159 | 156 | Xml::closeElement( 'tr' ) . |
160 | 157 | $this->formatRow( wfMsgExt( 'statistics-edits', array( 'parseinline' ) ), |
161 | | - $wgLang->formatNum( $this->edits ), |
| 158 | + $this->getLang()->formatNum( $this->edits ), |
162 | 159 | array( 'class' => 'mw-statistics-edits' ) ) . |
163 | 160 | $this->formatRow( wfMsgExt( 'statistics-edits-average', array( 'parseinline' ) ), |
164 | | - $wgLang->formatNum( sprintf( '%.2f', $this->total ? $this->edits / $this->total : 0 ) ), |
| 161 | + $this->getLang()->formatNum( sprintf( '%.2f', $this->total ? $this->edits / $this->total : 0 ) ), |
165 | 162 | array( 'class' => 'mw-statistics-edits-average' ) ); |
166 | 163 | } |
167 | 164 | |
168 | 165 | private function getUserStats() { |
169 | | - global $wgLang, $wgActiveUserDays; |
170 | | - $sk = $this->getSkin(); |
| 166 | + global $wgActiveUserDays; |
171 | 167 | return Xml::openElement( 'tr' ) . |
172 | 168 | Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) . |
173 | 169 | Xml::closeElement( 'tr' ) . |
174 | 170 | $this->formatRow( wfMsgExt( 'statistics-users', array( 'parseinline' ) ), |
175 | | - $wgLang->formatNum( $this->users ), |
| 171 | + $this->getLang()->formatNum( $this->users ), |
176 | 172 | array( 'class' => 'mw-statistics-users' ) ) . |
177 | 173 | $this->formatRow( wfMsgExt( 'statistics-users-active', array( 'parseinline' ) ) . ' ' . |
178 | | - $sk->link( |
| 174 | + Linker::linkKnown( |
179 | 175 | SpecialPage::getTitleFor( 'Activeusers' ), |
180 | | - wfMsgHtml( 'listgrouprights-members' ), |
181 | | - array(), |
182 | | - array(), |
183 | | - 'known' |
| 176 | + wfMsgHtml( 'listgrouprights-members' ) |
184 | 177 | ), |
185 | | - $wgLang->formatNum( $this->activeUsers ), |
| 178 | + $this->getLang()->formatNum( $this->activeUsers ), |
186 | 179 | array( 'class' => 'mw-statistics-users-active' ), |
187 | 180 | 'statistics-users-active-desc', |
188 | | - $wgLang->formatNum( $wgActiveUserDays ) ); |
| 181 | + $this->getLang()->formatNum( $wgActiveUserDays ) ); |
189 | 182 | } |
190 | 183 | |
191 | 184 | private function getGroupStats() { |
192 | | - global $wgGroupPermissions, $wgImplicitGroups, $wgLang; |
193 | | - $sk = $this->getSkin(); |
| 185 | + global $wgGroupPermissions, $wgImplicitGroups; |
194 | 186 | $text = ''; |
195 | 187 | foreach( $wgGroupPermissions as $group => $permissions ) { |
196 | 188 | # Skip generic * and implicit groups |
— | — | @@ -210,16 +202,15 @@ |
211 | 203 | $grouppageLocalized = $msg->text(); |
212 | 204 | } |
213 | 205 | $linkTarget = Title::newFromText( $grouppageLocalized ); |
214 | | - $grouppage = $sk->link( |
| 206 | + $grouppage = Linker::link( |
215 | 207 | $linkTarget, |
216 | 208 | htmlspecialchars( $groupnameLocalized ) |
217 | 209 | ); |
218 | | - $grouplink = $sk->link( |
| 210 | + $grouplink = Linker::linkKnown( |
219 | 211 | SpecialPage::getTitleFor( 'Listusers' ), |
220 | 212 | wfMsgHtml( 'listgrouprights-members' ), |
221 | 213 | array(), |
222 | | - array( 'group' => $group ), |
223 | | - 'known' |
| 214 | + array( 'group' => $group ) |
224 | 215 | ); |
225 | 216 | # Add a class when a usergroup contains no members to allow hiding these rows |
226 | 217 | $classZero = ''; |
— | — | @@ -228,31 +219,28 @@ |
229 | 220 | $classZero = ' statistics-group-zero'; |
230 | 221 | } |
231 | 222 | $text .= $this->formatRow( $grouppage . ' ' . $grouplink, |
232 | | - $wgLang->formatNum( $countUsers ), |
| 223 | + $this->getLang()->formatNum( $countUsers ), |
233 | 224 | array( 'class' => 'statistics-group-' . Sanitizer::escapeClass( $group ) . $classZero ) ); |
234 | 225 | } |
235 | 226 | return $text; |
236 | 227 | } |
237 | 228 | |
238 | 229 | private function getViewsStats() { |
239 | | - global $wgLang; |
240 | 230 | return Xml::openElement( 'tr' ) . |
241 | 231 | Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-views', array( 'parseinline' ) ) ) . |
242 | 232 | Xml::closeElement( 'tr' ) . |
243 | 233 | $this->formatRow( wfMsgExt( 'statistics-views-total', array( 'parseinline' ) ), |
244 | | - $wgLang->formatNum( $this->views ), |
| 234 | + $this->getLang()->formatNum( $this->views ), |
245 | 235 | array ( 'class' => 'mw-statistics-views-total' ), 'statistics-views-total-desc' ) . |
246 | 236 | $this->formatRow( wfMsgExt( 'statistics-views-peredit', array( 'parseinline' ) ), |
247 | | - $wgLang->formatNum( sprintf( '%.2f', $this->edits ? |
| 237 | + $this->getLang()->formatNum( sprintf( '%.2f', $this->edits ? |
248 | 238 | $this->views / $this->edits : 0 ) ), |
249 | 239 | array ( 'class' => 'mw-statistics-views-peredit' ) ); |
250 | 240 | } |
251 | 241 | |
252 | 242 | private function getMostViewedPages() { |
253 | | - global $wgLang; |
254 | 243 | $text = ''; |
255 | 244 | $dbr = wfGetDB( DB_SLAVE ); |
256 | | - $sk = $this->getSkin(); |
257 | 245 | $res = $dbr->select( |
258 | 246 | 'page', |
259 | 247 | array( |
— | — | @@ -277,8 +265,8 @@ |
278 | 266 | foreach ( $res as $row ) { |
279 | 267 | $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); |
280 | 268 | if( $title instanceof Title ) { |
281 | | - $text .= $this->formatRow( $sk->link( $title ), |
282 | | - $wgLang->formatNum( $row->page_counter ) ); |
| 269 | + $text .= $this->formatRow( Linker::link( $title ), |
| 270 | + $this->getLang()->formatNum( $row->page_counter ) ); |
283 | 271 | |
284 | 272 | } |
285 | 273 | } |
— | — | @@ -288,8 +276,6 @@ |
289 | 277 | } |
290 | 278 | |
291 | 279 | private function getOtherStats( $stats ) { |
292 | | - global $wgLang; |
293 | | - |
294 | 280 | if ( !count( $stats ) ) |
295 | 281 | return ''; |
296 | 282 | |
— | — | @@ -301,7 +287,7 @@ |
302 | 288 | $name = htmlspecialchars( $name ); |
303 | 289 | $number = htmlspecialchars( $number ); |
304 | 290 | |
305 | | - $return .= $this->formatRow( $name, $wgLang->formatNum( $number ), array( 'class' => 'mw-statistics-hook' ) ); |
| 291 | + $return .= $this->formatRow( $name, $this->getLang()->formatNum( $number ), array( 'class' => 'mw-statistics-hook' ) ); |
306 | 292 | } |
307 | 293 | |
308 | 294 | return $return; |