From 837d39dec7b407a9c32c5777914c7a73c5351b33 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 13 Apr 2011 00:50:44 +0000 Subject: [PATCH] * 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 --- includes/Article.php | 38 +++++++++----------------------------- includes/EditPage.php | 1 - 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 8ad3eb0ad6..b9288c21e5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -571,33 +571,16 @@ class Article { /** * Read/write accessor to select FOR UPDATE + * @FIXME: remove, does nothing * * @param $x Mixed: FIXME * @return mixed value of $x, or value stored in Article::mForUpdate */ public function forUpdate( $x = null ) { + wfDeprecated(); return wfSetVar( $this->mForUpdate, $x ); } - /** - * Get options for all SELECT statements - * - * @param $options Array: an optional options array which'll be appended to - * the default - * @return Array: options - */ - protected function getSelectOptions( $options = '' ) { - if ( $this->mForUpdate ) { - if ( is_array( $options ) ) { - $options[] = 'FOR UPDATE'; - } else { - $options = 'FOR UPDATE'; - } - } - - return $options; - } - /** * @return int Page ID */ @@ -638,8 +621,7 @@ class Article { $this->mCounter = $dbr->selectField( 'page', 'page_counter', array( 'page_id' => $id ), - __METHOD__, - $this->getSelectOptions() + __METHOD__ ); } } @@ -2939,10 +2921,11 @@ class Article { 'page_namespace' => $this->mTitle->getNamespace(), 'page_title' => $this->mTitle->getDBkey(), 'rev_page = page_id' - ), __METHOD__, $this->getSelectOptions( array( + ), __METHOD__, + array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => $num - ) ) + ) ); if ( !$res ) { @@ -4127,8 +4110,7 @@ class Article { 'watchlist', 'COUNT(*)', $wl_clause, - __METHOD__, - $this->getSelectOptions() ); + __METHOD__ ); $pageInfo = $this->pageCountInfo( $page ); $talkInfo = $this->pageCountInfo( $page->getTalkPage() ); @@ -4172,15 +4154,13 @@ class Article { 'revision', 'COUNT(rev_page)', $rev_clause, - __METHOD__, - $this->getSelectOptions() + __METHOD__ ); $authors = $dbr->selectField( 'revision', 'COUNT(DISTINCT rev_user_text)', $rev_clause, - __METHOD__, - $this->getSelectOptions() + __METHOD__ ); return array( 'edits' => $edits, 'authors' => $authors ); diff --git a/includes/EditPage.php b/includes/EditPage.php index 9d85d6c675..cafb641426 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -987,7 +987,6 @@ class EditPage { # Article exists. Check for edit conflict. $this->mArticle->clear(); # Force reload of dates, etc. - $this->mArticle->forUpdate( true ); # Lock the article wfDebug( "timestamp: {$this->mArticle->getTimestamp()}, edittime: {$this->edittime}\n" ); -- 2.20.1