Last modified: 2014-07-12 12:32:49 UTC
I added a setting for badgeItems: $wgWBRepoSettings['badgeItems'] = array( 'Q337', 'Q338' ); Then tried to use Special:SetSiteLink to add a badge, entering Q337 and encountered an uncaught exception. 1) not sure I am setting badgeItems correctly. It is not documented in docs/options.wiki nor does Wikibase.default.php (in repo/config) explain the setting. 2) I think a bit more handling of exceptions is needed in the special page to take care of edge cases and whatnot, like this. Unexpected non-MediaWiki exception encountered, of type "InvalidArgumentException" [c0399059] /wiki/Special:SetSiteLink Exception from line 78 of /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/ChangeOp/ChangeOpSiteLink.php: Only items specified in the config can be badges Backtrace: #0 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php(458): Wikibase\ChangeOp\ChangeOpSiteLink->__construct(string, string, array) #1 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php(159): Wikibase\Repo\Specials\SpecialSetSiteLink->setSiteLink(Wikibase\DataModel\Entity\Item, string, string, array, Wikibase\Summary) #2 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialModifyEntity.php(92): Wikibase\Repo\Specials\SpecialSetSiteLink->modifyEntity(Wikibase\DataModel\Entity\Item) #3 /Library/WebServer/Documents/php-master/includes/specialpage/SpecialPage.php(379): Wikibase\Repo\Specials\SpecialModifyEntity->execute(NULL) #4 /Library/WebServer/Documents/php-master/includes/specialpage/SpecialPageFactory.php(503): SpecialPage->run(NULL) #5 /Library/WebServer/Documents/php-master/includes/Wiki.php(285): SpecialPageFactory::executePath(Title, RequestContext) #6 /Library/WebServer/Documents/php-master/includes/Wiki.php(588): MediaWiki->performRequest() #7 /Library/WebServer/Documents/php-master/includes/Wiki.php(447): MediaWiki->main() #8 /Library/WebServer/Documents/php-master/index.php(46): MediaWiki->run() #9 {main}
see also bug: 63036
When entering an invalid item id for a badge, I am now getting: Unexpected non-MediaWiki exception encountered, of type "Wikibase\DataModel\Entity\EntityIdParsingException" [f93cbde6] /wiki/Special:SetSiteLink Exception from line 64 of /Library/WebServer/Documents/php-master/extensions/Wikibase/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php: The provided id serialization "gjklsgs" is not valid Backtrace: #0 /Library/WebServer/Documents/php-master/extensions/Wikibase/vendor/wikibase/data-model/src/Entity/DispatchingEntityIdParser.php(45): Wikibase\DataModel\Entity\DispatchingEntityIdParser->throwInvalidId(string) #1 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php(378): Wikibase\DataModel\Entity\DispatchingEntityIdParser->parse(string) #2 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php(451): Wikibase\Repo\Specials\SpecialSetSiteLink->parseBadges(array, Status) #3 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php(159): Wikibase\Repo\Specials\SpecialSetSiteLink->setSiteLink(Wikibase\DataModel\Entity\Item, string, string, array, Wikibase\Summary) #4 /Library/WebServer/Documents/php-master/extensions/Wikibase/repo/includes/specials/SpecialModifyEntity.php(102): Wikibase\Repo\Specials\SpecialSetSiteLink->modifyEntity(Wikibase\DataModel\Entity\Item) #5 /Library/WebServer/Documents/php-master/includes/specialpage/SpecialPage.php(379): Wikibase\Repo\Specials\SpecialModifyEntity->execute(NULL) #6 /Library/WebServer/Documents/php-master/includes/specialpage/SpecialPageFactory.php(503): SpecialPage->run(NULL) #7 /Library/WebServer/Documents/php-master/includes/Wiki.php(285): SpecialPageFactory::executePath(Title, RequestContext) #8 /Library/WebServer/Documents/php-master/includes/Wiki.php(596): MediaWiki->performRequest() #9 /Library/WebServer/Documents/php-master/includes/Wiki.php(448): MediaWiki->main() #10 /Library/WebServer/Documents/php-master/index.php(46): MediaWiki->run() #11 {main}
Change 131023 had a related patch set uploaded by Aude: Improve badge handling in SpecialSetSiteLink and fix uncaught exception https://gerrit.wikimedia.org/r/131023
Change 131023 abandoned by Aude: Improve badge handling in SpecialSetSiteLink, using ExceptionLocalizer Reason: this needs to be split into multiple patches, and maybe put more of the badge handling with ChangeOpSiteLink https://gerrit.wikimedia.org/r/131023
Bug 61664 fixes this as a side effect AFAIS