Extension talk:DynamicPageListEngine

About this board

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"

Fix for PHP 8.1 (TypeError)

4
GSSNYC (talkcontribs)

In PHP 8.1, there is a TypeError when calling mw.ext.dpl.getPages on account of lines 91 and 104 in /includes/DpleFeatureNamespace.php - the use of PHP's `count` causes an exception if namespace is not provided (or if notNamespaces is not provided) because it attempts to call count on null. This can easily be fixed with PHP 7.0's null-coalescing operator ('??'), or alternatively to support older versions you can just use a ternary to check if the array is null and replace with an empty array before calling count.

(Another option might be to wrap the switch cases in an if statement.)

I would submit a patch for this myself but unfortunately I do not have experience with MediaWiki's/Gerrit submission process and don't immediately have the time to work out how to do it.

GSSNYC (talkcontribs)

The same applies to /includes/DpleFeatureExtra.php, line 85.

GSSNYC (talkcontribs)

...and /includes/DpleFeatureExtrax.php, line 83.

RV1971 (talkcontribs)

Thanks for spotting this. Fix has been uploaded to Gerrit for review.

Reply to "Fix for PHP 8.1 (TypeError)"

Need more information on usage

2
184.148.74.132 (talkcontribs)

The Special:Version page shows that it has been installed, and I have included it in LocalSettings.php. But when I try to use the tag <DPL> or <DPLE> or any sort of combination of those names written out with the parameters enabled as default, it doesn't actually turn into a list and only has the tags written out like plain text.

I've installed this on a fresh mediawiki install and this is my first time using it, so any obvious pointers would help.

RV1971 (talkcontribs)

DPLE does not add syntax tags. It is a backend that can be accessed via Lua only, you need to write your own modules to use it.

Reply to "Need more information on usage"

DynamicPageListEngine.php is absent

2
Sphynkx (talkcontribs)

In version for MW1.32 the DynamicPageListEngine.php is absent.

Install recommendations get wiki-engine to fall.

If take DynamicPageListEngine.php from some previous version (I had 0.2), the engine will work, but there is uncertainty is ext works correctly..

RV1971 (talkcontribs)

I'm afraid the installation instructions were outdated. Thanks for spotting this, I have just fixed them.

Reply to "DynamicPageListEngine.php is absent"

How to get this extension to work?

3
Zewas (talkcontribs)

I downloaded DataTable2 from Sourceforge, installed it with

   require_once "$IP/extensions/DataTable2/DataTable2.php";

and... nothing. The LUA console tells me:

   Lua error in console ... attempt to index field 'dpl' (a nil value).

This is what I had typed in:

   =mw.ext.dpl.getPagenames{ namespace = 14, text = 'Traversal' }

Is there anything else I need to do? Is DataTable2 even the same extension as DynamicPageListEngine?

RV1971 (talkcontribs)

I'm afraid the sourceforge storage is confusing. For some years I had absolutely no time to reorganize this even though I continued developing the extension. Today I have requested the creation of a gerrit repo, so a download via the modern MediaWiki facilities will hopefully be available soon.

Zewas (talkcontribs)

Well, I had to disable the extension altogether because it created mysterious database errors on non-module pages...

Reply to "How to get this extension to work?"
Louperivois (talkcontribs)

Im getting PHP warnings just because of some whitespaces at the end of DynamicPageListEngine.php. Just remove these whitespaces or the endtag to solve the problem.

Reply to "PHP warnings"
There are no older topics
Return to "DynamicPageListEngine" page.