From: Kevin Israel Date: Thu, 11 Sep 2014 19:14:06 +0000 (-0400) Subject: Use DatabaseBase::selectRowCount() in two more places X-Git-Tag: 1.31.0-rc.0~12636 X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=65f81d28438602642ab24100f055c45986997126;p=lhc%2Fweb%2Fwiklou.git Use DatabaseBase::selectRowCount() in two more places Change-Id: Ic6e03a96c03499f7d62539f12e677b4407def673 --- diff --git a/includes/Title.php b/includes/Title.php index ca12322d74..2d0cfda627 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4098,12 +4098,11 @@ class Title { 'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $new->getTimestamp() ) ) ); if ( $max !== null ) { - $res = $dbr->select( 'revision', '1', + return $dbr->selectRowCount( 'revision', '1', $conds, __METHOD__, array( 'LIMIT' => $max + 1 ) // extra to detect truncation ); - return $res->numRows(); } else { return (int)$dbr->selectField( 'revision', 'count(*)', $conds, __METHOD__ ); } diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index fed5a334cf..aa38564e1c 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -167,9 +167,9 @@ class ApiQueryUserInfo extends ApiQueryBase { if ( isset( $this->prop['unreadcount'] ) ) { $dbr = $this->getQuery()->getNamedDB( 'watchlist', DB_SLAVE, 'watchlist' ); - $sql = $dbr->selectSQLText( + $count = $dbr->selectRowCount( 'watchlist', - array( 'dummy' => 1 ), + '1', array( 'wl_user' => $user->getId(), 'wl_notificationtimestamp IS NOT NULL', @@ -177,7 +177,6 @@ class ApiQueryUserInfo extends ApiQueryBase { __METHOD__, array( 'LIMIT' => self::WL_UNREAD_LIMIT ) ); - $count = $dbr->selectField( array( 'c' => "($sql)" ), 'COUNT(*)' ); if ( $count >= self::WL_UNREAD_LIMIT ) { $vals['unreadcount'] = self::WL_UNREAD_LIMIT . '+';