From: Kunal Mehta Date: Tue, 17 Feb 2015 22:04:36 +0000 (-0800) Subject: skin: Use Title::isKnown() / Title::exists() instead of Title::getArticleID() X-Git-Tag: 1.31.0-rc.0~12379^2 X-Git-Url: http://git.cyclocoop.org/%27.%28%24current%20%3E%202?a=commitdiff_plain;h=f16c92bdff44794dd698a691b6ad25dcaa059c90;p=lhc%2Fweb%2Fwiklou.git skin: Use Title::isKnown() / Title::exists() instead of Title::getArticleID() Some of these calls pre-date the existence of isKnown() and exists(), which should be used instead of calling getArticleID() directly. For places where we're just trying to determine link color, I used isKnown(), and for other places we're trying to figure out where an article exists, I used exists(). Bug: T85550 Change-Id: I47c8af8485857cc0f3190b4ada1578ab672580af --- diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 6cc139bfb5..c858cfa696 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -656,7 +656,7 @@ abstract class Skin extends ContextSource { $action = $this->getRequest()->getVal( 'action', 'view' ); if ( $this->getTitle()->userCan( 'deletedhistory', $this->getUser() ) && - ( $this->getTitle()->getArticleID() == 0 || $action == 'history' ) ) { + ( !$this->getTitle()->exists() || $action == 'history' ) ) { $n = $this->getTitle()->isDeleted(); if ( $n ) { @@ -1166,7 +1166,7 @@ abstract class Skin extends ContextSource { return array( 'href' => $title->getLocalURL( $urlaction ), - 'exists' => $title->getArticleID() != 0, + 'exists' => $title->isKnown(), ); } diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index 45a1a8ba8e..8136d8e9dc 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -743,17 +743,20 @@ class SkinTemplate extends Skin { self::checkTitle( $title, $name ); return array( 'href' => $title->getLocalURL( $urlaction ), - 'exists' => $title->getArticleID() != 0, + 'exists' => $title->isKnown(), ); } + /** + * @todo is this even used? + */ function makeArticleUrlDetails( $name, $urlaction = '' ) { $title = Title::newFromText( $name ); $title = $title->getSubjectPage(); self::checkTitle( $title, $name ); return array( 'href' => $title->getLocalURL( $urlaction ), - 'exists' => $title->getArticleID() != 0, + 'exists' => $title->exists(), ); } @@ -1213,7 +1216,7 @@ class SkinTemplate extends Skin { 'href' => $this->getTitle()->getLocalURL( "action=info" ) ); - if ( $this->getTitle()->getArticleID() ) { + if ( $this->getTitle()->exists() ) { $nav_urls['recentchangeslinked'] = array( 'href' => SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage )->getLocalURL() );