Issue:Includematch does not filter results
Description: | "includematch" can not be used like in version 1.7.4: It does not filter results. |
Extension / Version: | DPL / 1.8.6 |
Type / Status: | Bug / open |
Contents
Problem
I updated DPL from version 1.7.4 to version 1.8.6
within version 1.7.4 I used the parameter includematch very often.
E.g.:
<dpl> category=to-be-investigated include={template}:parameter includematch=/.*Value I am Looking for.*/si </dpl>
Using DPL 1.7.4 this produced a list of only those pages containing "Value I am Looking for" in the "parameter" of the "template".
Using DPL 1.8.6 this produced additionally those pages where the "includematch" did not match.
I think the behavior of 1.7.4 is the better one. Until this problem is resolved I downgraded back to version 1.7.4
BTW: I am using MediaWiki 1.13.3; PHP 5.2.8 (isapi); MySQL 5.1.30-community
Reply
Can you please reproduce the error here in this wiki? The official test example (Test includematch) looks quite o.k. to me.
Feel free to extend that example or to create a 'brother' like 'Test includematch 2'.
And you should have in mind that includematch, as the manual explains, matches the given pattern against the complete content of the template call, not only against the value of the parameter(s) you specified in the include statement.
Gero 16:11, 5 August 2009 (UTC)
Reproduction
Sorry my discription was a little wrong -
- it works correctly with including templates
- it does not work correctly with including sections:
I added a section "Data" to the Pages Republic of Cameroon and Republic of Burundi
Without the "includematch" Parameter - the following dpl displays both sections:
- Republic of Cape Verde
- Republic of Burundi
Name Republic of Burundi Official Languages Kirundi,French Goverment Republic Area 10,745 sq mi Population 7,548,000 GDP $4.517 billion Independence Days 01/07/1962 - Republic of Cameroon
Name Republic of Cameroon Official Languages French,English Goverment Republic Area 183,568 sq mi Population 17,795,000 GDP $43.196 billion Independence Days 01/10/1961 - Republic of Madagascar
- United Republic of Tanzania
Adding the "includematch" Parameter - only the Section containing "Kirundi" is displayed
- Republic of Burundi
Name Republic of Burundi Official Languages Kirundi,French Goverment Republic Area 10,745 sq mi Population 7,548,000 GDP $4.517 billion Independence Days 01/07/1962
But those pages where the "includematch" does not match should not be listet.
Only on one page "Kirundi" was found -- there should be only one page listed.
I expected ..."Result: 1 pages"
Solution
You are right. I will fix the bug in the next release (which may take a little while). If you want to patch your installation the only thing you need to do is the following:
- look near line #380 in DPL.php for a line which performs a "break"
if (!array_key_exists(0,$secPieces)) break;
- replace that line by the following text:
if (!array_key_exists(0,$secPieces)) { // avoid matching against a non-existing array element // and skip the article if there was a match condition if ($mustMatch!= || $mustNotMatch!=) $matchFailed=true; break; }
That´s it. Thanks for bringing up the error! Gero 17:30, 6 August 2009 (UTC)