r85934 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85933‎ | r85934 | r85935 >
Date:00:50, 13 April 2011
Author:aaron
Status:ok
Tags:
Comment:
* Removed getSelectOptions, which did nothing other than send FOR UPDATE on some slave queries to barely used features
* Removed only Core use of forUpdate(); same issue
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -571,34 +571,17 @@
572572
573573 /**
574574 * Read/write accessor to select FOR UPDATE
 575+ * @FIXME: remove, does nothing
575576 *
576577 * @param $x Mixed: FIXME
577578 * @return mixed value of $x, or value stored in Article::mForUpdate
578579 */
579580 public function forUpdate( $x = null ) {
 581+ wfDeprecated();
580582 return wfSetVar( $this->mForUpdate, $x );
581583 }
582584
583585 /**
584 - * Get options for all SELECT statements
585 - *
586 - * @param $options Array: an optional options array which'll be appended to
587 - * the default
588 - * @return Array: options
589 - */
590 - protected function getSelectOptions( $options = '' ) {
591 - if ( $this->mForUpdate ) {
592 - if ( is_array( $options ) ) {
593 - $options[] = 'FOR UPDATE';
594 - } else {
595 - $options = 'FOR UPDATE';
596 - }
597 - }
598 -
599 - return $options;
600 - }
601 -
602 - /**
603586 * @return int Page ID
604587 */
605588 public function getID() {
@@ -638,8 +621,7 @@
639622 $this->mCounter = $dbr->selectField( 'page',
640623 'page_counter',
641624 array( 'page_id' => $id ),
642 - __METHOD__,
643 - $this->getSelectOptions()
 625+ __METHOD__
644626 );
645627 }
646628 }
@@ -2939,10 +2921,11 @@
29402922 'page_namespace' => $this->mTitle->getNamespace(),
29412923 'page_title' => $this->mTitle->getDBkey(),
29422924 'rev_page = page_id'
2943 - ), __METHOD__, $this->getSelectOptions( array(
 2925+ ), __METHOD__,
 2926+ array(
29442927 'ORDER BY' => 'rev_timestamp DESC',
29452928 'LIMIT' => $num
2946 - ) )
 2929+ )
29472930 );
29482931
29492932 if ( !$res ) {
@@ -4127,8 +4110,7 @@
41284111 'watchlist',
41294112 'COUNT(*)',
41304113 $wl_clause,
4131 - __METHOD__,
4132 - $this->getSelectOptions() );
 4114+ __METHOD__ );
41334115
41344116 $pageInfo = $this->pageCountInfo( $page );
41354117 $talkInfo = $this->pageCountInfo( $page->getTalkPage() );
@@ -4172,15 +4154,13 @@
41734155 'revision',
41744156 'COUNT(rev_page)',
41754157 $rev_clause,
4176 - __METHOD__,
4177 - $this->getSelectOptions()
 4158+ __METHOD__
41784159 );
41794160 $authors = $dbr->selectField(
41804161 'revision',
41814162 'COUNT(DISTINCT rev_user_text)',
41824163 $rev_clause,
4183 - __METHOD__,
4184 - $this->getSelectOptions()
 4164+ __METHOD__
41854165 );
41864166
41874167 return array( 'edits' => $edits, 'authors' => $authors );
Index: trunk/phase3/includes/EditPage.php
@@ -987,7 +987,6 @@
988988 # Article exists. Check for edit conflict.
989989
990990 $this->mArticle->clear(); # Force reload of dates, etc.
991 - $this->mArticle->forUpdate( true ); # Lock the article
992991
993992 wfDebug( "timestamp: {$this->mArticle->getTimestamp()}, edittime: {$this->edittime}\n" );
994993

Status & tagging log