Semanticmediawiki: Error when you search a rule and an internal error when you access via URL

Created on 23 Feb 2018  路  8Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.0.0-alpha
  • MW version: 1.30.0
  • PHP version: MariaDB
  • DB system (MySQL, Blazegraph, etc.) and version: MariaDB 10.1.26-MariaDB-0+deb9u1

Issue

I installed a new MediaWiki 1.30.0 with git to have it for tests of Semantic MediaWiki and another extensions. Then I made a clone of my SMW's fork, merged with the last version of this repo. When I activated SMW, it didn't works with my clone, so I changed the name of the directory, then I made a build of my fork and finally I move it to the MW's extension directory. It works fine!

If I try to create properties, concepts, whatever, I can. But if I try to create rules I can't. I tested it before to make the translations of the namespace (#3023) and then, but I get the same errors:

  1. If I search one rule and it does not exist, it does not ask me if I want to create the rule. But it does not report any error.
    it does not ask me if I want to create the rule

  2. At this situation I thought to try to create writting directly the rule in the URL, like http://localhost/core/index.php/Rule:Test. But it reports an internal error.

internal error

Stack trace

[6f264221c56d6dc79ab01d9c] /core/index.php/Regla:Test Error from line 135 of /home/ivanhercaz/Apps/www/core/extensions/SemanticMediaWiki/src/Page/RulePage.php: Call to a member function get() on null

Backtrace:

#0 /home/ivanhercaz/Apps/www/core/extensions/SemanticMediaWiki/src/Page/Page.php(107): SMW\Page\RulePage->afterHtml()
#1 /home/ivanhercaz/Apps/www/core/includes/actions/ViewAction.php(68): SMW\Page\Page->view()
#2 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(499): ViewAction->show()
#3 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(293): MediaWiki->performAction(SMW\Page\RulePage, Title)
#4 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(851): MediaWiki->performRequest()
#5 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(523): MediaWiki->main()
#6 /home/ivanhercaz/Apps/www/core/index.php(43): MediaWiki->run()
#7 {main}

Steps to reproduce

Maybe making the same steps that I explained in the issue.


Thanks in advance!
Iv谩n

bug

All 8 comments

Thanks a lot for reporting! A fix is already in place.

More details about this bug

  1. In #3023, @mwjames tell me:
    >Only users with the smw-ruleedit right can create a rule page with Special:Search checking whether s(he) can actually create such page and shows a link (red or blue) if it meets that constraint.

I checked the rights of my user and it has not the right smwadministrator, so I add it to this group and then check if it can create a rule page. It works, the user needs to be an administrator of SMW, but when I save the rule page with just { }, it throw another internal error.

Stacktrace

[3cd88b086320416623d605bd] /core/index.php?title=Regla:Test&action=submit SMW\Rule\Exception\RuleTypeNotFoundException from line 103 of /home/ivanhercaz/Apps/www/core/extensions/SemanticMediaWiki/src/Rule/RuleFactory.php: is an unrecognized rule type.

Backtrace:

#0 /home/ivanhercaz/Apps/www/core/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/NewRevisionFromEditComplete.php(89): SMW\Rule\RuleFactory->newRuleDefinition(string, array)
#1 /home/ivanhercaz/Apps/www/core/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/HookRegistry.php(388): SMW\MediaWiki\Hooks\NewRevisionFromEditComplete->process()
#2 /home/ivanhercaz/Apps/www/core/includes/Hooks.php(177): SMW\MediaWiki\Hooks\HookRegistry->SMW\MediaWiki\Hooks\{closure}(WikiPage, Revision, boolean, User)
#3 /home/ivanhercaz/Apps/www/core/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#4 /home/ivanhercaz/Apps/www/core/includes/page/WikiPage.php(1879): Hooks::run(string, array)
#5 /home/ivanhercaz/Apps/www/core/includes/page/WikiPage.php(1627): WikiPage->doCreate(JsonContent, integer, User, string, array)
#6 /home/ivanhercaz/Apps/www/core/includes/EditPage.php(2203): WikiPage->doEditContent(JsonContent, string, integer, boolean, User, string, array, integer)
#7 /home/ivanhercaz/Apps/www/core/includes/EditPage.php(1514): EditPage->internalAttemptSave(array, boolean)
#8 /home/ivanhercaz/Apps/www/core/includes/EditPage.php(667): EditPage->attemptSave(array)
#9 /home/ivanhercaz/Apps/www/core/includes/actions/EditAction.php(60): EditPage->edit()
#10 /home/ivanhercaz/Apps/www/core/includes/actions/SubmitAction.php(38): EditAction->show()
#11 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(499): SubmitAction->show()
#12 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(293): MediaWiki->performAction(SMW\Page\RulePage, Title)
#13 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(851): MediaWiki->performRequest()
#14 /home/ivanhercaz/Apps/www/core/includes/MediaWiki.php(523): MediaWiki->main()
#15 /home/ivanhercaz/Apps/www/core/index.php(43): MediaWiki->run()
#16 {main}

Solved internal error when you access to Rule:*

The last internal error I reported has been solved correctly, both a SMW's administrator and a user without permissions can access to this namespace.

There is not a smw-ruleedit permission

permisos de usuario testwiki

I checked the rights of my user and it has not the right smwadministrator, so I add it to this group and

The right by default was added to the smwcurator role.

There is not a smw-ruleedit permission

See https://sandbox.semantic-mediawiki.org/wiki/Sp%C3%A9cial:Liste_des_droits_de_groupe.

I checked the rights of my user and it has not the right smwadministrator, so I add it to this group and then check if it can create a rule page. It works, the user needs to be an administrator of SMW, but when I save the rule page with just { }, it throw another internal error.

This is the expected behaviour because you try to save an improper (aka empty) rule as noted by "SMW\Rule\Exception\RuleTypeNotFoundException from line 103 of /home/ivanhercaz/Apps/www/core/extensions/SemanticMediaWiki/src/Rule/RuleFactory.php: is an unrecognized rule type."

@mwjames, if I try to create a rule page empty, without { }, I get the next notice and I can not to publish the page: Datos de contenido incorrectos (in English, Incorrect content data). So, if a rule page can not be created with just { }, I think maybe interesting to configure a similar error to replace this internal error. It might be easier to solve by someone.

So, if a rule page can not be created with just { }, I think maybe interesting to configure a similar error to replace this internal error. It might be easier to solve by someone.

No, you cannot and you should not because it doesn't make sense. Any rule needs a type and the type is registered as noted in #3019 therefore trying to create something that isn't valid will cause an exception. Surely it is debatable whether a better user notice should be shown or not but currently the Exception is enough to ensure data consistency by not having gost pages (i.e. content that is not assigned to a type or for that matter a schema) stored.

@mwjames, I did not say that SMW allows to create a rule page with errors. Of course, you are right, the Exception is enough, I just say that maybe the best way to inform the user about this error is making a notice, because it might be easy to understand by anyone.

@mwjames, I did not say that SMW allows to create a rule page with errors.
Of course, you are right, the Exception is enough, I just say that maybe
the best way to inform the user about this error is making a notice, because
it might be easy to understand by anyone.

That would require some effort which I currently cannot spare
therefore any attempt to store an invalid rule will cause an exception
which may change in future.

On 2/24/18, Iv谩n notifications@github.com wrote:

@mwjames, I did not say that SMW allows to create a rule page with errors.
Of course, you are right, the Exception is enough, I just say that maybe
the best way to inform the user about this error is making a notice, because
it might be easy to understand by anyone.

--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/3022#issuecomment-368231018

Was this page helpful?
0 / 5 - 0 ratings