Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -245,7 +245,7 @@ |
246 | 246 | $tpl->set( 'titleprefixeddbkey', $this->mTitle->getPrefixedDBKey() ); |
247 | 247 | $tpl->set( 'titletext', $this->mTitle->getText() ); |
248 | 248 | $tpl->set( 'articleid', $this->mTitle->getArticleId() ); |
249 | | - $tpl->set( 'currevisionid', isset( $wgArticle ) ? $wgArticle->getLatest() : 0 ); |
| 249 | + $tpl->set( 'currevisionid', $this->mTitle->getLatestRevID() ); |
250 | 250 | |
251 | 251 | $tpl->set( 'isarticle', $out->isArticle() ); |
252 | 252 | |
— | — | @@ -345,7 +345,7 @@ |
346 | 346 | $tpl->setRef( 'skin', $this ); |
347 | 347 | $tpl->set( 'logo', $this->logoText() ); |
348 | 348 | if ( $out->isArticle() && ( !isset( $oldid ) || isset( $diff ) ) && |
349 | | - $wgArticle && 0 != $wgArticle->getID() ){ |
| 349 | + $this->mTitle->exists() ){ |
350 | 350 | if ( !$wgDisableCounters ) { |
351 | 351 | $viewcount = $wgLang->formatNum( $wgArticle->getCount() ); |
352 | 352 | if ( $viewcount ) { |
— | — | @@ -784,7 +784,7 @@ |
785 | 785 | * @private |
786 | 786 | */ |
787 | 787 | function buildContentNavigationUrls() { |
788 | | - global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle; |
| 788 | + global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest; |
789 | 789 | global $wgDisableLangConversion; |
790 | 790 | |
791 | 791 | wfProfileIn( __METHOD__ ); |
— | — | @@ -879,7 +879,7 @@ |
880 | 880 | ); |
881 | 881 | // Checks if this is a current rev of talk page and we should show a new |
882 | 882 | // section link |
883 | | - if ( ( $isTalk && $wgArticle && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
| 883 | + if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $wgOut->showNewSectionLink() ) ) { |
884 | 884 | // Checks if we should ever show a new section link |
885 | 885 | if ( !$wgOut->forceHideNewSectionLink() ) { |
886 | 886 | // Adds new section link |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -355,6 +355,15 @@ |
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
| 359 | + * Whether the revision displayed is the latest revision of the page |
| 360 | + * |
| 361 | + * @return Boolean |
| 362 | + */ |
| 363 | + public function isRevisionCurrent() { |
| 364 | + return $this->mRevisionId == 0 || $this->mRevisionId != $this->mTitle->getLatestRevID(); |
| 365 | + } |
| 366 | + |
| 367 | + /** |
359 | 368 | * Set the title |
360 | 369 | * @param $t Title object to use |
361 | 370 | */ |
— | — | @@ -484,7 +493,7 @@ |
485 | 494 | * You will only be adding bloat to the page and causing page caches to have to be purged on configuration changes. |
486 | 495 | */ |
487 | 496 | static function makeGlobalVariablesScript( $skinName ) { |
488 | | - global $wgTitle, $wgUser, $wgRequest, $wgArticle, $wgOut, $wgUseAjax, $wgEnableMWSuggest; |
| 497 | + global $wgTitle, $wgUser, $wgRequest, $wgOut, $wgUseAjax, $wgEnableMWSuggest; |
489 | 498 | |
490 | 499 | $ns = $wgTitle->getNamespace(); |
491 | 500 | $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $wgTitle->getNsText(); |
— | — | @@ -500,7 +509,7 @@ |
501 | 510 | 'wgIsArticle' => $wgOut->isArticle(), |
502 | 511 | 'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(), |
503 | 512 | 'wgUserGroups' => $wgUser->getEffectiveGroups(), |
504 | | - 'wgCurRevisionId' => isset( $wgArticle ) ? $wgArticle->getLatest() : 0, |
| 513 | + 'wgCurRevisionId' => $wgTitle->getLatestRevID(), |
505 | 514 | 'wgCategories' => $wgOut->getCategories(), |
506 | 515 | 'wgBreakFrames' => $wgOut->getFrameOptions() == 'DENY', |
507 | 516 | ); |
— | — | @@ -1473,25 +1482,14 @@ |
1474 | 1483 | global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser; |
1475 | 1484 | global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers; |
1476 | 1485 | |
1477 | | - $oldid = $wgRequest->getVal( 'oldid' ); |
1478 | | - $diff = $wgRequest->getVal( 'diff' ); |
1479 | | - |
1480 | | - if ( !$wgOut->isArticle() ) { |
| 1486 | + if ( !is_null( $wgRequest->getVal( 'oldid' ) ) || !is_null( $wgRequest->getVal( 'diff' ) ) ) { |
1481 | 1487 | return ''; |
1482 | 1488 | } |
1483 | 1489 | |
1484 | | - if ( !$wgArticle instanceof Article ) { |
| 1490 | + if ( !$wgOut->isArticle() || !$this->mTitle->exists() ) { |
1485 | 1491 | return ''; |
1486 | 1492 | } |
1487 | 1493 | |
1488 | | - if ( isset( $oldid ) || isset( $diff ) ) { |
1489 | | - return ''; |
1490 | | - } |
1491 | | - |
1492 | | - if ( 0 == $wgArticle->getID() ) { |
1493 | | - return ''; |
1494 | | - } |
1495 | | - |
1496 | 1494 | $s = ''; |
1497 | 1495 | |
1498 | 1496 | if ( !$wgDisableCounters ) { |
— | — | @@ -1530,13 +1528,12 @@ |
1531 | 1529 | } |
1532 | 1530 | |
1533 | 1531 | function getCopyright( $type = 'detect' ) { |
1534 | | - global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest, $wgArticle; |
| 1532 | + global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest; |
1535 | 1533 | |
1536 | 1534 | if ( $type == 'detect' ) { |
1537 | 1535 | $diff = $wgRequest->getVal( 'diff' ); |
1538 | | - $isCur = $wgArticle && $wgArticle->isCurrent(); |
1539 | 1536 | |
1540 | | - if ( is_null( $diff ) && !$isCur && wfMsgForContent( 'history_copyright' ) !== '-' ) { |
| 1537 | + if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) { |
1541 | 1538 | $type = 'history'; |
1542 | 1539 | } else { |
1543 | 1540 | $type = 'normal'; |
— | — | @@ -1619,8 +1616,8 @@ |
1620 | 1617 | function lastModified() { |
1621 | 1618 | global $wgLang, $wgArticle; |
1622 | 1619 | |
1623 | | - if ( $this->mRevisionId && $this->mRevisionId != $wgArticle->getLatest() ) { |
1624 | | - $timestamp = Revision::getTimestampFromId( $wgArticle->getTitle(), $this->mRevisionId ); |
| 1620 | + if ( !$this->isRevisionCurrent() ) { |
| 1621 | + $timestamp = Revision::getTimestampFromId( $this->mTitle, $this->mRevisionId ); |
1625 | 1622 | } else { |
1626 | 1623 | $timestamp = $wgArticle->getTimestamp(); |
1627 | 1624 | } |
— | — | @@ -1803,11 +1800,9 @@ |
1804 | 1801 | * @private |
1805 | 1802 | */ |
1806 | 1803 | function editUrlOptions() { |
1807 | | - global $wgArticle; |
1808 | | - |
1809 | 1804 | $options = array( 'action' => 'edit' ); |
1810 | 1805 | |
1811 | | - if ( $this->mRevisionId && ! $wgArticle->isCurrent() ) { |
| 1806 | + if ( !$this->isRevisionCurrent() ) { |
1812 | 1807 | $options['oldid'] = intval( $this->mRevisionId ); |
1813 | 1808 | } |
1814 | 1809 | |