Jump to content

Topic on Extension talk:Wikibase Repository

Wikibase items show wikitext after update

7
Till Kraemer (talkcontribs)

Hello, I recently upgraded to MediaWiki 1.37.0 and used the settings mentioned here. I'd like to continue using the main namespace for items, so my Wikibase.example.php looks like this:

// Alternative settings, using the main namespace for items.
// Note: if you do that, several core tests may fail. Parser tests for instance
// assume that the main namespace contains wikitext.
$baseNs = 120;

// NOTE: do *not* define WB_NS_ITEM and WB_NS_ITEM_TALK when using a core namespace for items!
define( 'WB_NS_PROPERTY', $baseNs +2 );
define( 'WB_NS_PROPERTY_TALK', $baseNs +3 );
define( 'WB_NS_QUERY', $baseNs +4 );
define( 'WB_NS_QUERY_TALK', $baseNs +5 );

// You can set up an alias for the main namespace, if you like.
//$wgNamespaceAliases['Item'] = NS_MAIN;
//$wgNamespaceAliases['Item_talk'] = NS_TALK;

// No extra namespace for items, using a core namespace for that.
$wgExtraNamespaces[WB_NS_PROPERTY] = 'Property';
$wgExtraNamespaces[WB_NS_PROPERTY_TALK] = 'Property_talk';
$wgExtraNamespaces[WB_NS_QUERY] = 'Query';
$wgExtraNamespaces[WB_NS_QUERY_TALK] = 'Query_talk';

// Tell Wikibase which namespace to use for which kind of entity
$wgWBRepoSettings['entitySources'] = [
	'local' => [
		'entityNamespaces' => [
			'item' => NS_MAIN, // <=== Use main namespace for items!!!
			'property' => WB_NS_PROPERTY, // use custom namespace
			'query' => WB_NS_QUERY, // use custom namespace
		],
		'repoDatabase' => $wgDBname,
		'baseUri' => $wgServer . '/wiki/',
		'rdfNodeNamespacePrefix' => 'wd',
		'rdfPredicateNamespacePrefix' => '',
		'interwikiPrefix' => '',
	],
];

I am able to create new items via Special:NewItem and I can edit them properly. However, all old items aren't editable and look like this:

{"type":"item","id":"Q1","labels":{"en":{
[...]

When I use Special:Export to export the new items, the XML file contains the following lines:

<model>wikibase-item</model>
<format>application/json</format>

The old items contain lines like these:

<model>wikitext</model>
<format>text/x-wiki</format>

The Page information of the old and new items show: Page content model: Wikibase Item. When I try to edit an old item via https://data.domain.com/wiki/Special:SetLabelDescriptionAliases/Q1/en, the following error shows up:

Internal error

[123456789] /wiki/Special:SetLabelDescriptionAliases/Q1/en TypeError: Argument 2 passed to Wikibase\Repo\Notifications\WikiPageActionEntityChangeFactory::newForPageModified() must be an instance of Wikibase\Repo\Content\EntityContent, instance of WikitextContent given, called in /path/to/data/w/extensions/Wikibase/repo/includes/Notifications/ChangeNotifier.php on line 149

Backtrace:

from /path/to/data/w/extensions/Wikibase/repo/includes/Notifications/WikiPageActionEntityChangeFactory.php(82)
#0 /path/to/data/w/extensions/Wikibase/repo/includes/Notifications/ChangeNotifier.php(149): Wikibase\Repo\Notifications\WikiPageActionEntityChangeFactory->newForPageModified()
#1 /path/to/data/w/extensions/Wikibase/repo/includes/RepoHooks.php(254): Wikibase\Repo\Notifications\ChangeNotifier->notifyOnPageModified()
#2 /path/to/data/w/includes/HookContainer/HookContainer.php(338): Wikibase\Repo\RepoHooks::onRevisionFromEditComplete()
#3 /path/to/data/w/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#4 /path/to/data/w/includes/HookContainer/HookRunner.php(3191): MediaWiki\HookContainer\HookContainer->run()
#5 /path/to/data/w/includes/Storage/PageUpdater.php(1255): MediaWiki\HookContainer\HookRunner->onRevisionFromEditComplete()
#6 /path/to/data/w/includes/Storage/PageUpdater.php(833): MediaWiki\Storage\PageUpdater->doModify()
#7 /path/to/data/w/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php(403): MediaWiki\Storage\PageUpdater->saveRevision()
#8 /path/to/data/w/extensions/Wikibase/repo/includes/Store/Sql/WikiPageEntityStore.php(262): Wikibase\Repo\Store\Sql\WikiPageEntityStore->saveEntityContent()
#9 /path/to/data/w/extensions/Wikibase/lib/includes/Store/TypeDispatchingEntityStore.php(85): Wikibase\Repo\Store\Sql\WikiPageEntityStore->saveEntity()
#10 /path/to/data/w/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEntityStore.php(53): Wikibase\Lib\Store\TypeDispatchingEntityStore->saveEntity()
#11 /path/to/data/w/extensions/Wikibase/repo/includes/EditEntity/MediawikiEditEntity.php(735): Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEntityStore->saveEntity()
#12 /path/to/data/w/extensions/Wikibase/repo/includes/EditEntity/StatsdSaveTimeRecordingEditEntity.php(77): Wikibase\Repo\EditEntity\MediawikiEditEntity->attemptSave()
#13 /path/to/data/w/extensions/Wikibase/repo/includes/Specials/SpecialWikibaseRepoPage.php(194): Wikibase\Repo\EditEntity\StatsdSaveTimeRecordingEditEntity->attemptSave()
#14 /path/to/data/w/extensions/Wikibase/repo/includes/Specials/SpecialModifyEntity.php(219): Wikibase\Repo\Specials\SpecialWikibaseRepoPage->saveEntity()
#15 /path/to/data/w/includes/specialpage/SpecialPage.php(647): Wikibase\Repo\Specials\SpecialModifyEntity->execute()
#16 /path/to/data/w/includes/specialpage/SpecialPageFactory.php(1366): SpecialPage->run()
#17 /path/to/data/w/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#18 /path/to/data/w/includes/MediaWiki.php(925): MediaWiki->performRequest()
#19 /path/to/data/w/includes/MediaWiki.php(559): MediaWiki->main()
#20 /path/to/data/w/index.php(53): MediaWiki->run()
#21 /path/to/data/w/index.php(46): wfIndexMain()
#22 {main}

Any help is more than appreciated!

Thanks and cheers,

Till

Till Kraemer (talkcontribs)

I just exported an old item via Special:Export and changed <model>wikitext</model> to <model>wikibase-item</model> and <format>text/x-wiki</format> to <format>application/json</format> in Notepad++. When I try to import the XML file with Special:Import, I get the following message: "Revision 1 using content model wikitext cannot be stored on "Q1" on this wiki, since that model is not supported on that page." This is pretty similar to the message I get when I try to use Special:ChangeContentModel: "No content models available: The content on Item (Q1) cannot be converted to any type."

I temporarily set $wgWBRepoSettings['allowEntityImport'] = true; in LocalSettings.php and imported the XML file with importDump.php. The script ran without any error but the content model didn't change.

I also tried to add $wgWBRepoSettings['entityNamespaces']['CONTENT_MODEL_WIKIBASE_ITEM'] = NS_MAIN; and even $wgNamespaceContentModels[NS_MAIN] = 'CONTENT_MODEL_WIKIBASE_ITEM'; to LocalSettings.php but that didn't solve the problem either.

I don't really understand why the old items and the new items are in the same namespace and still behave differently. @Thiemo Kreuz (WMDE), do you have any idea what could be at play here?

Thanks and cheers,

Till

Lwangaman (talkcontribs)

just a thought... isn't entitySources supposed to be defined on the $wgWbClientSettings array? Looking at the configuration page it seems to be a client setting, not a repo setting?

Lwangaman (talkcontribs)

actually let me correct that... the configuration page doesn't explain very much. Reading the full documentation, I see it is both a client and a repo configuration...

Till Kraemer (talkcontribs)

@Lwangaman, Thank you for the reply! I guess I just have to keep on trying. Maybe one day a new version will be released that fixes my issues :) Cheers and all the best!

Till Kraemer (talkcontribs)

The only way I found to fix this is to create a new item, delete the old item, redirect the old item to the new item, and delete the redirect. With thousands of items, this is a lot of work though. Anyway, it's still a solution. Thanks, cheers and all the best!

Till Kraemer (talkcontribs)
Reply to "Wikibase items show wikitext after update"