Page MenuHomePhabricator

Provide and maintain "pattern" to extract configuration information from operations/mediawiki-config
Closed, DeclinedPublic

Description

operations/software's maintain-replicas/maintain-replicas.pl parses operations/mediawiki-config's wmf-config/InitialiseSettings.php and queries the online API of the individual wikis to extract information about namespaces or case sensitivity of page titles. This is overly complex for a simple task and introduces a number of possible points of failures (change of syntax, network issues, etc.).

Instead there should be a published and updated pattern on how to extract the information directly in PHP from operations/mediawiki-config. In T50626, @liangent and I played around a bit with something like:

include ($MediaWikiRepoPath . "/includes/Defines.php");
include ($WmfConfigRepoPath . "/wmf-config/InitialiseSettings.php");
var_dump ($wgConf->settings);

but it didn't yield all the wanted information.

A solution that only requires the source code repositories, but no network access & Co. would not only profit maintain-replicas.pl, but also other (Labs and not-Labs) tools that need to query this data.

Event Timeline

scfc created this task.Jul 26 2015, 6:35 PM
scfc raised the priority of this task from to Needs Triage.
scfc updated the task description. (Show Details)
scfc added subscribers: scfc, liangent.
Restricted Application added subscribers: Matanya, Aklapper. · View Herald TranscriptJul 26 2015, 6:35 PM

You're still not going to be able to catch things that extensions create via hooks/registration callbacks.

but it didn't yield all the wanted information.

What is missing?

scfc added a comment.Jul 28 2015, 3:14 AM

The output was just a dump of InitialiseSettings.php, without the "inheritance", so the only information about dewiki for example was the time zone data, because the rest is default.

If I clone mediawiki/core and operations/mediawiki-config and run:

<?php
include ( 'core/includes/Defines.php' );
include ( 'mediawiki-config/wmf-config/CommonSettings.php' );

that fails with:

scfc@tools-bastion-01:/tmp/tmp.dN3AgdCytQ$ php test.php 
No MWMultiVersion instance initialized! MWScript.php wrapper not used?
scfc@tools-bastion-01:/tmp/tmp.dN3AgdCytQ$

Last time IIRC I dug further, but never got it to work. I'm sure this is absurdly trivial to others :-).

Regarding hooks and callbacks, those will be set up in CommonSettings.php, so the information queried should reflect any changes extensions make.

The code in operations/mediawiki-config is not a stable API. Use the actual API. If something that is needed isn't exposed via the API, file a bug for it please.

Krenair closed this task as Declined.Aug 12 2015, 7:07 PM
Krenair claimed this task.

Declining per @Legoktm

scfc added a comment.Aug 12 2015, 8:01 PM

(NB: Declined is fine with me.)

The code in operations/mediawiki-config is not a stable API. Use the actual API. If something that is needed isn't exposed via the API, file a bug for it please.

That was what this task was about: Providing a stable "API" for operations/mediawiki-config. Something that can be queried offline, or for a change that is no longer/not yet online, etc., with the results being "stable", i. e. not being influenced by anything that isn't under the control of the person who is running the query.