Topic on Project:Support desk

1.39.6 function numRows missing

7
2003:C2:3F21:FD00:A1BE:8BA5:2092:924F (talkcontribs)

According to Manual:Database.php#Functions, we use the following code (extract):

$dbr = wfGetDB( DB_REPLICA );
$res = $dbr->query( ... some DB Query ... );
.... $dbr->numRows( $res ) ....

But we get:

Error: Call to undefined method Wikimedia\Rdbms\DatabaseMysqli::numRows()

Backtrace:

from /var/www/test/mediawiki/includes/libs/rdbms/database/DBConnRef.php(103)
#0 /var/www/test/mediawiki/extensions/PPcheckRedirects/SpecialPPcheckRedirects.class.php(118): Wikimedia\Rdbms\DBConnRef->__call()
#1 /var/www/test/mediawiki/includes/specialpage/SpecialPage.php(701): SpecialPPcheckRedirects->execute()
#2 /var/www/test/mediawiki/includes/specialpage/SpecialPageFactory.php(1428): SpecialPage->run()
#3 /var/www/test/mediawiki/includes/MediaWiki.php(316): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#4 /var/www/test/mediawiki/includes/MediaWiki.php(904): MediaWiki->performRequest()
#5 /var/www/test/mediawiki/includes/MediaWiki.php(562): MediaWiki->main()
#6 /var/www/test/mediawiki/index.php(50): MediaWiki->run()
#7 /var/www/test/mediawiki/index.php(46): wfIndexMain()
#8 {main}

Prior to 1.39, the above code worked. Could this be an installation problem or has there been an undocumented redesign of the db access objects?

Bawolff (talkcontribs)

per the Release-notes file included with 1.39, numRows was removed

Use $res->numRows() instead.

TheDJ (talkcontribs)
2003:C2:3F21:FD00:89BA:CA55:9F1B:EC5A (talkcontribs)

$res->numRows, that was the piece of information I have been missing and wasn't able to find. Just to be sure: same problem with $dbr->freeResult, but there's no replacement ... right?

Works fine now, thank you.

@TheDJ no, I really don't want to. Non-voluntary. These are the sort of "improvements" that make Mediawiki worse, not better. I know someday I must but that's nothing I am looking forward to. I've seen many "closed circles" of software developers drifting away to outer space, your companions are en route. Honestly: we only stick to Mediawiki because there's no alternative.

TheDJ (talkcontribs)

No problem, we are only providing the software as a courtesy, without guarantee. Everyone is free to use whatever they want. Thank you for supporting free and opensource software.

Bawolff (talkcontribs)
2003:C2:3F21:FD00:89BA:CA55:9F1B:EC5A (talkcontribs)

Thank you for your patience.

Reply to "1.39.6 function numRows missing"