Lucas_Werkmeister_WMDE added a comment.
Restricted Application added a project: Wikidata.


  I looked a bit into the Repo settings to see how this could be done. One 
thing that surprised me is that Repo barely uses the “config values can be 
callbacks to compute the real value on-demand” feature, which is used much more 
in Client – in Repo, the only three callbacks are:
  
    'dataRightsUrl' => function() {
        return $GLOBALS['wgRightsUrl'];
    },
    
    'dataRightsText' => function() {
        return $GLOBALS['wgRightsText'];
    },
    
    'conceptBaseUri' => function() {
        $uri = preg_replace( '!^//!', 'http://', $GLOBALS['wgServer'] );
        return $uri . '/entity/';
    },
  
  This might make Repo a much more attractive candidate for porting to 
MediaWiki’s standard config system than Client.
  
  Besides that, if we don’t load the default config in the PHP entry point, 
we’ll have the same problem as in Client (see T256252 
<https://phabricator.wikimedia.org/T256252> and I193008a732 
<https://gerrit.wikimedia.org/r/608663>): if the value from `LocalSettings` 
(written for a Wikibase where the default config was loaded in the PHP entry 
point) and the default value are both nonempty arrays, then we won’t know if 
the two should be merged, or if the `LocalSettings` value should overwrite the 
default value completely.
  
  The default config has the following nonempty arrays:
  
  - `string-limits`: Associative array of arrays. I don’t think we even support 
unsetting any entries of this array (code like 
`WikibaseRepo::getDefaultInstance()->getSettings()->getSetting( 'string-limits' 
)['VT:monolingualtext']` doesn’t seem to account for that option), so 
`wfArrayPlus2d` should be fine.
  
  - `urlSchemes`: List of strings. Probably the biggest problem – we can’t 
distinguish between `$wgWBRepoSettings['urlSchemes'][] = 'gopher';` and 
`$wgWBRepoSettings['urlSchemes'] = [ 'gopher' ];`, and both of these seem to be 
valid things that one might want to do, at least in principle (Gopher 
<https://en.wikipedia.org/wiki/Gopher_(protocol)> is of course a bit silly as 
an example). I think here we’ll have to bite the bullet and introduce a new way 
to remove URL schemes from the list (`$wgWBRepoSettings['mailto'] = false`? 
though then the array has mixed string and numeric keys), and then send an 
email around and tell people to update their configs accordingly.
  
  - `entityDataFormats`. List of strings. I believe the default value is the 
full list of possible entity data formats, so the only useful change to this 
list is to remove entries from it – so the custom value should probably 
overwrite the default value, without merging.
  
  - `canonicalLanguageCodes`: Associative array of strings. I think it would be 
pointless for anyone to remove entries from this, so we can probably use a 
standard `array_merge`. But if we want to support removing canonical language 
codes, we can update our code to treat `false` values like absent keys, and 
then tell people to change `LocalSettings` code like `unset( 
$wgWBRepoSettings['canonicalLanguageCodes']['simple'] );` to something like 
`$wgWBRepoSettings['canonicalLanguageCodes']['simple'] = false;`.
  
  - `globeUris`: Associative array of strings. Behaves like 
`canonicalLanguageCodes`, I’d say.
  
  - `pagePropertiesRdf`: Associative array of arrays. I’m not sure why anyone 
would configure this, to be honest. `wfArrayPlus2d`, I guess, and likewise use 
`false` to support removing a page property?

TASK DETAIL
  https://phabricator.wikimedia.org/T257447

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Tarrow, Aklapper, Lucas_Werkmeister_WMDE, Akuckartz, darthmon_wmde, 
Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, 
rosalieper, Scott_WUaS, Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to