Jump to content

Topic on Extension talk:DynamicPageListEngine

ResultWrapper vs MysqliResultWrapper

3
Germy Parker (talkcontribs)

I was trying to use the lua functions, and, no matter what parameters I tried, I got the same error message:

Exception caught: DpleFeatureResults::toFullpagenames(): Argument #1 ($result) must be of type ResultWrapper, Wikimedia\Rdbms\MysqliResultWrapper given, called in /var/www/mediawiki/extensions/DynamicPageListEngine/includes/DynamicPageListEngine.php on line 125

(I got variations of this error for `getFullpagenames`, `getPagenames`, and `getPages`.)

I was able to fix the error (I think!) by changing the argument type to MysqliResultWrapper in the /include/DpleFeatureResults.php file (replaced all in the file, and had to import using `use Wikimedia\Rdbms\MysqliResultWrapper`), but I didn't want to push too far since I don't know what the downstream effects of that kind of change would be.  By making the change, I did not get the error. The results of my lua script were still not correct, but that's probably an issue with my lua, not with DPLE ;)

MediaWiki version 1.42

DPLE version 1.1.0-rc1 (1545ff3) 02:09, 2 November 2024

sample lua:

function p.getPages(titletext)

   local pages = mw.ext.dpl.getFullpagenames{
       namespace = 0,
       titleprefix = titletext
   }

end

Germy Parker (talkcontribs)

Just an update/correction: using the MysqliResultWrapper replacement, I got my full functionality using the following query:

local queryParams = {

 titleprefix = inputPrefix,
 subpages = "only"

} local results = mw.ext.dpl.getFullpagenames(queryParams)

This query produces expected results, but without replacing ResultWrapper with MysqliResultWrapper, it produces the error.

RV1971 (talkcontribs)

I'm afraid I'm not up to date right now, my own installation is MW 1.40. Up to that version, ResultWrapper.php contains a class_alias statement that defines a global alias ResultWrapper. This has been removed in 1.41 (which is clearly a progress in terms of code structure), so now my extension code needs a use Wikimedia\Rdbms\ResultWrapper;. Similar updates might be necessary in other files. I apologize that probably I'll not have time to do this in the next days.

Reply to "ResultWrapper vs MysqliResultWrapper"