Last modified: 2014-09-09 11:50:35 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60991, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58991 - Special:Ask / template output shows SMW::on and SMW::off in SMW 1.9
Special:Ask / template output shows SMW::on and SMW::off in SMW 1.9
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-27 13:22 UTC by Jaider Andrade Ferreira
Modified: 2014-09-09 11:50 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jaider Andrade Ferreira 2013-12-27 13:22:06 UTC
With SMW 1.8, I have no "SMW::on" and "SMW::off" links showing in the template result format:
Look:
http://wikincat.org/w/index.php?title=Especial:Consultar&q=%5B%5BTitleProperOfSeries%3A%3AO+mochileiro+das+gal%C3%A1xias%5D%5D&p=format%3Dtemplate%2Flink%3Dnone%2Ftemplate%3DResult-20list&po=%3FWikiTitleAndSubtitle%0A%3FStatementOfResponsibilityRelatingToTitleProper%0A%3FDesignationOfEdition%0A%3FPlaceOfPublication%0A%3FPublishersName%0A%3FAuthor%0A%3FSubjectTopic%0A%3FDateOfPublication%0A%3FIsbn

The template used is very simple: http://wikincat.org/w/index.php?title=Predefini%C3%A7%C3%A3o:Result_list&action=edit

If this behavior is my fault, what I am doing wrong?

MediaWiki: 1.22.0 (6071399)
PHP	5.4.17 (cgi-fcgi)
MySQL	5.5.32-cll-lve

Semantic MediaWiki (1.9-RC1)
Semantic Result Formats (1.9 beta)
Comment 1 MWJames 2013-12-27 14:32:40 UTC
Only template parsing in Special:Ask [[SMW::off]]/[[SMW::on]] is distorted because [1] fails to enter parsing due to $wgParser->getTitle() and $wgParser->getOptions() being null.

I'm not aware of that anyone has worked on this part ([1] and [2] are the same for master and 1.8.0.5) therefore I can't tell why the behaviour are suppose the be different.

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/queryprinters/ResultPrinter.php#L293

[2] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/1.8.0.5/includes/queryprinters/SMW_ResultPrinter.php#L282

PS: Checked the output of $wgParser->getOptions()/$wgParser->getOptions() using var_dump() in Special:ask which yields null.
Comment 2 Jaider Andrade Ferreira 2013-12-27 14:45:06 UTC
I don't know if this helps, but the problem appears in Special:RunQuery, too (from SemanticForms), not only in Special:Ask.

See: http://wikincat.org/wiki/Special:RunQuery/AdvancedSearch
(type "wiki", for example, in the first entry field).
Comment 3 MWJames 2013-12-27 14:52:00 UTC
(In reply to comment #2)
> I don't know if this helps, but the problem appears in Special:RunQuery, too
> (from SemanticForms), not only in Special:Ask.

This is due to the "special" status of a SpecialPages where parsing is handled differently in MW in comparison to a standard page.

The issue appears to be the $wgParser stubobject initialization.

[1] https://www.mediawiki.org/wiki/Manual:$wgParser
Comment 4 MWJames 2013-12-27 15:07:23 UTC
As an easy fix, just remove [1], [2].

[3] was set for a reason (exists at least since 1.8) which is why the SpecialPage like Ask or RunQuery will show [[SMW::off]]/[[SMW::on]] for a template output.

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/queryprinters/ResultPrinter.php#L303

[2] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/queryprinters/ResultPrinter.php#L304

[3] $result = '[[SMW::off]]' . $result . '[[SMW::on]]';
Comment 5 Jaider Andrade Ferreira 2013-12-27 15:19:14 UTC
Ok, thanks.
This fix the Special:Ask, but not the Special:RunQuery.
Comment 6 MWJames 2013-12-28 10:11:57 UTC
I was looking at the wrong cause and while the above analysis is certainly not wrong, the reason why the parsing is excluded for Specialpages is that in order to avoid unnecessary parsing and performance degradation [1] checks whether a page is a special page or not and only in a case it is a normal page it uses the SMW\ContentProcessor to process SMW's annotations.

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/hooks/InternalParseBeforeLinks.php#L54
Comment 7 MWJames 2013-12-28 10:24:16 UTC
I need some time to think this over since I don't want to make the check arbitrary towards Specialpages. Maybe use something like [1] and only allow specific SpecialPages to pass (setting that tells which Specialpages are allowed to pass).

[1] $this->parser->getTitle()->isSpecial( 'Ask' ) || $this->parser->getTitle()->isSpecial( 'RunQuery' )
Comment 8 MWJames 2013-12-28 12:25:52 UTC
[1] should allow to use SMW's internal content processor for listed Specialpages (earlier suggestions for a fix should be reverted in favour of [1]).

Default setting is (deployed with SMW-core):
$GLOBALS['smwgEnabledSpecialPage'] = array( 'Ask' );

In case of SF, [2] should be added to the LocalSettings.

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/59

[2] $GLOBALS['smwgEnabledSpecialPage'] = array( 'Ask', 'RunQuery' );
Comment 9 Jaider Andrade Ferreira 2013-12-28 13:12:15 UTC
Yes, this fixes the problem. Thanks again.
I am not a developer and I don't know PHP, but I put 

$smwgEnabledSpecialPage = array( 'Ask', 'RunQuery' );

in LocalSettings.php, instead of 

$GLOBALS['smwgEnabledSpecialPage'] = array( 'Ask', 'RunQuery' );

Is this fine, too? Right?
Comment 10 MWJames 2013-12-28 13:14:19 UTC
(In reply to comment #9)
> Yes, this fixes the problem. Thanks again.
> I am not a developer and I don't know PHP, but I put 
> 
> $smwgEnabledSpecialPage = array( 'Ask', 'RunQuery' );

This works as well.
Comment 11 MWJames 2014-01-02 17:48:34 UTC
Merged with master

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links