User:NNikkhoui (WMF)/Useful Commands

Run phpunit test for given file:

mw docker mediawiki exec -- php tests/phpunit/phpunit.php ./tests/phpunit/unit/includes/...

Lint and fix PHP

mw docker mediawiki exec -- php vendor/bin/phpcbf -p ./path/to/file\

Run mocha API integration tests

./node_modules/.bin/mocha <test-file-or-dir> --timeout 0

Login to mw cli MySQL docker container

mw docker mysql exec -- bash

Connect to Sqlite database

$ mw docker mediawiki exec bash --user root</code>
$ apt update
$ apt install sqlite3
$ cd /var/www/html/w/cache/docker
$ sqlite3
$ .open default.sqlite
  • Become root to query db
mysql --user root --password
password: toor


Reset MySQL password <ref>https://stackoverflow.com/questions/9695362/macosx-homebrew-mysql-root-password<ref>

$ brew services stop mysql
$ pkill mysqld
$ rm -rf /usr/local/var/mysql/ # NOTE: this will delete your existing database!!!
$ brew postinstall mysql
$ brew services restart mysql
$ mysql -uroot
root@localhost $ ALTER USER 'root'@'localhost' IDENTIFIED BY 'MYPWDHERE';