SemanticMediaWiki/SemanticWatchlist

getcount() error

JeroenDeDauw opened this issue · 5 comments

Importing from SemanticMediaWiki/SemanticMediaWiki#210

In SWL_Group.php on line 437
$result = smwfGetStore()->getQueryResult( $query );

is always 0. As a result,
$foundMatch = $result->getCount() > 0;
fails and the extension cannot be used (verified on different MW and SMW versions).
See also http://www.mediawiki.org/wiki/Extension_talk:Semantic_Watchlist#problem_with_concept_watchlist_23668

@Hans-Oleander

Replace

$foundMatch = $result->getCount() > 0;

with

$foundMatch = $result instanceof SMWQueryResult ? $result->getCount() > 0 : $result > 0;

is always 0

The result depends on the invoked query therefore the result should not always be 0. $query->querymode = SMWQuery::MODE_COUNT; always returns a numeric result, above change should solve the uncovered issue when concepts are queried.

Hello,

this help from mwjames was solving it, thank you so much!

Another issue was that in my German notification e-mails all special chars
(Umlaute) were destroyed. Changing line 67 in
extensions/SemanticWatchlist/includes/SWL_EMailer.php from
'text/html; charset=ISO-8859-1'
to
'text/html; charset=UTF-8'
seems to have solved this. But as I am not really knowing what I have been
doing :) I did not want to supply an official merge request...

Best,
Hans

2014-04-15 12:48 GMT+02:00 mwjames notifications@github.com:

@Hans-Oleander https://github.com/Hans-Oleander

Replace

$foundMatch = $result->getCount() > 0;

with

$foundMatch = $result instanceof SMWQueryResult ? $result->getCount() > 0 : $result > 0;

is always 0

The result depends on the invoked query therefore the result should not
always be 0. $query->querymode = SMWQuery::MODE_COUNT; always returns a
numeric result, above change should solve the uncovered issue when concepts
are queried.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-40468320
.

There should be a law against ISO-8859-1. Still need to author these changes, I think.

Sorry, I do not understand this. What is "a low against something" in
github? Who is supposed to author changes, does it mean I should file a
merge request? Thank you!

Hans

2014-05-02 18:24 GMT+02:00 Karsten Hoffmeyer notifications@github.com:

There should be a low against ISO-8859-1. Still need to author these
changes, I think.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-42050007
.

Yeah, you only get the first version of a post which I corrected in the meantime. I am Sorry to have caused this confusion.