Thread:Talk:Requests for comment/Extension management with Composer/MediaWiki compatibility/reply (2)

I had a long chat with simensen on #composer about this. We came to the conclusion that having "provide": { "mediawiki/mediawiki": "$wgVersion" } in the root composer.json. This then allows extensions to specify which MW versions they are compatible with. Still figuring out how to best implement this.

Actually putting this code into the file is somewhat problematic, as it needs to be updated whenever the MW version changes. Having users do this manually is clearly problematic. Thus we either need to automatically update this, or not actually have the info be in the file itself, but rather added problematically via a Composer hook.

I tried using the Composer scripts system, which unfortunately gets initialized too late to add things to the provide section. Then I tried using the plugin mechanism and having the handling code in MediaWiki itself. This also did not work, as the plugin system apparently requires using a dedicated package. My third try was updating the version on run of update.php, for which I have code here. This is also not going to work, as MediaWiki is already loaded when this script runs, and would thus require a re-run or some other silliness.

A regular plugin (in its own package) could presumably be used, though it'd first need to be installed. This thus requires running composer install before adding any extensions to composer.json. That sucks.

I'll further poke people about this. Perhaps a new hook in Composer is needed, or an enhancement to the plugin system.