User:Mainframe98/Vagrant

This page describes how to do certain things on MediaWiki-Vagrant.

Running unit tests
I recommend creating a quick script:

Generating test coverage
I recommend creating a quick script:

Unborking Xdebug

 * Xdebug is borked at the moment. You can manually install it using pecl:


 * 1) Install pear wherever. The home directory works fine, as long as you don't mind pear complaining about include paths, which are irrelevant for installing extensions.
 * 2) Download pear with wget http://pear.php.net/go-pear.phar
 * 3) Execute the installer with php go-pear.phar . When prompted, just press enter, the default will do.
 * 4) * The prompt about altering php.ini can be ignored (pass n )
 * 5) Install Xdebug, by running pecl install xdebug . You'll likely need to run this as a user with additional privileges, so prefix this with sudo
 * 6) * Note that the installer does not add pear and pecl to PATH, so you'll need to navigate to the folder with the executable! (which is in the same location as ;  )
 * 7) Add   to
 * 8) Restart apache with sudo systemctl restart apache2
 * 9) Check that Xdebug is installed by navigating to info.php
 * Xdebug should also automatically been updated when using the cli: you can check this by running php -v

Running phan

 * Note: If you use Vagrant on Windows, you don't have to go through all this effort if you have PHP installed under Windows! Provided you have the ast extension installed, Phan runs just fine under Windows.

This is a chore, but T234240 should make this easier.
 * 1) Install phan as a composer dev dependency in MediaWiki.
 * 2) * Navigate to  and run composer require phan/phan --dev
 * 3) * Note: Recent version of MediaWiki use the  package and will install automatically when running composer update
 * 4) Install pear wherever. The home directory works fine, as long as you don't mind pear complaining about include paths, which are irrelevant for running phan.
 * 5) Download pear with wget http://pear.php.net/go-pear.phar
 * 6) Execute the installer with php go-pear.phar . When prompted, just press enter, the default will do.
 * 7) Install the php-ast extension, by running pecl install ast . You'll likely need to run this as a user with additional privileges, so prefix this with sudo
 * 8) * Note that the installer does not add pear and pecl to PATH, so you'll need to navigate to the folder with the executable! (which is in the same location as ;  )
 * 9) Add   to
 * 10) Check that php-ast is installed by running php -m
 * 11) Change the default vagrant memory size, as the default of 1.5G is insufficient to run phan, by creating a   in the vagrant root directory with the following content:
 * You may replace 3072 with any higher value, as this is the new memory size of the vagrant box in megabytes.

You should now be able to run phan with /vagrant/mediawiki/vendor/bin/phan -d PATH_TO_SOMETHING -p

Simple runner
Save this in ~/phan.sh and invoke with ./phan.sh /vagrant/mediawiki.