$this->usercss = false;
}
+ /**
+ * Whether the revision displayed is the latest revision of the page
+ *
+ * @return Boolean
+ */
+ public function isRevisionCurrent() {
+ return $this->mRevisionId == 0 || $this->mRevisionId != $this->mTitle->getLatestRevID();
+ }
+
/**
* Set the title
* @param $t Title object to use
* You will only be adding bloat to the page and causing page caches to have to be purged on configuration changes.
*/
static function makeGlobalVariablesScript( $skinName ) {
- global $wgTitle, $wgUser, $wgRequest, $wgArticle, $wgOut, $wgUseAjax, $wgEnableMWSuggest;
+ global $wgTitle, $wgUser, $wgRequest, $wgOut, $wgUseAjax, $wgEnableMWSuggest;
$ns = $wgTitle->getNamespace();
$nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $wgTitle->getNsText();
'wgIsArticle' => $wgOut->isArticle(),
'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(),
'wgUserGroups' => $wgUser->getEffectiveGroups(),
- 'wgCurRevisionId' => isset( $wgArticle ) ? $wgArticle->getLatest() : 0,
+ 'wgCurRevisionId' => $wgTitle->getLatestRevID(),
'wgCategories' => $wgOut->getCategories(),
'wgBreakFrames' => $wgOut->getFrameOptions() == 'DENY',
);
global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgPageShowWatchingUsers;
- $oldid = $wgRequest->getVal( 'oldid' );
- $diff = $wgRequest->getVal( 'diff' );
-
- if ( !$wgOut->isArticle() ) {
+ if ( !is_null( $wgRequest->getVal( 'oldid' ) ) || !is_null( $wgRequest->getVal( 'diff' ) ) ) {
return '';
}
- if ( !$wgArticle instanceof Article ) {
- return '';
- }
-
- if ( isset( $oldid ) || isset( $diff ) ) {
- return '';
- }
-
- if ( 0 == $wgArticle->getID() ) {
+ if ( !$wgOut->isArticle() || !$this->mTitle->exists() ) {
return '';
}
}
function getCopyright( $type = 'detect' ) {
- global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest, $wgArticle;
+ global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgRequest;
if ( $type == 'detect' ) {
$diff = $wgRequest->getVal( 'diff' );
- $isCur = $wgArticle && $wgArticle->isCurrent();
- if ( is_null( $diff ) && !$isCur && wfMsgForContent( 'history_copyright' ) !== '-' ) {
+ if ( is_null( $diff ) && !$this->isRevisionCurrent() && wfMsgForContent( 'history_copyright' ) !== '-' ) {
$type = 'history';
} else {
$type = 'normal';
function lastModified() {
global $wgLang, $wgArticle;
- if ( $this->mRevisionId && $this->mRevisionId != $wgArticle->getLatest() ) {
- $timestamp = Revision::getTimestampFromId( $wgArticle->getTitle(), $this->mRevisionId );
+ if ( !$this->isRevisionCurrent() ) {
+ $timestamp = Revision::getTimestampFromId( $this->mTitle, $this->mRevisionId );
} else {
$timestamp = $wgArticle->getTimestamp();
}
* @private
*/
function editUrlOptions() {
- global $wgArticle;
-
$options = array( 'action' => 'edit' );
- if ( $this->mRevisionId && ! $wgArticle->isCurrent() ) {
+ if ( !$this->isRevisionCurrent() ) {
$options['oldid'] = intval( $this->mRevisionId );
}
$tpl->set( 'titleprefixeddbkey', $this->mTitle->getPrefixedDBKey() );
$tpl->set( 'titletext', $this->mTitle->getText() );
$tpl->set( 'articleid', $this->mTitle->getArticleId() );
- $tpl->set( 'currevisionid', isset( $wgArticle ) ? $wgArticle->getLatest() : 0 );
+ $tpl->set( 'currevisionid', $this->mTitle->getLatestRevID() );
$tpl->set( 'isarticle', $out->isArticle() );
$tpl->setRef( 'skin', $this );
$tpl->set( 'logo', $this->logoText() );
if ( $out->isArticle() && ( !isset( $oldid ) || isset( $diff ) ) &&
- $wgArticle && 0 != $wgArticle->getID() ){
+ $this->mTitle->exists() ){
if ( !$wgDisableCounters ) {
$viewcount = $wgLang->formatNum( $wgArticle->getCount() );
if ( $viewcount ) {
* @private
*/
function buildContentNavigationUrls() {
- global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle;
+ global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest;
global $wgDisableLangConversion;
wfProfileIn( __METHOD__ );
);
// Checks if this is a current rev of talk page and we should show a new
// section link
- if ( ( $isTalk && $wgArticle && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
+ if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
// Checks if we should ever show a new section link
if ( !$wgOut->forceHideNewSectionLink() ) {
// Adds new section link