From 2d25a902e30929ae682a7d05a92c2b10f97129f7 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 11 Mar 2012 22:05:54 +0000 Subject: [PATCH] More of r113580 --- includes/EditPage.php | 6 +++--- includes/Revision.php | 4 ++-- includes/Skin.php | 2 +- includes/SkinLegacy.php | 6 +++--- includes/SkinTemplate.php | 4 ++-- includes/Title.php | 28 ++++++++++++++-------------- includes/WikiPage.php | 2 +- includes/actions/InfoAction.php | 2 +- includes/cache/LinkBatch.php | 5 +++++ 9 files changed, 32 insertions(+), 27 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 287ed97c1f..dc107ad15c 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -376,7 +376,7 @@ class EditPage { wfProfileOut( __METHOD__ ); return; } - if ( !$this->mTitle->getArticleId() ) + if ( !$this->mTitle->getArticleID() ) wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); else wfRunHooks( 'EditFormInitialText', array( $this ) ); @@ -805,7 +805,7 @@ class EditPage { # Otherwise, $text will be left as-is. if ( !is_null( $undorev ) && !is_null( $oldrev ) && $undorev->getPage() == $oldrev->getPage() && - $undorev->getPage() == $this->mTitle->getArticleId() && + $undorev->getPage() == $this->mTitle->getArticleID() && !$undorev->isDeleted( Revision::DELETED_TEXT ) && !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { @@ -1478,7 +1478,7 @@ class EditPage { $res = $dbw->select( 'revision', 'rev_user', array( - 'rev_page' => $this->mTitle->getArticleId(), + 'rev_page' => $this->mTitle->getArticleID(), 'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $edittime ) ) ), __METHOD__, diff --git a/includes/Revision.php b/includes/Revision.php index f155e6ae54..1147e6aead 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1185,7 +1185,7 @@ class Revision { $id = 0; } $conds = array( 'rev_id' => $id ); - $conds['rev_page'] = $title->getArticleId(); + $conds['rev_page'] = $title->getArticleID(); $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ ); if ( $timestamp === false && wfGetLB()->getServerCount() > 1 ) { # Not in slave, try master @@ -1219,7 +1219,7 @@ class Revision { * @return Integer */ static function countByTitle( $db, $title ) { - $id = $title->getArticleId(); + $id = $title->getArticleID(); if( $id ) { return Revision::countByPageId( $db, $id ); } diff --git a/includes/Skin.php b/includes/Skin.php index 7fc4a5ccae..eb2b8ae20a 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -662,7 +662,7 @@ abstract class Skin extends ContextSource { $action = $this->getRequest()->getVal( 'action', 'view' ); if ( $this->getUser()->isAllowed( 'deletedhistory' ) && - ( $this->getTitle()->getArticleId() == 0 || $action == 'history' ) ) { + ( $this->getTitle()->getArticleID() == 0 || $action == 'history' ) ) { $n = $this->getTitle()->isDeleted(); diff --git a/includes/SkinLegacy.php b/includes/SkinLegacy.php index 4db9da4af9..480f3eb6df 100644 --- a/includes/SkinLegacy.php +++ b/includes/SkinLegacy.php @@ -324,7 +324,7 @@ class LegacyTemplate extends BaseTemplate { $s = implode( $element, $sep ); - if ( $title->getArticleId() ) { + if ( $title->getArticleID() ) { $s .= "\n
"; // Delete/protect/move links for privileged users @@ -573,7 +573,7 @@ class LegacyTemplate extends BaseTemplate { $diff = $wgRequest->getVal( 'diff' ); $title = $this->getSkin()->getTitle(); - if ( $title->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) { + if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) { $t = wfMsg( 'deletethispage' ); $s = Linker::linkKnown( @@ -595,7 +595,7 @@ class LegacyTemplate extends BaseTemplate { $diff = $wgRequest->getVal( 'diff' ); $title = $this->getSkin()->getTitle(); - if ( $title->getArticleId() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) { + if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) { if ( $title->isProtected() ) { $text = wfMsg( 'unprotectthispage' ); $query = array( 'action' => 'unprotect' ); diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 2d198f9b0e..d08b7eff75 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -216,7 +216,7 @@ class SkinTemplate extends Skin { $tpl->setRef( 'thispage', $this->thispage ); $tpl->setRef( 'titleprefixeddbkey', $this->thispage ); $tpl->set( 'titletext', $title->getText() ); - $tpl->set( 'articleid', $title->getArticleId() ); + $tpl->set( 'articleid', $title->getArticleID() ); $tpl->set( 'isarticle', $out->isArticle() ); @@ -1173,7 +1173,7 @@ class SkinTemplate extends Skin { $nav_urls['whatlinkshere'] = array( 'href' => SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage )->getLocalUrl() ); - if ( $this->getTitle()->getArticleId() ) { + if ( $this->getTitle()->getArticleID() ) { $nav_urls['recentchangeslinked'] = array( 'href' => SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage )->getLocalUrl() ); diff --git a/includes/Title.php b/includes/Title.php index 1a8f3e88fa..769adb91f6 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2538,7 +2538,7 @@ class Title { if ( $oldFashionedRestrictions === null ) { $oldFashionedRestrictions = $dbr->selectField( 'page', 'page_restrictions', - array( 'page_id' => $this->getArticleId() ), __METHOD__ ); + array( 'page_id' => $this->getArticleID() ), __METHOD__ ); } if ( $oldFashionedRestrictions != '' ) { @@ -2609,7 +2609,7 @@ class Title { $res = $dbr->select( 'page_restrictions', '*', - array( 'pr_page' => $this->getArticleId() ), + array( 'pr_page' => $this->getArticleID() ), __METHOD__ ); @@ -3167,7 +3167,7 @@ class Title { * @return Array of Title objects linking here */ public function getLinksFrom( $options = array(), $table = 'pagelinks', $prefix = 'pl' ) { - $id = $this->getArticleId(); + $id = $this->getArticleID(); # If the page doesn't exist; there can't be any link from this page if ( !$id ) { @@ -3231,7 +3231,7 @@ class Title { * @return Array of Title the Title objects */ public function getBrokenLinksFrom() { - if ( $this->getArticleId() == 0 ) { + if ( $this->getArticleID() == 0 ) { # All links from article ID 0 are false positives return array(); } @@ -3241,7 +3241,7 @@ class Title { array( 'page', 'pagelinks' ), array( 'pl_namespace', 'pl_title' ), array( - 'pl_from' => $this->getArticleId(), + 'pl_from' => $this->getArticleID(), 'page_namespace IS NULL' ), __METHOD__, array(), @@ -3714,8 +3714,8 @@ class Title { // We don't know whether this function was called before // or after moving the root page, so check both // $this and $nt - if ( $oldSubpage->getArticleId() == $this->getArticleId() || - $oldSubpage->getArticleID() == $nt->getArticleId() ) + if ( $oldSubpage->getArticleID() == $this->getArticleID() || + $oldSubpage->getArticleID() == $nt->getArticleID() ) { // When moving a page to a subpage of itself, // don't move it twice @@ -3839,7 +3839,7 @@ class Title { $data = array(); - $titleKey = $this->getArticleId(); + $titleKey = $this->getArticleID(); if ( $titleKey === 0 ) { return $data; @@ -3917,7 +3917,7 @@ class Title { $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); return $db->selectField( 'revision', 'rev_id', array( - 'rev_page' => $this->getArticleId( $flags ), + 'rev_page' => $this->getArticleID( $flags ), 'rev_id < ' . intval( $revId ) ), __METHOD__, @@ -3936,7 +3936,7 @@ class Title { $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); return $db->selectField( 'revision', 'rev_id', array( - 'rev_page' => $this->getArticleId( $flags ), + 'rev_page' => $this->getArticleID( $flags ), 'rev_id > ' . intval( $revId ) ), __METHOD__, @@ -3951,7 +3951,7 @@ class Title { * @return Revision|Null if page doesn't exist */ public function getFirstRevision( $flags = 0 ) { - $pageId = $this->getArticleId( $flags ); + $pageId = $this->getArticleID( $flags ); if ( $pageId ) { $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); $row = $db->selectRow( 'revision', '*', @@ -4016,7 +4016,7 @@ class Title { if ( $this->mEstimateRevisions === null ) { $dbr = wfGetDB( DB_SLAVE ); $this->mEstimateRevisions = $dbr->estimateRowCount( 'revision', '*', - array( 'rev_page' => $this->getArticleId() ), __METHOD__ ); + array( 'rev_page' => $this->getArticleID() ), __METHOD__ ); } return $this->mEstimateRevisions; @@ -4043,7 +4043,7 @@ class Title { $dbr = wfGetDB( DB_SLAVE ); return (int)$dbr->selectField( 'revision', 'count(*)', array( - 'rev_page' => $this->getArticleId(), + 'rev_page' => $this->getArticleID(), 'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $old->getTimestamp() ) ), 'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $new->getTimestamp() ) ) ), @@ -4117,7 +4117,7 @@ class Title { * @return Bool */ public function exists() { - return $this->getArticleId() != 0; + return $this->getArticleID() != 0; } /** diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 04af1f12db..6cad466414 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2022,7 +2022,7 @@ class WikiPage extends Page { # Now that it's safely backed up, delete it $dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__ ); - $ok = ( $dbw->affectedRows() > 0 ); // getArticleId() uses slave, could be laggy + $ok = ( $dbw->affectedRows() > 0 ); // getArticleID() uses slave, could be laggy if ( !$ok ) { $dbw->rollback( __METHOD__ ); diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 70edabce0e..543beb79a5 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -107,7 +107,7 @@ class InfoAction extends FormlessAction { * @return mixed array or boolean false */ public static function pageCountInfo( $title ) { - $id = $title->getArticleId(); + $id = $title->getArticleID(); $dbr = wfGetDB( DB_SLAVE ); $watchers = (int)$dbr->selectField( diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 17e8739bc9..29fde0315b 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -45,6 +45,11 @@ class LinkBatch { } } + /** + * @param $ns int + * @param $dbkey string + * @return mixed + */ public function add( $ns, $dbkey ) { if ( $ns < 0 ) { return; -- 2.20.1