Topic on Extension talk:Wikibase Repository

Till Kraemer (talkcontribs)

Hi, thank you for an awesome extension, I love it! :) One question though: when I create a property "image" with data type "Commons media file", I can only select files from Commons in the statements section. I'd like to use images from my own pool exclusively and I'd like to rename "Commons media file" to "Pool media file". How can I achieve this?

My Wikibase.example.php looks like this:

# $wgWBRepoSettings['specialSiteLinkGroups'] = array( 'commons', 'wikidata' );
$wgWBRepoSettings['specialSiteLinkGroups'] = array( 'pool', 'data' );

The "sites" table on the datawiki database has this row (among others):

| 123 | poolwiki | mediawiki | pool | local | en | https | moc.niamod.loop.  | a:1:{s:5:"paths";a:2:{s:9:"file_path";s:28:"$1";s:9:"page_path";s:31:"$1";}} | 0 | a:0:{} |

And the "sites" table of the poolwiki database has this entry (among others):

| 124 | datawiki | mediawiki | data| local | en | https | moc.niamod.atad. | a:1:{s:5:"paths";a:2:{s:9:"file_path";s:28:"$1";s:9:"page_path";s:31:"$1";}} | 0 | a:0:{} |

LocalSettings.php of datawiki has this line:

$wgWBRepoSettings['localClientDatabases'] = array( 'dewiki', 'enwiki', poolwiki' );

What am I missing here? Any help is more than welcome! Thanks and cheers!

Lydia Pintscher (WMDE) (talkcontribs)

Hey :) It is currently not possible unfortunately. We have an open issue for it at phabricator:T90492.

Till Kraemer (talkcontribs)

Hi @Lydia Pintscher (WMDE), thanks for your help! Sorry, I didn't know that there is already a discussion about it going on.

I changed // to in Wikidata/extensions/Wikibase/lib/includes/Formatters/CommonsLinkFormatter.php and to in Wikidata/extensions/ValueView/lib/jquery.ui/jquery.ui.commonssuggester.js.

Now the files of my pool show up in the statements section, but when I try to save them, I'm getting the following error: "The file "Lalala123.jpg" does not exist on Wikimedia Commons." I also set $commonsWikiId = 'poolwiki'; in Wikidata/extensions/Constraints/includes/ConstraintCheck/Checker/CommonsLinkChecker.php, but it still doesn't work.

Do you know what other file(s) I have to edit or do I just have to clear some cache? Or do you mean by "not possible" it actually is not possible? :)

Daniel Kinzler (WMDE) (talkcontribs)

Hi Till! You need to also change the URL hardcoded in wikidata/extensions/Wikibase/repo/includes/CachingCommonsMediaFileNameLookup.php

Till Kraemer (talkcontribs)

Hi @Daniel Kinzler (WMDE), thanks for your help! Sorry, you're right, I totally missed that one. And I found another file with a hardcoded URL in it: Wikidata/extensions/Wikibase/repo/includes/WikibaseRepo.php. I changed that file too, but I'm still getting the error mentioned above. I'll keep digging :) Cheers!

Codeispoetry (talkcontribs)

Maybe the existence-check for the validation is done directly through the database?

Till Kraemer (talkcontribs)

Hi @Codeispoetry, thanks for your suggestion! I've found commonsMedia in wb_property_info and some stuff in l10n_cache but no URL :/ Cheers!

Till Kraemer (talkcontribs)

Hi, I'm trying to create a list of files which need to be changed in order to use own images on the repo. I changed the following files (MediaWiki 1.31):

  • Wikibase/view/lib\wikibase-data-values-value-view/lib/jquery.ui/jquery.ui.commonssuggester.js (line 181)
  • Wikibase/lib/includes/Formatters/CommonsLinkFormatter.php (line 62)
  • Wikibase/repo/includes/CachingCommonsMediaFileNameLookup.php (line 66)
  • Wikibase/repo/includes/Rdf/RdfVocabulary.php (lines 57 and 59)
  • Wikibase/view/lib/wikibase-data-values-value-view/src/jquery.valueview.valueview.js (line 195)
  • Wikibase/view/lib/wikibase-data-values-value-view/src/experts\CommonsMediaType.js (line 30)
  • Wikibase/repo/i18n/* (around line 87 to 175, depending on the language [search for "wikibase-validator-no-such-media"])
  • Wikibase/lib/i18n/* (around line 19 to 109, depending on the language [search for "datatypes-type-commonsMedia"])
  • Wikibase/client/config/WikibaseClient.default.php (lines 241 and 246, probably not related though and probably should be changed via LocalSettings.php, see Wikibase/docs/
  • Wikibase/repo/config/Wikibase.default.php (lines 216, 221, 224 and 229)

It's still not working :/ The file names and thumbs show up in the statements section, but when I try to save an image, the old error appears: "Could not save due to an error. The file "Lalala123.jpg" does not exist on MyWiki Pool."

Do I need to change the files in the Wikibase tests folders too? Do I need to change the database name from commonswiki to mypoolwiki somewhere?

Any ideas are more than welcome! Thanks and cheers!

Reply to "Using own images"