r113593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113592‎ | r113593 | r113594 >
Date:22:05, 11 March 2012
Author:reedy
Status:ok
Tags:
Comment:
More of r113580
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinLegacy.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/includes/actions/InfoAction.php (modified) (history)
  • /trunk/phase3/includes/cache/LinkBatch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -2538,7 +2538,7 @@
25392539
25402540 if ( $oldFashionedRestrictions === null ) {
25412541 $oldFashionedRestrictions = $dbr->selectField( 'page', 'page_restrictions',
2542 - array( 'page_id' => $this->getArticleId() ), __METHOD__ );
 2542+ array( 'page_id' => $this->getArticleID() ), __METHOD__ );
25432543 }
25442544
25452545 if ( $oldFashionedRestrictions != '' ) {
@@ -2609,7 +2609,7 @@
26102610 $res = $dbr->select(
26112611 'page_restrictions',
26122612 '*',
2613 - array( 'pr_page' => $this->getArticleId() ),
 2613+ array( 'pr_page' => $this->getArticleID() ),
26142614 __METHOD__
26152615 );
26162616
@@ -3167,7 +3167,7 @@
31683168 * @return Array of Title objects linking here
31693169 */
31703170 public function getLinksFrom( $options = array(), $table = 'pagelinks', $prefix = 'pl' ) {
3171 - $id = $this->getArticleId();
 3171+ $id = $this->getArticleID();
31723172
31733173 # If the page doesn't exist; there can't be any link from this page
31743174 if ( !$id ) {
@@ -3231,7 +3231,7 @@
32323232 * @return Array of Title the Title objects
32333233 */
32343234 public function getBrokenLinksFrom() {
3235 - if ( $this->getArticleId() == 0 ) {
 3235+ if ( $this->getArticleID() == 0 ) {
32363236 # All links from article ID 0 are false positives
32373237 return array();
32383238 }
@@ -3241,7 +3241,7 @@
32423242 array( 'page', 'pagelinks' ),
32433243 array( 'pl_namespace', 'pl_title' ),
32443244 array(
3245 - 'pl_from' => $this->getArticleId(),
 3245+ 'pl_from' => $this->getArticleID(),
32463246 'page_namespace IS NULL'
32473247 ),
32483248 __METHOD__, array(),
@@ -3714,8 +3714,8 @@
37153715 // We don't know whether this function was called before
37163716 // or after moving the root page, so check both
37173717 // $this and $nt
3718 - if ( $oldSubpage->getArticleId() == $this->getArticleId() ||
3719 - $oldSubpage->getArticleID() == $nt->getArticleId() )
 3718+ if ( $oldSubpage->getArticleID() == $this->getArticleID() ||
 3719+ $oldSubpage->getArticleID() == $nt->getArticleID() )
37203720 {
37213721 // When moving a page to a subpage of itself,
37223722 // don't move it twice
@@ -3839,7 +3839,7 @@
38403840
38413841 $data = array();
38423842
3843 - $titleKey = $this->getArticleId();
 3843+ $titleKey = $this->getArticleID();
38443844
38453845 if ( $titleKey === 0 ) {
38463846 return $data;
@@ -3917,7 +3917,7 @@
39183918 $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
39193919 return $db->selectField( 'revision', 'rev_id',
39203920 array(
3921 - 'rev_page' => $this->getArticleId( $flags ),
 3921+ 'rev_page' => $this->getArticleID( $flags ),
39223922 'rev_id < ' . intval( $revId )
39233923 ),
39243924 __METHOD__,
@@ -3936,7 +3936,7 @@
39373937 $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
39383938 return $db->selectField( 'revision', 'rev_id',
39393939 array(
3940 - 'rev_page' => $this->getArticleId( $flags ),
 3940+ 'rev_page' => $this->getArticleID( $flags ),
39413941 'rev_id > ' . intval( $revId )
39423942 ),
39433943 __METHOD__,
@@ -3951,7 +3951,7 @@
39523952 * @return Revision|Null if page doesn't exist
39533953 */
39543954 public function getFirstRevision( $flags = 0 ) {
3955 - $pageId = $this->getArticleId( $flags );
 3955+ $pageId = $this->getArticleID( $flags );
39563956 if ( $pageId ) {
39573957 $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
39583958 $row = $db->selectRow( 'revision', '*',
@@ -4016,7 +4016,7 @@
40174017 if ( $this->mEstimateRevisions === null ) {
40184018 $dbr = wfGetDB( DB_SLAVE );
40194019 $this->mEstimateRevisions = $dbr->estimateRowCount( 'revision', '*',
4020 - array( 'rev_page' => $this->getArticleId() ), __METHOD__ );
 4020+ array( 'rev_page' => $this->getArticleID() ), __METHOD__ );
40214021 }
40224022
40234023 return $this->mEstimateRevisions;
@@ -4043,7 +4043,7 @@
40444044 $dbr = wfGetDB( DB_SLAVE );
40454045 return (int)$dbr->selectField( 'revision', 'count(*)',
40464046 array(
4047 - 'rev_page' => $this->getArticleId(),
 4047+ 'rev_page' => $this->getArticleID(),
40484048 'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $old->getTimestamp() ) ),
40494049 'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $new->getTimestamp() ) )
40504050 ),
@@ -4117,7 +4117,7 @@
41184118 * @return Bool
41194119 */
41204120 public function exists() {
4121 - return $this->getArticleId() != 0;
 4121+ return $this->getArticleID() != 0;
41224122 }
41234123
41244124 /**
Index: trunk/phase3/includes/actions/InfoAction.php
@@ -107,7 +107,7 @@
108108 * @return mixed array or boolean false
109109 */
110110 public static function pageCountInfo( $title ) {
111 - $id = $title->getArticleId();
 111+ $id = $title->getArticleID();
112112 $dbr = wfGetDB( DB_SLAVE );
113113
114114 $watchers = (int)$dbr->selectField(
Index: trunk/phase3/includes/SkinTemplate.php
@@ -216,7 +216,7 @@
217217 $tpl->setRef( 'thispage', $this->thispage );
218218 $tpl->setRef( 'titleprefixeddbkey', $this->thispage );
219219 $tpl->set( 'titletext', $title->getText() );
220 - $tpl->set( 'articleid', $title->getArticleId() );
 220+ $tpl->set( 'articleid', $title->getArticleID() );
221221
222222 $tpl->set( 'isarticle', $out->isArticle() );
223223
@@ -1173,7 +1173,7 @@
11741174 $nav_urls['whatlinkshere'] = array(
11751175 'href' => SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage )->getLocalUrl()
11761176 );
1177 - if ( $this->getTitle()->getArticleId() ) {
 1177+ if ( $this->getTitle()->getArticleID() ) {
11781178 $nav_urls['recentchangeslinked'] = array(
11791179 'href' => SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage )->getLocalUrl()
11801180 );
Index: trunk/phase3/includes/Skin.php
@@ -662,7 +662,7 @@
663663 $action = $this->getRequest()->getVal( 'action', 'view' );
664664
665665 if ( $this->getUser()->isAllowed( 'deletedhistory' ) &&
666 - ( $this->getTitle()->getArticleId() == 0 || $action == 'history' ) ) {
 666+ ( $this->getTitle()->getArticleID() == 0 || $action == 'history' ) ) {
667667 $n = $this->getTitle()->isDeleted();
668668
669669
Index: trunk/phase3/includes/EditPage.php
@@ -376,7 +376,7 @@
377377 wfProfileOut( __METHOD__ );
378378 return;
379379 }
380 - if ( !$this->mTitle->getArticleId() )
 380+ if ( !$this->mTitle->getArticleID() )
381381 wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) );
382382 else
383383 wfRunHooks( 'EditFormInitialText', array( $this ) );
@@ -805,7 +805,7 @@
806806 # Otherwise, $text will be left as-is.
807807 if ( !is_null( $undorev ) && !is_null( $oldrev ) &&
808808 $undorev->getPage() == $oldrev->getPage() &&
809 - $undorev->getPage() == $this->mTitle->getArticleId() &&
 809+ $undorev->getPage() == $this->mTitle->getArticleID() &&
810810 !$undorev->isDeleted( Revision::DELETED_TEXT ) &&
811811 !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) {
812812
@@ -1478,7 +1478,7 @@
14791479 $res = $dbw->select( 'revision',
14801480 'rev_user',
14811481 array(
1482 - 'rev_page' => $this->mTitle->getArticleId(),
 1482+ 'rev_page' => $this->mTitle->getArticleID(),
14831483 'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $edittime ) )
14841484 ),
14851485 __METHOD__,
Index: trunk/phase3/includes/SkinLegacy.php
@@ -324,7 +324,7 @@
325325
326326 $s = implode( $element, $sep );
327327
328 - if ( $title->getArticleId() ) {
 328+ if ( $title->getArticleID() ) {
329329 $s .= "\n<br />";
330330
331331 // Delete/protect/move links for privileged users
@@ -573,7 +573,7 @@
574574 $diff = $wgRequest->getVal( 'diff' );
575575 $title = $this->getSkin()->getTitle();
576576
577 - if ( $title->getArticleId() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
 577+ if ( $title->getArticleID() && ( !$diff ) && $wgUser->isAllowed( 'delete' ) ) {
578578 $t = wfMsg( 'deletethispage' );
579579
580580 $s = Linker::linkKnown(
@@ -595,7 +595,7 @@
596596 $diff = $wgRequest->getVal( 'diff' );
597597 $title = $this->getSkin()->getTitle();
598598
599 - if ( $title->getArticleId() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
 599+ if ( $title->getArticleID() && ( ! $diff ) && $wgUser->isAllowed( 'protect' ) ) {
600600 if ( $title->isProtected() ) {
601601 $text = wfMsg( 'unprotectthispage' );
602602 $query = array( 'action' => 'unprotect' );
Index: trunk/phase3/includes/cache/LinkBatch.php
@@ -45,6 +45,11 @@
4646 }
4747 }
4848
 49+ /**
 50+ * @param $ns int
 51+ * @param $dbkey string
 52+ * @return mixed
 53+ */
4954 public function add( $ns, $dbkey ) {
5055 if ( $ns < 0 ) {
5156 return;
Index: trunk/phase3/includes/Revision.php
@@ -1185,7 +1185,7 @@
11861186 $id = 0;
11871187 }
11881188 $conds = array( 'rev_id' => $id );
1189 - $conds['rev_page'] = $title->getArticleId();
 1189+ $conds['rev_page'] = $title->getArticleID();
11901190 $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
11911191 if ( $timestamp === false && wfGetLB()->getServerCount() > 1 ) {
11921192 # Not in slave, try master
@@ -1219,7 +1219,7 @@
12201220 * @return Integer
12211221 */
12221222 static function countByTitle( $db, $title ) {
1223 - $id = $title->getArticleId();
 1223+ $id = $title->getArticleID();
12241224 if( $id ) {
12251225 return Revision::countByPageId( $db, $id );
12261226 }
Index: trunk/phase3/includes/WikiPage.php
@@ -2022,7 +2022,7 @@
20232023
20242024 # Now that it's safely backed up, delete it
20252025 $dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__ );
2026 - $ok = ( $dbw->affectedRows() > 0 ); // getArticleId() uses slave, could be laggy
 2026+ $ok = ( $dbw->affectedRows() > 0 ); // getArticleID() uses slave, could be laggy
20272027
20282028 if ( !$ok ) {
20292029 $dbw->rollback( __METHOD__ );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113580Normalise casing of getArticleID used in corereedy18:54, 11 March 2012

Status & tagging log