Use ResultWrapper::numRows() instead of DatabaseBase::numRows()
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 6 Jan 2013 10:52:40 +0000 (11:52 +0100)
committerAlexandre Emsenhuber <ialex.wiki@gmail.com>
Sun, 6 Jan 2013 10:52:40 +0000 (11:52 +0100)
Change-Id: I87f059aaff72bf06ebc72ad3a7904cca8e11fab9

includes/Block.php
includes/Title.php
includes/cache/SquidUpdate.php
includes/specials/SpecialListredirects.php
includes/specials/SpecialWhatlinkshere.php
maintenance/fixSlaveDesync.php
maintenance/orphans.php
maintenance/purgeList.php
maintenance/refreshLinks.php
maintenance/storage/compressOld.php

index afacc43..9b51aae 100644 (file)
@@ -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 {
index e263bd8..14247b4 100644 (file)
@@ -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();
index 6b48fa4..bcc8446 100644 (file)
@@ -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();
index f4acd64..cdad688 100644 (file)
@@ -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 );
                }
index f135649..85876e9 100644 (file)
@@ -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() );
 
index 8bf556f..ab7603d 100644 (file)
@@ -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 ) ) {
index 78f98f5..3b1a9b0 100644 (file)
@@ -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' ) );
index 4b3c382..58fe880 100644 (file)
@@ -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
index 9ba8682..7a551d6 100644 (file)
@@ -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;
index 951ab1a..d636283 100644 (file)
@@ -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 );