Index: branches/pageoutput/includes/SpecialPageFactory.php |
— | — | @@ -140,6 +140,7 @@ |
141 | 141 | 'Blankpage' => 'SpecialBlankpage', |
142 | 142 | 'Blockme' => 'SpecialBlockme', |
143 | 143 | 'Emailuser' => 'SpecialEmailUser', |
| 144 | + 'History' => 'SpecialHistory', |
144 | 145 | 'Movepage' => 'MovePageForm', |
145 | 146 | 'Mycontributions' => 'SpecialMycontributions', |
146 | 147 | 'Mypage' => 'SpecialMypage', |
Index: branches/pageoutput/includes/Article.php |
— | — | @@ -127,6 +127,14 @@ |
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
| 131 | + * Get the WikiPage used here |
| 132 | + * @return WikiPage |
| 133 | + */ |
| 134 | + public function getPage() { |
| 135 | + return $this->mPage; |
| 136 | + } |
| 137 | + |
| 138 | + /** |
131 | 139 | * Get the title object of the article |
132 | 140 | * @return Title object of this page |
133 | 141 | */ |
Index: branches/pageoutput/includes/HistoryPage.php |
— | — | @@ -15,40 +15,34 @@ |
16 | 16 | * history. |
17 | 17 | * |
18 | 18 | */ |
19 | | -class HistoryPage { |
| 19 | +class HistoryPage extends ContextSource { |
20 | 20 | const DIR_PREV = 0; |
21 | 21 | const DIR_NEXT = 1; |
22 | 22 | |
23 | | - /** Contains the Article object. Passed on construction. */ |
24 | | - private $article; |
25 | | - /** The $article title object. Found on construction. */ |
26 | | - private $title; |
27 | | - /** Shortcut to the user Skin object. */ |
28 | | - private $skin; |
| 23 | + /** A WikiPage. */ |
| 24 | + private $mPage; |
29 | 25 | |
30 | 26 | /** |
31 | 27 | * Construct a new HistoryPage. |
32 | 28 | * |
33 | | - * @param $article Article |
| 29 | + * @param $context RequestContext,Article,PageView |
34 | 30 | */ |
35 | | - function __construct( $article ) { |
36 | | - global $wgUser; |
37 | | - $this->article = $article; |
38 | | - $this->title = $article->getTitle(); |
39 | | - $this->skin = $wgUser->getSkin(); |
| 31 | + function __construct( $context ) { |
| 32 | + if ( $context instanceof Article || $context instanceof PageView ) { |
| 33 | + $this->mPage = $context->getPage(); |
| 34 | + $this->setContext( $context->getContext() ); |
| 35 | + } else { |
| 36 | + $this->mPage = WikiPage::factory( $context->getTitle() ); |
| 37 | + $this->setContext( $context ); |
| 38 | + } |
40 | 39 | $this->preCacheMessages(); |
41 | 40 | } |
42 | 41 | |
43 | | - /** Get the Article object we are working on. */ |
| 42 | + /** For hook compatibility, returns a WikiPage now instead of an Article */ |
44 | 43 | public function getArticle() { |
45 | | - return $this->article; |
| 44 | + return $this->mPage; |
46 | 45 | } |
47 | 46 | |
48 | | - /** Get the Title object. */ |
49 | | - public function getTitle() { |
50 | | - return $this->title; |
51 | | - } |
52 | | - |
53 | 47 | /** |
54 | 48 | * As we use the same small set of messages in various methods and that |
55 | 49 | * they are called often, we call them once and save them in $this->message |
— | — | @@ -68,52 +62,55 @@ |
69 | 63 | * @return nothing |
70 | 64 | */ |
71 | 65 | function history() { |
72 | | - global $wgOut, $wgRequest, $wgScript; |
| 66 | + global $wgScript; |
73 | 67 | |
| 68 | + $out = $this->getOutput(); |
| 69 | + $request = $this->getRequest(); |
| 70 | + |
74 | 71 | /** |
75 | 72 | * Allow client caching. |
76 | 73 | */ |
77 | | - if ( $wgOut->checkLastModified( $this->article->getTouched() ) ) |
| 74 | + if ( $out->checkLastModified( $this->mPage->getTouched() ) ) |
78 | 75 | return; // Client cache fresh and headers sent, nothing more to do. |
79 | 76 | |
80 | 77 | wfProfileIn( __METHOD__ ); |
81 | 78 | |
82 | 79 | // Setup page variables. |
83 | | - $wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) ); |
84 | | - $wgOut->setPageTitleActionText( wfMsg( 'history_short' ) ); |
85 | | - $wgOut->setArticleFlag( false ); |
86 | | - $wgOut->setArticleRelated( true ); |
87 | | - $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
88 | | - $wgOut->setSyndicated( true ); |
89 | | - $wgOut->setFeedAppendQuery( 'action=history' ); |
90 | | - $wgOut->addModules( array( 'mediawiki.legacy.history', 'mediawiki.action.history' ) ); |
| 80 | + $out->setPageTitle( wfMsg( 'history-title', $this->getTitle()->getPrefixedText() ) ); |
| 81 | + $out->setPageTitleActionText( wfMsg( 'history_short' ) ); |
| 82 | + $out->setArticleFlag( false ); |
| 83 | + $out->setArticleRelated( true ); |
| 84 | + $out->setRobotPolicy( 'noindex,nofollow' ); |
| 85 | + $out->setSyndicated( true ); |
| 86 | + $out->setFeedAppendQuery( 'action=history' ); |
| 87 | + $out->addModules( array( 'mediawiki.legacy.history', 'mediawiki.action.history' ) ); |
91 | 88 | |
92 | 89 | // Creation of a subtitle link pointing to [[Special:Log]] |
93 | 90 | $logPage = SpecialPage::getTitleFor( 'Log' ); |
94 | | - $logLink = $this->skin->link( |
| 91 | + $logLink = Linker::link( |
95 | 92 | $logPage, |
96 | 93 | wfMsgHtml( 'viewpagelogs' ), |
97 | 94 | array(), |
98 | | - array( 'page' => $this->title->getPrefixedText() ), |
| 95 | + array( 'page' => $this->getTitle()->getPrefixedText() ), |
99 | 96 | array( 'known', 'noclasses' ) |
100 | 97 | ); |
101 | | - $wgOut->setSubtitle( $logLink ); |
| 98 | + $out->setSubtitle( $logLink ); |
102 | 99 | |
103 | 100 | // Handle atom/RSS feeds. |
104 | | - $feedType = $wgRequest->getVal( 'feed' ); |
| 101 | + $feedType = $request->getVal( 'feed' ); |
105 | 102 | if ( $feedType ) { |
106 | 103 | wfProfileOut( __METHOD__ ); |
107 | 104 | return $this->feed( $feedType ); |
108 | 105 | } |
109 | 106 | |
110 | 107 | // Fail nicely if article doesn't exist. |
111 | | - if ( !$this->title->exists() ) { |
112 | | - $wgOut->addWikiMsg( 'nohistory' ); |
| 108 | + if ( !$this->getTitle()->exists() ) { |
| 109 | + $out->addWikiMsg( 'nohistory' ); |
113 | 110 | # show deletion/move log if there is an entry |
114 | 111 | LogEventsList::showLogExtract( |
115 | | - $wgOut, |
| 112 | + $out, |
116 | 113 | array( 'delete', 'move' ), |
117 | | - $this->title->getPrefixedText(), |
| 114 | + $this->getTitle()->getPrefixedText(), |
118 | 115 | '', |
119 | 116 | array( 'lim' => 10, |
120 | 117 | 'conds' => array( "log_action != 'revision'" ), |
— | — | @@ -128,32 +125,32 @@ |
129 | 126 | /** |
130 | 127 | * Add date selector to quickly get to a certain time |
131 | 128 | */ |
132 | | - $year = $wgRequest->getInt( 'year' ); |
133 | | - $month = $wgRequest->getInt( 'month' ); |
134 | | - $tagFilter = $wgRequest->getVal( 'tagfilter' ); |
| 129 | + $year = $request->getInt( 'year' ); |
| 130 | + $month = $request->getInt( 'month' ); |
| 131 | + $tagFilter = $request->getVal( 'tagfilter' ); |
135 | 132 | $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); |
136 | 133 | |
137 | 134 | /** |
138 | 135 | * Option to show only revisions that have been (partially) hidden via RevisionDelete |
139 | 136 | */ |
140 | | - if ( $wgRequest->getBool( 'deleted' ) ) { |
| 137 | + if ( $request->getBool( 'deleted' ) ) { |
141 | 138 | $conds = array( "rev_deleted != '0'" ); |
142 | 139 | } else { |
143 | 140 | $conds = array(); |
144 | 141 | } |
145 | 142 | $checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), |
146 | | - 'deleted', 'mw-show-deleted-only', $wgRequest->getBool( 'deleted' ) ) . "\n"; |
| 143 | + 'deleted', 'mw-show-deleted-only', $request->getBool( 'deleted' ) ) . "\n"; |
147 | 144 | |
148 | 145 | // Add the general form |
149 | 146 | $action = htmlspecialchars( $wgScript ); |
150 | | - $wgOut->addHTML( |
| 147 | + $out->addHTML( |
151 | 148 | "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" . |
152 | 149 | Xml::fieldset( |
153 | 150 | wfMsg( 'history-fieldset-title' ), |
154 | 151 | false, |
155 | 152 | array( 'id' => 'mw-history-search' ) |
156 | 153 | ) . |
157 | | - Html::hidden( 'title', $this->title->getPrefixedDBKey() ) . "\n" . |
| 154 | + Html::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . "\n" . |
158 | 155 | Html::hidden( 'action', 'history' ) . "\n" . |
159 | 156 | Xml::dateMenu( $year, $month ) . ' ' . |
160 | 157 | ( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) . |
— | — | @@ -162,16 +159,16 @@ |
163 | 160 | '</fieldset></form>' |
164 | 161 | ); |
165 | 162 | |
166 | | - wfRunHooks( 'PageHistoryBeforeList', array( &$this->article ) ); |
| 163 | + wfRunHooks( 'PageHistoryBeforeList', array( &$this->mPage ) ); |
167 | 164 | |
168 | 165 | // Create and output the list. |
169 | 166 | $pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds ); |
170 | | - $wgOut->addHTML( |
| 167 | + $out->addHTML( |
171 | 168 | $pager->getNavigationBar() . |
172 | 169 | $pager->getBody() . |
173 | 170 | $pager->getNavigationBar() |
174 | 171 | ); |
175 | | - $wgOut->preventClickjacking( $pager->getPreventClickjacking() ); |
| 172 | + $out->preventClickjacking( $pager->getPreventClickjacking() ); |
176 | 173 | |
177 | 174 | wfProfileOut( __METHOD__ ); |
178 | 175 | } |
— | — | @@ -201,7 +198,7 @@ |
202 | 199 | $offsets = array(); |
203 | 200 | } |
204 | 201 | |
205 | | - $page_id = $this->title->getArticleID(); |
| 202 | + $page_id = $this->getTitle()->getArticleID(); |
206 | 203 | |
207 | 204 | return $dbr->select( 'revision', |
208 | 205 | Revision::selectFields(), |
— | — | @@ -218,21 +215,21 @@ |
219 | 216 | * @param $type String: feed type |
220 | 217 | */ |
221 | 218 | function feed( $type ) { |
222 | | - global $wgFeedClasses, $wgRequest, $wgFeedLimit; |
| 219 | + global $wgFeedClasses, $wgFeedLimit; |
223 | 220 | if ( !FeedUtils::checkFeedOutput( $type ) ) { |
224 | 221 | return; |
225 | 222 | } |
226 | 223 | |
227 | 224 | $feed = new $wgFeedClasses[$type]( |
228 | | - $this->title->getPrefixedText() . ' - ' . |
| 225 | + $this->getTitle()->getPrefixedText() . ' - ' . |
229 | 226 | wfMsgForContent( 'history-feed-title' ), |
230 | 227 | wfMsgForContent( 'history-feed-description' ), |
231 | | - $this->title->getFullUrl( 'action=history' ) |
| 228 | + $this->getTitle()->getFullUrl( 'action=history' ) |
232 | 229 | ); |
233 | 230 | |
234 | 231 | // Get a limit on number of feed entries. Provide a sane default |
235 | 232 | // of 10 if none is defined (but limit to $wgFeedLimit max) |
236 | | - $limit = $wgRequest->getInt( 'limit', 10 ); |
| 233 | + $limit = $this->getRequest()->getInt( 'limit', 10 ); |
237 | 234 | if ( $limit > $wgFeedLimit || $limit < 1 ) { |
238 | 235 | $limit = 10; |
239 | 236 | } |
— | — | @@ -251,14 +248,13 @@ |
252 | 249 | } |
253 | 250 | |
254 | 251 | function feedEmpty() { |
255 | | - global $wgOut; |
256 | 252 | return new FeedItem( |
257 | 253 | wfMsgForContent( 'nohistory' ), |
258 | | - $wgOut->parse( wfMsgForContent( 'history-feed-empty' ) ), |
259 | | - $this->title->getFullUrl(), |
| 254 | + $this->getOutput()->parse( wfMsgForContent( 'history-feed-empty' ) ), |
| 255 | + $this->getTitle()->getFullUrl(), |
260 | 256 | wfTimestamp( TS_MW ), |
261 | 257 | '', |
262 | | - $this->title->getTalkPage()->getFullUrl() |
| 258 | + $this->getTitle()->getTalkPage()->getFullUrl() |
263 | 259 | ); |
264 | 260 | } |
265 | 261 | |
— | — | @@ -272,10 +268,10 @@ |
273 | 269 | */ |
274 | 270 | function feedItem( $row ) { |
275 | 271 | $rev = new Revision( $row ); |
276 | | - $rev->setTitle( $this->title ); |
| 272 | + $rev->setTitle( $this->getTitle() ); |
277 | 273 | $text = FeedUtils::formatDiffRow( |
278 | | - $this->title, |
279 | | - $this->title->getPreviousRevisionID( $rev->getId() ), |
| 274 | + $this->getTitle(), |
| 275 | + $this->getTitle()->getPreviousRevisionID( $rev->getId() ), |
280 | 276 | $rev->getId(), |
281 | 277 | $rev->getTimestamp(), |
282 | 278 | $rev->getComment() |
— | — | @@ -296,10 +292,10 @@ |
297 | 293 | return new FeedItem( |
298 | 294 | $title, |
299 | 295 | $text, |
300 | | - $this->title->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ), |
| 296 | + $this->getTitle()->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ), |
301 | 297 | $rev->getTimestamp(), |
302 | 298 | $rev->getUserText(), |
303 | | - $this->title->getTalkPage()->getFullUrl() |
| 299 | + $this->getTitle()->getTalkPage()->getFullUrl() |
304 | 300 | ); |
305 | 301 | } |
306 | 302 | } |
— | — | @@ -315,20 +311,29 @@ |
316 | 312 | function __construct( $historyPage, $year = '', $month = '', $tagFilter = '', $conds = array() ) { |
317 | 313 | parent::__construct(); |
318 | 314 | $this->historyPage = $historyPage; |
319 | | - $this->title = $this->historyPage->getTitle(); |
320 | 315 | $this->tagFilter = $tagFilter; |
321 | 316 | $this->getDateCond( $year, $month ); |
322 | 317 | $this->conds = $conds; |
323 | 318 | } |
324 | 319 | |
325 | 320 | // For hook compatibility... |
| 321 | + // Note that this returns a WikiPage now, some extensions should still work though |
326 | 322 | function getArticle() { |
327 | 323 | return $this->historyPage->getArticle(); |
328 | 324 | } |
329 | 325 | |
330 | 326 | function getTitle() { |
331 | | - return $this->title; |
| 327 | + return $this->historyPage->getTitle(); |
332 | 328 | } |
| 329 | + function getUser() { |
| 330 | + return $this->historyPage->getUser(); |
| 331 | + } |
| 332 | + function getLang() { |
| 333 | + return $this->historyPage->getLang(); |
| 334 | + } |
| 335 | + function getOutput() { |
| 336 | + return $this->historyPage->getOutput(); |
| 337 | + } |
333 | 338 | |
334 | 339 | function getSqlComment() { |
335 | 340 | if ( $this->conds ) { |
— | — | @@ -343,7 +348,7 @@ |
344 | 349 | 'tables' => array( 'revision' ), |
345 | 350 | 'fields' => Revision::selectFields(), |
346 | 351 | 'conds' => array_merge( |
347 | | - array( 'rev_page' => $this->title->getArticleID() ), |
| 352 | + array( 'rev_page' => $this->getTitle()->getArticleID() ), |
348 | 353 | $this->conds ), |
349 | 354 | 'options' => array( 'USE INDEX' => array( 'revision' => 'page_timestamp' ) ), |
350 | 355 | 'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ), |
— | — | @@ -370,7 +375,7 @@ |
371 | 376 | $firstInList = $this->counter == 1; |
372 | 377 | $this->counter++; |
373 | 378 | $s = $this->historyLine( $this->lastRow, $row, |
374 | | - $this->title->getNotificationTimestamp(), $latest, $firstInList ); |
| 379 | + $this->getTitle()->getNotificationTimestamp(), $latest, $firstInList ); |
375 | 380 | } else { |
376 | 381 | $s = ''; |
377 | 382 | } |
— | — | @@ -384,15 +389,15 @@ |
385 | 390 | * @return string HTML output |
386 | 391 | */ |
387 | 392 | function getStartBody() { |
388 | | - global $wgScript, $wgUser, $wgOut; |
| 393 | + global $wgScript; |
389 | 394 | $this->lastRow = false; |
390 | 395 | $this->counter = 1; |
391 | 396 | $this->oldIdChecked = 0; |
392 | 397 | |
393 | | - $wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' ); |
| 398 | + $this->getOutput()->wrapWikiMsg( "<div class='mw-history-legend'>\n$1\n</div>", 'histlegend' ); |
394 | 399 | $s = Html::openElement( 'form', array( 'action' => $wgScript, |
395 | 400 | 'id' => 'mw-history-compare' ) ) . "\n"; |
396 | | - $s .= Html::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n"; |
| 401 | + $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) . "\n"; |
397 | 402 | $s .= Html::hidden( 'action', 'historysubmit' ) . "\n"; |
398 | 403 | |
399 | 404 | $s .= '<div>' . $this->submitButton( wfMsg( 'compareselectedversions' ), |
— | — | @@ -404,7 +409,7 @@ |
405 | 410 | + Linker::tooltipAndAccesskeyAttribs( 'compareselectedversions' ) |
406 | 411 | ) . "\n"; |
407 | 412 | |
408 | | - if ( $wgUser->isAllowed( 'deleterevision' ) ) { |
| 413 | + if ( $this->getUser()->isAllowed( 'deleterevision' ) ) { |
409 | 414 | $s .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' ); |
410 | 415 | } |
411 | 416 | $this->buttons .= '</div>'; |
— | — | @@ -445,7 +450,7 @@ |
446 | 451 | } |
447 | 452 | $this->counter++; |
448 | 453 | $s = $this->historyLine( $this->lastRow, $next, |
449 | | - $this->title->getNotificationTimestamp(), $latest, $firstInList ); |
| 454 | + $this->getTitle()->getNotificationTimestamp(), $latest, $firstInList ); |
450 | 455 | } else { |
451 | 456 | $s = ''; |
452 | 457 | } |
— | — | @@ -489,9 +494,8 @@ |
490 | 495 | function historyLine( $row, $next, $notificationtimestamp = false, |
491 | 496 | $latest = false, $firstInList = false ) |
492 | 497 | { |
493 | | - global $wgUser, $wgLang; |
494 | 498 | $rev = new Revision( $row ); |
495 | | - $rev->setTitle( $this->title ); |
| 499 | + $rev->setTitle( $this->getTitle() ); |
496 | 500 | |
497 | 501 | $curlink = $this->curLink( $rev, $latest ); |
498 | 502 | $lastlink = $this->lastLink( $rev, $next ); |
— | — | @@ -508,7 +512,7 @@ |
509 | 513 | |
510 | 514 | $del = ''; |
511 | 515 | // Show checkboxes for each revision |
512 | | - if ( $wgUser->isAllowed( 'deleterevision' ) ) { |
| 516 | + if ( $this->getUser()->isAllowed( 'deleterevision' ) ) { |
513 | 517 | $this->preventClickjacking(); |
514 | 518 | // If revision was hidden from sysops, disable the checkbox |
515 | 519 | if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
— | — | @@ -519,15 +523,15 @@ |
520 | 524 | array( 'name' => 'ids[' . $rev->getId() . ']' ) ); |
521 | 525 | } |
522 | 526 | // User can only view deleted revisions... |
523 | | - } elseif ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) { |
| 527 | + } elseif ( $rev->getVisibility() && $this->getUser()->isAllowed( 'deletedhistory' ) ) { |
524 | 528 | // If revision was hidden from sysops, disable the link |
525 | 529 | if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
526 | | - $cdel = $this->getSkin()->revDeleteLinkDisabled( false ); |
| 530 | + $cdel = Linker::revDeleteLinkDisabled( false ); |
527 | 531 | // Otherwise, show the link... |
528 | 532 | } else { |
529 | 533 | $query = array( 'type' => 'revision', |
530 | | - 'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId() ); |
531 | | - $del .= $this->getSkin()->revDeleteLink( $query, |
| 534 | + 'target' => $this->getTitle()->getPrefixedDbkey(), 'ids' => $rev->getId() ); |
| 535 | + $del .= Linker::revDeleteLink( $query, |
532 | 536 | $rev->isDeleted( Revision::DELETED_RESTRICTED ), false ); |
533 | 537 | } |
534 | 538 | } |
— | — | @@ -535,12 +539,12 @@ |
536 | 540 | $s .= " $del "; |
537 | 541 | } |
538 | 542 | |
539 | | - $dirmark = $wgLang->getDirMark(); |
| 543 | + $dirmark = $this->getLang()->getDirMark(); |
540 | 544 | |
541 | 545 | $s .= " $link"; |
542 | 546 | $s .= $dirmark; |
543 | 547 | $s .= " <span class='history-user'>" . |
544 | | - $this->getSkin()->revUserTools( $rev, true ) . "</span>"; |
| 548 | + Linker::revUserTools( $rev, true ) . "</span>"; |
545 | 549 | $s .= $dirmark; |
546 | 550 | |
547 | 551 | if ( $rev->isMinor() ) { |
— | — | @@ -548,10 +552,10 @@ |
549 | 553 | } |
550 | 554 | |
551 | 555 | if ( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) { |
552 | | - $s .= ' ' . $this->getSkin()->formatRevisionSize( $size ); |
| 556 | + $s .= ' ' . Linker::formatRevisionSize( $size ); |
553 | 557 | } |
554 | 558 | |
555 | | - $s .= $this->getSkin()->revComment( $rev, false, true ); |
| 559 | + $s .= Linker::revComment( $rev, false, true ); |
556 | 560 | |
557 | 561 | if ( $notificationtimestamp && ( $row->rev_timestamp >= $notificationtimestamp ) ) { |
558 | 562 | $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>'; |
— | — | @@ -561,13 +565,13 @@ |
562 | 566 | |
563 | 567 | # Rollback and undo links |
564 | 568 | if ( !is_null( $next ) && is_object( $next ) ) { |
565 | | - if ( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) { |
| 569 | + if ( $latest && $this->getTitle()->userCan( 'rollback' ) && $this->getTitle()->userCan( 'edit' ) ) { |
566 | 570 | $this->preventClickjacking(); |
567 | 571 | $tools[] = '<span class="mw-rollback-link">' . |
568 | | - $this->getSkin()->buildRollbackLink( $rev ) . '</span>'; |
| 572 | + Linker::buildRollbackLink( $rev ) . '</span>'; |
569 | 573 | } |
570 | 574 | |
571 | | - if ( $this->title->quickUserCan( 'edit' ) |
| 575 | + if ( $this->getTitle()->quickUserCan( 'edit' ) |
572 | 576 | && !$rev->isDeleted( Revision::DELETED_TEXT ) |
573 | 577 | && !$next->rev_deleted & Revision::DELETED_TEXT ) |
574 | 578 | { |
— | — | @@ -575,8 +579,8 @@ |
576 | 580 | $undoTooltip = $latest |
577 | 581 | ? array( 'title' => wfMsg( 'tooltip-undo' ) ) |
578 | 582 | : array(); |
579 | | - $undolink = $this->getSkin()->link( |
580 | | - $this->title, |
| 583 | + $undolink = Linker::link( |
| 584 | + $this->getTitle(), |
581 | 585 | wfMsgHtml( 'editundo' ), |
582 | 586 | $undoTooltip, |
583 | 587 | array( |
— | — | @@ -591,7 +595,7 @@ |
592 | 596 | } |
593 | 597 | |
594 | 598 | if ( $tools ) { |
595 | | - $s .= ' (' . $wgLang->pipeList( $tools ) . ')'; |
| 599 | + $s .= ' (' . $this->getLang()->pipeList( $tools ) . ')'; |
596 | 600 | } |
597 | 601 | |
598 | 602 | # Tags |
— | — | @@ -616,12 +620,11 @@ |
617 | 621 | * @return String |
618 | 622 | */ |
619 | 623 | function revLink( $rev ) { |
620 | | - global $wgLang; |
621 | | - $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $rev->getTimestamp() ), true ); |
| 624 | + $date = $this->getLang()->timeanddate( wfTimestamp( TS_MW, $rev->getTimestamp() ), true ); |
622 | 625 | $date = htmlspecialchars( $date ); |
623 | 626 | if ( $rev->userCan( Revision::DELETED_TEXT ) ) { |
624 | | - $link = $this->getSkin()->link( |
625 | | - $this->title, |
| 627 | + $link = Linker::link( |
| 628 | + $this->getTitle(), |
626 | 629 | $date, |
627 | 630 | array(), |
628 | 631 | array( 'oldid' => $rev->getId() ), |
— | — | @@ -648,12 +651,12 @@ |
649 | 652 | if ( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) { |
650 | 653 | return $cur; |
651 | 654 | } else { |
652 | | - return $this->getSkin()->link( |
653 | | - $this->title, |
| 655 | + return Linker::link( |
| 656 | + $this->getTitle(), |
654 | 657 | $cur, |
655 | 658 | array(), |
656 | 659 | array( |
657 | | - 'diff' => $this->title->getLatestRevID(), |
| 660 | + 'diff' => $this->getTitle()->getLatestRevID(), |
658 | 661 | 'oldid' => $rev->getId() |
659 | 662 | ), |
660 | 663 | array( 'known', 'noclasses' ) |
— | — | @@ -677,8 +680,8 @@ |
678 | 681 | return $last; |
679 | 682 | } elseif ( $next === 'unknown' ) { |
680 | 683 | # Next row probably exists but is unknown, use an oldid=prev link |
681 | | - return $this->getSkin()->link( |
682 | | - $this->title, |
| 684 | + return Linker::link( |
| 685 | + $this->getTitle(), |
683 | 686 | $last, |
684 | 687 | array(), |
685 | 688 | array( |
— | — | @@ -692,8 +695,8 @@ |
693 | 696 | { |
694 | 697 | return $last; |
695 | 698 | } else { |
696 | | - return $this->getSkin()->link( |
697 | | - $this->title, |
| 699 | + return Linker::link( |
| 700 | + $this->getTitle(), |
698 | 701 | $last, |
699 | 702 | array(), |
700 | 703 | array( |
Index: branches/pageoutput/includes/AutoLoader.php |
— | — | @@ -773,6 +773,7 @@ |
774 | 774 | 'SpecialFilepath' => 'includes/specials/SpecialFilepath.php', |
775 | 775 | 'SpecialGlobalFileUsage' => 'includes/specials/SpecialGlobalFileUsage.php', |
776 | 776 | 'SpecialGlobalTemplateUsage' => 'includes/specials/SpecialGlobalTemplateUsage.php', |
| 777 | + 'SpecialHistory' => 'includes/specials/SpecialHistory.php', |
777 | 778 | 'SpecialImport' => 'includes/specials/SpecialImport.php', |
778 | 779 | 'SpecialListFiles' => 'includes/specials/SpecialListfiles.php', |
779 | 780 | 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php', |
Index: branches/pageoutput/includes/specials/SpecialHistory.php |
— | — | @@ -0,0 +1,51 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Implements Special:History |
| 5 | + * |
| 6 | + * This program is free software; you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation; either version 2 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License along |
| 17 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | + * http://www.gnu.org/copyleft/gpl.html |
| 20 | + * |
| 21 | + * @file |
| 22 | + * @ingroup SpecialPage |
| 23 | + */ |
| 24 | + |
| 25 | +/** |
| 26 | + * Implements Special:History |
| 27 | + * |
| 28 | + * @ingroup SpecialPage |
| 29 | + */ |
| 30 | +class SpecialHistory extends UnlistedSpecialPage { // XXX: Should this be listed or unlisted? |
| 31 | + |
| 32 | + function __construct() { |
| 33 | + parent::__construct( 'History' ); |
| 34 | + } |
| 35 | + |
| 36 | + function execute( $par ) { |
| 37 | + $title = Title::newFromText( $par ); |
| 38 | + if ( $title ) { |
| 39 | + // @fixme Instead of this create a method to create a RequestContext based on another |
| 40 | + $context = new RequestContext; |
| 41 | + $context->setTitle( $title ); |
| 42 | + $context->setUser( $this->getUser() ); |
| 43 | + $context->setRequest( new FauxRequest( array() ) ); |
| 44 | + $context->setOutput( $this->getOutput() ); |
| 45 | + $history = new HistoryPage( $context ); |
| 46 | + $history->history(); |
| 47 | + } |
| 48 | + |
| 49 | + |
| 50 | + } |
| 51 | + |
| 52 | +} |
Property changes on: branches/pageoutput/includes/specials/SpecialHistory.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 53 | + native |
Index: branches/pageoutput/languages/messages/MessagesEn.php |
— | — | @@ -390,6 +390,7 @@ |
391 | 391 | 'Fewestrevisions' => array( 'FewestRevisions' ), |
392 | 392 | 'FileDuplicateSearch' => array( 'FileDuplicateSearch' ), |
393 | 393 | 'Filepath' => array( 'FilePath' ), |
| 394 | + 'History' => array( 'History' ), |
394 | 395 | 'Import' => array( 'Import' ), |
395 | 396 | 'Invalidateemail' => array( 'InvalidateEmail' ), |
396 | 397 | 'BlockList' => array( 'BlockList', 'ListBlocks', 'IPBlockList' ), |