From: Alexandre Emsenhuber Date: Sun, 6 Jan 2013 10:52:40 +0000 (+0100) Subject: Use ResultWrapper::numRows() instead of DatabaseBase::numRows() X-Git-Tag: 1.31.0-rc.0~21059^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=d85239a186faec23f346b617259fdf4aafd2821a;p=lhc%2Fweb%2Fwiklou.git Use ResultWrapper::numRows() instead of DatabaseBase::numRows() Change-Id: I87f059aaff72bf06ebc72ad3a7904cca8e11fab9 --- diff --git a/includes/Block.php b/includes/Block.php index afacc43aa2..9b51aae08e 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -594,7 +594,7 @@ class Block { $res = $dbr->select( 'recentchanges', array( 'rc_ip' ), $conds, __METHOD__ , $options ); - if ( !$dbr->numRows( $res ) ) { + if ( !$res->numRows() ) { # No results, don't autoblock anything wfDebug( "No IP found to retroactively autoblock\n" ); } else { diff --git a/includes/Title.php b/includes/Title.php index e263bd8878..14247b4109 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -4030,7 +4030,7 @@ class Title { array() ); - if ( $dbr->numRows( $res ) > 0 ) { + if ( $res->numRows() > 0 ) { foreach ( $res as $row ) { // $data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to); $data[$wgContLang->getNSText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText(); diff --git a/includes/cache/SquidUpdate.php b/includes/cache/SquidUpdate.php index 6b48fa4d14..bcc8446803 100644 --- a/includes/cache/SquidUpdate.php +++ b/includes/cache/SquidUpdate.php @@ -65,7 +65,7 @@ class SquidUpdate { 'pl_from=page_id' ), __METHOD__ ); $blurlArr = $title->getSquidURLs(); - if ( $dbr->numRows( $res ) <= $wgMaxSquidPurgeTitles ) { + if ( $res->numRows() <= $wgMaxSquidPurgeTitles ) { foreach ( $res as $BL ) { $tobj = Title::makeTitle( $BL->page_namespace, $BL->page_title ) ; $blurlArr[] = $tobj->getInternalURL(); diff --git a/includes/specials/SpecialListredirects.php b/includes/specials/SpecialListredirects.php index f4acd64bd0..cdad688591 100644 --- a/includes/specials/SpecialListredirects.php +++ b/includes/specials/SpecialListredirects.php @@ -85,7 +85,7 @@ class ListredirectsPage extends QueryPage { $batch->execute(); // Back to start for display - if ( $db->numRows( $res ) > 0 ) { + if ( $res->numRows() > 0 ) { // If there are no rows we get an error seeking. $db->dataSeek( $res, 0 ); } diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index f13564936a..85876e9efe 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -187,7 +187,7 @@ class SpecialWhatLinksHere extends SpecialPage { $joinConds); } - if( ( !$fetchlinks || !$dbr->numRows($plRes) ) && ( $hidetrans || !$dbr->numRows($tlRes) ) && ( $hideimages || !$dbr->numRows($ilRes) ) ) { + if( ( !$fetchlinks || !$plRes->numRows() ) && ( $hidetrans || !$tlRes->numRows() ) && ( $hideimages || !$ilRes->numRows() ) ) { if ( 0 == $level ) { $out->addHTML( $this->whatlinkshereForm() ); diff --git a/maintenance/fixSlaveDesync.php b/maintenance/fixSlaveDesync.php index 8bf556f087..ab7603de7d 100644 --- a/maintenance/fixSlaveDesync.php +++ b/maintenance/fixSlaveDesync.php @@ -67,7 +67,7 @@ class FixSlaveDesync extends Maintenance { $dbw = wfGetDB( DB_MASTER ); $masterIDs = array(); $res = $dbw->select( 'page', array( 'page_id', 'page_latest' ), array( 'page_id<6054123' ), __METHOD__ ); - $this->output( "Number of pages: " . $dbw->numRows( $res ) . "\n" ); + $this->output( "Number of pages: " . $res->numRows() . "\n" ); foreach ( $res as $row ) { $masterIDs[$row->page_id] = $row->page_latest; if ( !( ++$n % 10000 ) ) { diff --git a/maintenance/orphans.php b/maintenance/orphans.php index 78f98f5a38..3b1a9b0e21 100644 --- a/maintenance/orphans.php +++ b/maintenance/orphans.php @@ -87,7 +87,7 @@ class Orphans extends Maintenance { FROM $revision LEFT OUTER JOIN $page ON rev_page=page_id WHERE page_id IS NULL " ); - $orphans = $dbw->numRows( $result ); + $orphans = $result->numRows(); if ( $orphans > 0 ) { global $wgContLang; $this->output( "$orphans orphan revisions...\n" ); @@ -139,7 +139,7 @@ class Orphans extends Maintenance { FROM $page LEFT OUTER JOIN $revision ON page_latest=rev_id WHERE rev_id IS NULL " ); - $widows = $dbw->numRows( $result ); + $widows = $result->numRows(); if ( $widows > 0 ) { $this->output( "$widows childless pages...\n" ); $this->output( sprintf( "%10s %11s %2s %s\n", 'page_id', 'page_latest', 'ns', 'page_title' ) ); diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php index 4b3c382190..58fe880148 100644 --- a/maintenance/purgeList.php +++ b/maintenance/purgeList.php @@ -86,7 +86,7 @@ class PurgeList extends Maintenance { ); $start = 0; - $end = $dbr->numRows( $result ); + $end = $result->numRows(); $this->output( "Will purge $end pages from namespace $ns\n" ); # Do remaining chunk diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 9ba8682666..7a551d6510 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -105,7 +105,7 @@ class RefreshLinks extends Maintenance { array(), array( 'redirect' => array( "LEFT JOIN", "page_id=rd_from" ) ) ); - $num = $dbr->numRows( $res ); + $num = $res->numRows(); $this->output( "Refreshing $num old redirects from $start...\n" ); $i = 0; @@ -126,7 +126,7 @@ class RefreshLinks extends Maintenance { "page_id >= $start" ), __METHOD__ ); - $num = $dbr->numRows( $res ); + $num = $res->numRows(); $this->output( "$num new articles...\n" ); $i = 0; diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index 951ab1a506..d636283495 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -115,7 +115,7 @@ class CompressOld extends Maintenance { do { $res = $dbw->select( 'text', array( 'old_id','old_flags','old_text' ), "old_id>=$start", __METHOD__, array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ) ); - if( $dbw->numRows( $res ) == 0 ) { + if( $res->numRows() == 0 ) { break; } $last = $start; @@ -256,7 +256,7 @@ class CompressOld extends Maintenance { $pageRes = $dbr->select( 'page', array('page_id', 'page_namespace', 'page_title','page_latest'), $pageConds + array('page_id' => $pageId), __METHOD__ ); - if ( $dbr->numRows( $pageRes ) == 0 ) { + if ( $pageRes->numRows() == 0 ) { continue; } $pageRow = $dbr->fetchObject( $pageRes );