Index: trunk/phase3/includes/Article.php |
— | — | @@ -17,8 +17,12 @@ |
18 | 18 | /**@{{ |
19 | 19 | * @private |
20 | 20 | */ |
21 | | - protected $mContext; // !< RequestContext |
22 | 21 | |
| 22 | + /** |
| 23 | + * @var RequestContext |
| 24 | + */ |
| 25 | + protected $mContext; |
| 26 | + |
23 | 27 | var $mContent; // !< |
24 | 28 | var $mContentLoaded = false; // !< |
25 | 29 | var $mCounter = -1; // !< Not loaded |
— | — | @@ -28,19 +32,49 @@ |
29 | 33 | var $mIsRedirect = false; // !< |
30 | 34 | var $mLatest = false; // !< |
31 | 35 | var $mOldId; // !< |
32 | | - var $mPreparedEdit = false; // !< Title object if set |
33 | | - var $mRedirectedFrom = null; // !< Title object if set |
34 | | - var $mRedirectTarget = null; // !< Title object if set |
| 36 | + var $mPreparedEdit = false; |
| 37 | + |
| 38 | + /** |
| 39 | + * @var Title |
| 40 | + */ |
| 41 | + var $mRedirectedFrom = null; |
| 42 | + |
| 43 | + /** |
| 44 | + * @var Title |
| 45 | + */ |
| 46 | + var $mRedirectTarget = null; |
| 47 | + |
| 48 | + /** |
| 49 | + * @var Title |
| 50 | + */ |
35 | 51 | var $mRedirectUrl = false; // !< |
36 | 52 | var $mRevIdFetched = 0; // !< |
37 | | - var $mLastRevision = null; // !< Latest revision if set |
38 | | - var $mRevision = null; // !< Loaded revision object if set |
| 53 | + |
| 54 | + /** |
| 55 | + * @var Revision |
| 56 | + */ |
| 57 | + var $mLastRevision = null; |
| 58 | + |
| 59 | + /** |
| 60 | + * @var Revision |
| 61 | + */ |
| 62 | + var $mRevision = null; |
| 63 | + |
39 | 64 | var $mTimestamp = ''; // !< |
40 | 65 | var $mTitle; // !< Title object |
41 | 66 | var $mTotalAdjustment = 0; // !< |
42 | 67 | var $mTouched = '19700101000000'; // !< |
43 | | - var $mParserOptions; // !< ParserOptions object |
44 | | - var $mParserOutput; // !< ParserCache object if set |
| 68 | + |
| 69 | + /** |
| 70 | + * @var ParserOptions |
| 71 | + */ |
| 72 | + var $mParserOptions; |
| 73 | + |
| 74 | + /** |
| 75 | + * @var ParserOutput |
| 76 | + */ |
| 77 | + var $mParserOutput; |
| 78 | + |
45 | 79 | /**@}}*/ |
46 | 80 | |
47 | 81 | /** |
— | — | @@ -424,7 +458,7 @@ |
425 | 459 | |
426 | 460 | /** |
427 | 461 | * Fetch a page record with the given conditions |
428 | | - * @param $dbr Database object |
| 462 | + * @param $dbr DatabaseBase object |
429 | 463 | * @param $conditions Array |
430 | 464 | * @return mixed Database result resource, or false on failure |
431 | 465 | */ |
— | — | @@ -444,7 +478,7 @@ |
445 | 479 | * Fetch a page record matching the Title object's namespace and title |
446 | 480 | * using a sanitized title string |
447 | 481 | * |
448 | | - * @param $dbr Database object |
| 482 | + * @param $dbr DatabaseBase object |
449 | 483 | * @param $title Title object |
450 | 484 | * @return mixed Database result resource, or false on failure |
451 | 485 | */ |
— | — | @@ -457,7 +491,7 @@ |
458 | 492 | /** |
459 | 493 | * Fetch a page record matching the requested ID |
460 | 494 | * |
461 | | - * @param $dbr Database |
| 495 | + * @param $dbr DatabaseBase |
462 | 496 | * @param $id Integer |
463 | 497 | * @return mixed Database result resource, or false on failure |
464 | 498 | */ |
— | — | @@ -469,7 +503,7 @@ |
470 | 504 | * Set the general counter, title etc data loaded from |
471 | 505 | * some source. |
472 | 506 | * |
473 | | - * @param $data Database row object or "fromdb" |
| 507 | + * @param $data Object|String $res->fetchObject() object or the string "fromdb" to reload |
474 | 508 | */ |
475 | 509 | public function loadPageData( $data = 'fromdb' ) { |
476 | 510 | if ( $data === 'fromdb' ) { |
— | — | @@ -1225,7 +1259,7 @@ |
1226 | 1260 | * @return boolean |
1227 | 1261 | */ |
1228 | 1262 | public function showRedirectedFromHeader() { |
1229 | | - global $wgOut, $wgUser, $wgRequest, $wgRedirectSources; |
| 1263 | + global $wgOut, $wgRequest, $wgRedirectSources; |
1230 | 1264 | |
1231 | 1265 | $rdfrom = $wgRequest->getVal( 'rdfrom' ); |
1232 | 1266 | |
— | — | @@ -1233,7 +1267,7 @@ |
1234 | 1268 | // This is an internally redirected page view. |
1235 | 1269 | // We'll need a backlink to the source page for navigation. |
1236 | 1270 | if ( wfRunHooks( 'ArticleViewRedirect', array( &$this ) ) ) { |
1237 | | - $redir = $wgUser->getSkin()->link( |
| 1271 | + $redir = Linker::link( |
1238 | 1272 | $this->mRedirectedFrom, |
1239 | 1273 | null, |
1240 | 1274 | array(), |
— | — | @@ -1261,7 +1295,7 @@ |
1262 | 1296 | // This is an externally redirected view, from some other wiki. |
1263 | 1297 | // If it was reported from a trusted site, supply a backlink. |
1264 | 1298 | if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) { |
1265 | | - $redir = $wgUser->getSkin()->makeExternalLink( $rdfrom, $rdfrom ); |
| 1299 | + $redir = Linker::makeExternalLink( $rdfrom, $rdfrom ); |
1266 | 1300 | $s = wfMsgExt( 'redirectedfrom', array( 'parseinline', 'replaceafter' ), $redir ); |
1267 | 1301 | $wgOut->setSubtitle( $s ); |
1268 | 1302 | |
— | — | @@ -1324,7 +1358,6 @@ |
1325 | 1359 | return; |
1326 | 1360 | } |
1327 | 1361 | |
1328 | | - $sk = $wgUser->getSkin(); |
1329 | 1362 | $token = $wgUser->editToken( $rcid ); |
1330 | 1363 | $wgOut->preventClickjacking(); |
1331 | 1364 | |
— | — | @@ -1332,7 +1365,7 @@ |
1333 | 1366 | "<div class='patrollink'>" . |
1334 | 1367 | wfMsgHtml( |
1335 | 1368 | 'markaspatrolledlink', |
1336 | | - $sk->link( |
| 1369 | + Linker::link( |
1337 | 1370 | $this->mTitle, |
1338 | 1371 | wfMsgHtml( 'markaspatrolledtext' ), |
1339 | 1372 | array(), |
— | — | @@ -1550,7 +1583,7 @@ |
1551 | 1584 | * @return string containing HMTL with redirect link |
1552 | 1585 | */ |
1553 | 1586 | public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) { |
1554 | | - global $wgOut, $wgContLang, $wgStylePath, $wgUser; |
| 1587 | + global $wgOut, $wgContLang, $wgStylePath; |
1555 | 1588 | |
1556 | 1589 | if ( !is_array( $target ) ) { |
1557 | 1590 | $target = array( $target ); |
— | — | @@ -1562,14 +1595,13 @@ |
1563 | 1596 | $wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) ); |
1564 | 1597 | } |
1565 | 1598 | |
1566 | | - $sk = $wgUser->getSkin(); |
1567 | 1599 | // the loop prepends the arrow image before the link, so the first case needs to be outside |
1568 | 1600 | $title = array_shift( $target ); |
1569 | 1601 | |
1570 | 1602 | if ( $forceKnown ) { |
1571 | | - $link = $sk->linkKnown( $title, htmlspecialchars( $title->getFullText() ) ); |
| 1603 | + $link = Linker::linkKnown( $title, htmlspecialchars( $title->getFullText() ) ); |
1572 | 1604 | } else { |
1573 | | - $link = $sk->link( $title, htmlspecialchars( $title->getFullText() ) ); |
| 1605 | + $link = Linker::link( $title, htmlspecialchars( $title->getFullText() ) ); |
1574 | 1606 | } |
1575 | 1607 | |
1576 | 1608 | $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png'; |
— | — | @@ -1578,9 +1610,9 @@ |
1579 | 1611 | foreach ( $target as $rt ) { |
1580 | 1612 | $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) ); |
1581 | 1613 | if ( $forceKnown ) { |
1582 | | - $link .= $sk->linkKnown( $rt, htmlspecialchars( $rt->getFullText(), array(), array( 'redirect' => 'no' ) ) ); |
| 1614 | + $link .= Linker::linkKnown( $rt, htmlspecialchars( $rt->getFullText(), array(), array( 'redirect' => 'no' ) ) ); |
1583 | 1615 | } else { |
1584 | | - $link .= $sk->link( $rt, htmlspecialchars( $rt->getFullText() ), array(), array( 'redirect' => 'no' ) ); |
| 1616 | + $link .= Linker::link( $rt, htmlspecialchars( $rt->getFullText() ), array(), array( 'redirect' => 'no' ) ); |
1585 | 1617 | } |
1586 | 1618 | } |
1587 | 1619 | |
— | — | @@ -1801,7 +1833,7 @@ |
1802 | 1834 | /** |
1803 | 1835 | * Add row to the redirect table if this is a redirect, remove otherwise. |
1804 | 1836 | * |
1805 | | - * @param $dbw Database |
| 1837 | + * @param $dbw DatabaseBase |
1806 | 1838 | * @param $redirectTitle Title object pointing to the redirect target, |
1807 | 1839 | * or NULL if this is not a redirect |
1808 | 1840 | * @param $lastRevIsRedirect If given, will optimize adding and |
— | — | @@ -2299,7 +2331,7 @@ |
2300 | 2332 | if ( in_array( array( 'markedaspatrollederror-noautopatrol' ), $errors ) ) { |
2301 | 2333 | $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) ); |
2302 | 2334 | $wgOut->addWikiMsg( 'markedaspatrollederror-noautopatrol' ); |
2303 | | - $wgOut->returnToMain( false, $return ); |
| 2335 | + $wgOut->returnToMain( null, $return ); |
2304 | 2336 | |
2305 | 2337 | return; |
2306 | 2338 | } |
— | — | @@ -2313,7 +2345,7 @@ |
2314 | 2346 | # Inform the user |
2315 | 2347 | $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) ); |
2316 | 2348 | $wgOut->addWikiMsg( 'markedaspatrolledtext', $rc->getTitle()->getPrefixedText() ); |
2317 | | - $wgOut->returnToMain( false, $return ); |
| 2349 | + $wgOut->returnToMain( null, $return ); |
2318 | 2350 | } |
2319 | 2351 | |
2320 | 2352 | /** |
— | — | @@ -2770,12 +2802,11 @@ |
2771 | 2803 | if ( $hasHistory && !$confirm ) { |
2772 | 2804 | global $wgLang; |
2773 | 2805 | |
2774 | | - $skin = $wgOut->getSkin(); |
2775 | 2806 | $revisions = $this->estimateRevisionCount(); |
2776 | 2807 | //FIXME: lego |
2777 | 2808 | $wgOut->addHTML( '<strong class="mw-delete-warning-revisions">' . |
2778 | 2809 | wfMsgExt( 'historywarning', array( 'parseinline' ), $wgLang->formatNum( $revisions ) ) . |
2779 | | - wfMsgHtml( 'word-separator' ) . $skin->link( $this->mTitle, |
| 2810 | + wfMsgHtml( 'word-separator' ) . Linker::link( $this->mTitle, |
2780 | 2811 | wfMsgHtml( 'history' ), |
2781 | 2812 | array( 'rel' => 'archives' ), |
2782 | 2813 | array( 'action' => 'history' ) ) . |
— | — | @@ -2882,7 +2913,7 @@ |
2883 | 2914 | |
2884 | 2915 | wfDebug( "Article::confirmDelete\n" ); |
2885 | 2916 | |
2886 | | - $deleteBackLink = $wgOut->getSkin()->linkKnown( $this->mTitle ); |
| 2917 | + $deleteBackLink = Linker::linkKnown( $this->mTitle ); |
2887 | 2918 | $wgOut->setSubtitle( wfMsgHtml( 'delete-backlink', $deleteBackLink ) ); |
2888 | 2919 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
2889 | 2920 | $wgOut->addWikiMsg( 'confirmdeletetext' ); |
— | — | @@ -2959,9 +2990,8 @@ |
2960 | 2991 | Xml::closeElement( 'form' ); |
2961 | 2992 | |
2962 | 2993 | if ( $wgOut->getUser()->isAllowed( 'editinterface' ) ) { |
2963 | | - $skin = $wgOut->getSkin(); |
2964 | 2994 | $title = Title::makeTitle( NS_MEDIAWIKI, 'Deletereason-dropdown' ); |
2965 | | - $link = $skin->link( |
| 2995 | + $link = Linker::link( |
2966 | 2996 | $title, |
2967 | 2997 | wfMsgHtml( 'delete-edit-reasonlist' ), |
2968 | 2998 | array(), |
— | — | @@ -3378,7 +3408,7 @@ |
3379 | 3409 | |
3380 | 3410 | if ( $current->getComment() != '' ) { |
3381 | 3411 | $wgOut->addWikiMsgArray( 'editcomment', array( |
3382 | | - $wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) ); |
| 3412 | + Linker::formatComment( $current->getComment() ) ), array( 'replaceafter' ) ); |
3383 | 3413 | } |
3384 | 3414 | } |
3385 | 3415 | |
— | — | @@ -3417,12 +3447,12 @@ |
3418 | 3448 | if ( $current->getUserText() === '' ) { |
3419 | 3449 | $old = wfMsg( 'rev-deleted-user' ); |
3420 | 3450 | } else { |
3421 | | - $old = $wgUser->getSkin()->userLink( $current->getUser(), $current->getUserText() ) |
3422 | | - . $wgUser->getSkin()->userToolLinks( $current->getUser(), $current->getUserText() ); |
| 3451 | + $old = Linker::userLink( $current->getUser(), $current->getUserText() ) |
| 3452 | + . Linker::userToolLinks( $current->getUser(), $current->getUserText() ); |
3423 | 3453 | } |
3424 | 3454 | |
3425 | | - $new = $wgUser->getSkin()->userLink( $target->getUser(), $target->getUserText() ) |
3426 | | - . $wgUser->getSkin()->userToolLinks( $target->getUser(), $target->getUserText() ); |
| 3455 | + $new = Linker::userLink( $target->getUser(), $target->getUserText() ) |
| 3456 | + . Linker::userToolLinks( $target->getUser(), $target->getUserText() ); |
3427 | 3457 | $wgOut->addHTML( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) ); |
3428 | 3458 | $wgOut->returnToMain( false, $this->mTitle ); |
3429 | 3459 | |
— | — | @@ -3630,10 +3660,10 @@ |
3631 | 3661 | $td = $wgLang->timeanddate( $timestamp, true ); |
3632 | 3662 | $tddate = $wgLang->date( $timestamp, true ); |
3633 | 3663 | $tdtime = $wgLang->time( $timestamp, true ); |
3634 | | - $sk = $wgUser->getSkin(); |
| 3664 | + |
3635 | 3665 | $lnk = $current |
3636 | 3666 | ? wfMsgHtml( 'currentrevisionlink' ) |
3637 | | - : $sk->link( |
| 3667 | + : Linker::link( |
3638 | 3668 | $this->mTitle, |
3639 | 3669 | wfMsgHtml( 'currentrevisionlink' ), |
3640 | 3670 | array(), |
— | — | @@ -3642,7 +3672,7 @@ |
3643 | 3673 | ); |
3644 | 3674 | $curdiff = $current |
3645 | 3675 | ? wfMsgHtml( 'diff' ) |
3646 | | - : $sk->link( |
| 3676 | + : Linker::link( |
3647 | 3677 | $this->mTitle, |
3648 | 3678 | wfMsgHtml( 'diff' ), |
3649 | 3679 | array(), |
— | — | @@ -3654,7 +3684,7 @@ |
3655 | 3685 | ); |
3656 | 3686 | $prev = $this->mTitle->getPreviousRevisionID( $oldid ) ; |
3657 | 3687 | $prevlink = $prev |
3658 | | - ? $sk->link( |
| 3688 | + ? Linker::link( |
3659 | 3689 | $this->mTitle, |
3660 | 3690 | wfMsgHtml( 'previousrevision' ), |
3661 | 3691 | array(), |
— | — | @@ -3666,7 +3696,7 @@ |
3667 | 3697 | ) |
3668 | 3698 | : wfMsgHtml( 'previousrevision' ); |
3669 | 3699 | $prevdiff = $prev |
3670 | | - ? $sk->link( |
| 3700 | + ? Linker::link( |
3671 | 3701 | $this->mTitle, |
3672 | 3702 | wfMsgHtml( 'diff' ), |
3673 | 3703 | array(), |
— | — | @@ -3679,7 +3709,7 @@ |
3680 | 3710 | : wfMsgHtml( 'diff' ); |
3681 | 3711 | $nextlink = $current |
3682 | 3712 | ? wfMsgHtml( 'nextrevision' ) |
3683 | | - : $sk->link( |
| 3713 | + : Linker::link( |
3684 | 3714 | $this->mTitle, |
3685 | 3715 | wfMsgHtml( 'nextrevision' ), |
3686 | 3716 | array(), |
— | — | @@ -3691,7 +3721,7 @@ |
3692 | 3722 | ); |
3693 | 3723 | $nextdiff = $current |
3694 | 3724 | ? wfMsgHtml( 'diff' ) |
3695 | | - : $sk->link( |
| 3725 | + : Linker::link( |
3696 | 3726 | $this->mTitle, |
3697 | 3727 | wfMsgHtml( 'diff' ), |
3698 | 3728 | array(), |
— | — | @@ -3708,20 +3738,20 @@ |
3709 | 3739 | $canHide = $wgUser->isAllowed( 'deleterevision' ); |
3710 | 3740 | if ( $canHide || ( $revision->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) { |
3711 | 3741 | if ( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) { |
3712 | | - $cdel = $sk->revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops |
| 3742 | + $cdel = Linker::revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops |
3713 | 3743 | } else { |
3714 | 3744 | $query = array( |
3715 | 3745 | 'type' => 'revision', |
3716 | 3746 | 'target' => $this->mTitle->getPrefixedDbkey(), |
3717 | 3747 | 'ids' => $oldid |
3718 | 3748 | ); |
3719 | | - $cdel = $sk->revDeleteLink( $query, $revision->isDeleted( File::DELETED_RESTRICTED ), $canHide ); |
| 3749 | + $cdel = Linker::revDeleteLink( $query, $revision->isDeleted( File::DELETED_RESTRICTED ), $canHide ); |
3720 | 3750 | } |
3721 | 3751 | $cdel .= ' '; |
3722 | 3752 | } |
3723 | 3753 | |
3724 | 3754 | # Show user links if allowed to see them. If hidden, then show them only if requested... |
3725 | | - $userlinks = $sk->revUserTools( $revision, !$unhide ); |
| 3755 | + $userlinks = Linker::revUserTools( $revision, !$unhide ); |
3726 | 3756 | |
3727 | 3757 | $infomsg = $current && !wfMessage( 'revision-info-current' )->isDisabled() |
3728 | 3758 | ? 'revision-info-current' |
— | — | @@ -3918,6 +3948,8 @@ |
3919 | 3949 | |
3920 | 3950 | /** |
3921 | 3951 | * Clears caches when article is deleted |
| 3952 | + * |
| 3953 | + * @param $title Title |
3922 | 3954 | */ |
3923 | 3955 | public static function onArticleDelete( $title ) { |
3924 | 3956 | # Update existence markers on article/talk tabs... |
— | — | @@ -4284,7 +4316,7 @@ |
4285 | 4317 | /** |
4286 | 4318 | * Updates cascading protections |
4287 | 4319 | * |
4288 | | - * @param $parserOutput mixed ParserOptions object, or boolean false |
| 4320 | + * @param $parserOutput ParserOutput object, or boolean false |
4289 | 4321 | **/ |
4290 | 4322 | protected function doCascadeProtectionUpdates( $parserOutput ) { |
4291 | 4323 | if ( !$this->isCurrent() || wfReadOnly() || !$this->mTitle->areRestrictionsCascading() ) { |
— | — | @@ -4469,6 +4501,10 @@ |
4470 | 4502 | } |
4471 | 4503 | |
4472 | 4504 | class PoolWorkArticleView extends PoolCounterWork { |
| 4505 | + |
| 4506 | + /** |
| 4507 | + * @var Article |
| 4508 | + */ |
4473 | 4509 | private $mArticle; |
4474 | 4510 | |
4475 | 4511 | function __construct( $article, $key, $useParserCache, $parserOptions ) { |
— | — | @@ -4503,6 +4539,9 @@ |
4504 | 4540 | return $this->mArticle->tryDirtyCache(); |
4505 | 4541 | } |
4506 | 4542 | |
| 4543 | + /** |
| 4544 | + * @param $status Status |
| 4545 | + */ |
4507 | 4546 | function error( $status ) { |
4508 | 4547 | global $wgOut; |
4509 | 4548 | |