Page MenuHomePhabricator

MediaWiki is not a library, so it should define a custom type in composer.json
Closed, ResolvedPublic

Description

Problem
MediaWiki's composer.json does not define a type which means it uses the default type of library.

This means the installation directory (the web root) cannot be customized by installers like Composer Installers.

Solution
Set the type to mediawiki-core which is similar to what other projects do.

Event Timeline

dbarratt created this task.Mar 22 2018, 5:13 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 22 2018, 5:13 AM

Change 421212 had a related patch set uploaded (by Dbarratt; owner: Dbarratt):
[mediawiki/core@master] Set the package type to 'mediawiki-core'

https://gerrit.wikimedia.org/r/421212

Sounds sensible.

A custom type doesn't mean that you have to have an installer to match that type does it? Just that it is possible to?

Sounds sensible.

A custom type doesn't mean that you have to have an installer to match that type does it? Just that it is possible to?

Correct.

It's similar to what Drupal does:
https://github.com/drupal/drupal/blob/8.6.x/core/composer.json#L4

Though as you pointed out, Drupal does wrap the "core" cms with a wrapper (within the same repo), our "project" wrapper would be in a different repo, see: T166956: Cannot use Composer's CLI to manage a project's dependencies

Should it be "cms" then?

Should it be "cms" then?

It can be.. but that's not one that Composer Installers currently supports:
http://composer.github.io/installers/
they do support drupal-core ... we could ask though which they would prefer... maybe Drupal should be the one to change. :P

Legoktm added a subscriber: Legoktm.Apr 9 2018, 9:20 PM

Will this make any functional difference?

dbarratt added a comment.EditedApr 9 2018, 9:36 PM

Will this make any functional difference?

If you have composer/installers installed, executing composer require mediawiki/core will copy mediawiki into ./core (new functionality) instead of ./vendor/mediawiki/core (current functionality).

As far as our current workflow(s) goes, no, this shouldn't make any functional difference, it only makes a difference if your project requires mediawiki/core (which, afaik, nobody is doing). Right now, it would be broken anyways because it would be installed in the vendor directory.

I should note that if you do not have composer/installers installed (or any other installer plugin that can handle the mediawiki-core type), it will continue to work as it currently does, downloading mediawiki/core into ./vendor/mediawiki/core.

Krinkle added a subscriber: Krinkle.EditedApr 11 2018, 1:50 AM

Right now, it would be broken anyways because it would be installed in the vendor directory.

Not necessarily cause for breakage. Wikimedia's production also uses a wrapper, called multiversion (MWMultiVersion). Which uses a slimmed down public root, in which only a few entry points like index.php exist, and certain static resources are exposed. This isn't unlike WordPress's approach to entry points.

In turn, these entry points include MediaWiki and run it. The current directory name used there is ../php-master (Beta Cluster) and e.g. ../php-1.31.0-wmf.29 (wmf production).

Right now, it would be broken anyways because it would be installed in the vendor directory.

Not necessarily cause for breakage. Wikimedia's production also uses a wrapper, called multiversion (MWMultiVersion). Which uses a slimmed down public root, in which only a few entry points like index.php exist, and certain static resources are exposed. This isn't unlike WordPress's approach to entry points.

In turn, these entry points include MediaWiki and run it. The current directory name used there is ../php-master (Beta Cluster) and e.g. ../php-1.31.0-wmf.29 (wmf production).

Can you point me to the repo for this? (I'm having trouble finding it). Though.. given that we have a MediaWiki-Vendor, I doubt they are loading core with Composer, but I can double check.

Would someone mind giving this patch a +2? https://gerrit.wikimedia.org/r/c/421212/

Change 421212 merged by jenkins-bot:
[mediawiki/core@master] Set the package type to 'mediawiki-core'

https://gerrit.wikimedia.org/r/421212