Page MenuHomePhabricator

Have vagrant provision run composer install
Closed, InvalidPublic

Description

After running git pull on the /vagrant/mediawiki directory, I got this error:

Fatal error: Class 'Cdb\Reader' not found in /vagrant/mediawiki/includes/cache/LocalisationCache.php on line XXX

and while the reason was easy to guess (Cdb has been vendorized), I wasted some time figuring out what to do to update it (vagrant provision, vagrant reload, setup.sh, git pull on the vagrant repo...) as I thought the vendor directory is maintained by vagrant.

I can see the logic in not updating automatically, as MediaWiki and extension code is also not updated automatically after the initial install; still I wonder if vagrant provision should always re-run composer install so that users have to remember one less thing. composer install does not touch already installed libraries, so no code gets updated without the user's consent, it just the ones which have been added to mediawiki/composer.json, and have not been installed at all yet. That seems fairly harmless to me, and in line with the general logic of vagrant doing the first install and not touching anything after that.


Version: unspecified
Severity: enhancement

Details

Reference
bz73672

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:57 AM
bzimport set Reference to bz73672.
bzimport added a subscriber: Unknown Object (MLST).

Also, maybe vagrant provision should run composer self-update?

composer install does not touch already installed libraries, so no code gets
updated without the user's consent, it just the ones which have been added to
mediawiki/composer.json, and have not been installed at all yet

Actually that's not true (yeah, yeah, I should test before I file). Install does not do anything at all if there is a lock file, and update has no option to only touch completely missing packages, so there does not seem to be a way to say "add missing packages but don't touch existing ones". Probably not a good idea anyway as it would result in inconsistent versions of the vendor packages.

(In reply to Tisza Gergő from comment #2)

composer install does not touch already installed libraries, so no code gets
updated without the user's consent, it just the ones which have been added to
mediawiki/composer.json, and have not been installed at all yet

Actually that's not true (yeah, yeah, I should test before I file). Install
does not do anything at all if there is a lock file, and update has no
option to only touch completely missing packages, so there does not seem to
be a way to say "add missing packages but don't touch existing ones".
Probably not a good idea anyway as it would result in inconsistent versions
of the vendor packages.

vagrant git-update takes care of this sort of thing by calling composer update --no-interaction --optimize-autoloader after the gut pulls but before running update.php.

http://www.mediawiki.org/wiki/MediaWiki-Vagrant says:

"Use vagrant git-update to keep your git repositories and database schema up to date. This command is equivalent of performing git pull for core and all extension directories, followed by running the update.php script."

Is this documentation out of date in that 'vagrant git-update' does other things too?

I updated the wiki doc in https://www.mediawiki.org/w/index.php?title=MediaWiki-Vagrant&diff=1360276&oldid=1360231. Mention of skins git updates and composer execution was missing. I also repurposed @brion's warning note to describe how to manually check to see of composer update is needed.