Topic on Extension talk:Semantic ACL

Jump to navigation Jump to search

Output of Pages that are Restricted for Reading

7
Summary by Tinss

Set $wgEnablePrivateLinks = false when using MediaWiki 1.31

AID-PMBD (talkcontribs)

Hello,


Mediawiki:1.31

PHP: 7.2

Ubuntu 18.04

SemanticACL: 0.2b (7b98339)


First of all I want to say thank you for creating this extension. It is easy to install, easy to use and works well 10/10 points on that.

My question is about the output that is shown to users that are not allowed to read a page.


On my wiki when accessing those pages a Internal error is returned:

[ce31e7dd85c22f9f4b3a1d91] /pmbd/index.php/Requirements_directory Error from line 376 of /var/www/html/pmbd/extensions/SemanticACL/SemanticACL.class.php: Call to undefined method MediaWiki\MediaWikiServices::getParserFactory()

Backtrace:

#0 /var/www/html/pmbd/extensions/SemanticACL/SemanticACL.class.php(88): MediaWiki\Extension\SemanticACL\SemanticACL::hasPermission(Title, string, User, boolean)

#1 /var/www/html/pmbd/includes/Hooks.php(177): MediaWiki\Extension\SemanticACL\SemanticACL::onSMWStoreAfterQueryResultLookupComplete(SMW\SQLStore\SQLStore, SMW\Query\QueryResult)

#2 /var/www/html/pmbd/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)

#3 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(366): Hooks::run(string, array)

#4 /var/www/html/pmbd/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(338): SMW\SQLStore\SQLStore->getQueryResult(SMWQuery)

#5 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(364): SMWQueryProcessor::getResultFromQuery(SMWQuery, array, integer, integer)

#6 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(197): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters(array, array)

#7 /var/www/html/pmbd/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse(array)

#8 /var/www/html/pmbd/includes/parser/Parser.php(3426): SMW\ParserFunctionFactory->SMW\{closure}(Parser, string, string, string, string, string, string, string)

#9 /var/www/html/pmbd/includes/parser/Parser.php(3127): Parser->callParserFunction(PPFrame_DOM, string, array)

#10 /var/www/html/pmbd/includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPFrame_DOM)

#11 /var/www/html/pmbd/includes/parser/Parser.php(2942): PPFrame_DOM->expand(DOMElement, integer)

#12 /var/www/html/pmbd/includes/parser/Parser.php(1293): Parser->replaceVariables(string)

#13 /var/www/html/pmbd/includes/parser/Parser.php(443): Parser->internalParse(string)

#14 /var/www/html/pmbd/includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)

#15 /var/www/html/pmbd/includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)

#16 /var/www/html/pmbd/includes/poolcounter/PoolWorkArticleView.php(144): AbstractContent->getParserOutput(Title, integer, ParserOptions)

#17 /var/www/html/pmbd/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()

#18 /var/www/html/pmbd/includes/page/Article.php(604): PoolCounterWork->execute()

#19 /var/www/html/pmbd/includes/actions/ViewAction.php(68): Article->view()

#20 /var/www/html/pmbd/includes/MediaWiki.php(500): ViewAction->show()

#21 /var/www/html/pmbd/includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)

#22 /var/www/html/pmbd/includes/MediaWiki.php(861): MediaWiki->performRequest()

#23 /var/www/html/pmbd/includes/MediaWiki.php(524): MediaWiki->main()

#24 /var/www/html/pmbd/index.php(42): MediaWiki->run()

#25 {main}


Is this the default message or is there a way to output a more user-friendly message when a user without permission is trying to access a page? Or maybe the error is on my side?


Thank you and Best Regards

Tinss (talkcontribs)

Thanks for the comments. It's supposed to show a clean message and not a dump like that. The problem is the MediaWiki\MediaWikiServices::getParserFactory() call which is only defined in MediaWiki 1.32, which makes this extension incompatible with 1.31.

Can you easily upgrade you MediaWiki installation?

AID-PMBD (talkcontribs)

Thank you for the quick reply, outstanding support compared to other extensions I had trouble with.


Unfortunately I can't easily upgrade my mediawiki due to multiple extensions that are not supported on newer versions. I guess there is no easy workaround for that issue, right?

AID-PMBD (talkcontribs)

Is there another way to solve this issue?

Tinss (talkcontribs)

I've dug into it and the faulty line is used only for private links. If you do not need that feature, set $wgEnablePrivateLinks = false in you LocalSettings.php.

Then, just comment out line 376 in /var/www/html/pmbd/extensions/SemanticACL/SemanticACL.class.php

Tell me if that works.

AID-PMBD (talkcontribs)

Hello Tinss,


Thank you for taking the time to look into this.


So I tried your approach and when commenting out line 376 of the SemanticACL.class.php ( "$parser =  \MediaWiki\MediaWikiServices::getInstance()->getParserFactory()->create(); // Use a new parser to avoid interfering with the current parser.") it doesn't work. The wiki returns a white page.


What worked however, was just setting $wgEnablePrivateLinks = false in my LocalSettings.php.


Thanks again for the support.

Tinss (talkcontribs)

You're welcome!