Talk:MediaWiki-Vagrant/Advanced usage

From mediawiki.org
Latest comment: 1 year ago by Tgr (WMF) in topic Vim + XDebug

xdebug.ini[edit]

I didn't have to set any of those settings. The remote_debug role was enough (although it does not seem to include all the listed settings). Is this section no longer applicable? Superm401 - Talk 06:32, 10 October 2013 (UTC)Reply

Debug tests[edit]

Does anybody know how to debug the phpunit test with phpstorm? In principal this should be possible http://blog.loftdigital.com/phpstorm-phpunit-and-vagrant--Physikerwelt (talk) 11:38, 9 February 2014 (UTC)Reply

Specify MediaWiki version/branch to work on[edit]

It feels uncertain on how I should specify which MediaWiki version I want to work on. Say, I have a set of modules configured in a specific version (e.g. wmf/1.24wmfXX) and I want to increment that version, and the submodules without a cluster**** of errors. Is there a better way than going in each submodule and dealing with Git submodules manually, is that implemented, how is it called?

PS: I know of Composer, but not all modules are using it, that’s not what I’m searching for, but rather a polyfill or a way, using puppet, of doing so... if there is one.

Vim + XDebug[edit]

Here are some instructions for using XDebug with Vim. I doubt it's something people would want to use (I only needed it to debug my normal debugger) but since I did set it up, I can as well as write it down...

Vim[edit]

Vim is not the most convenient debugger, but it has the benefit that you can easily set it up on the Vagrant box, so it doesn't matter what your host OS is.

To install:

  • ssh into Vagrant
  • install Vim Python 3 support with sudo apt-get update; sudo apt install vim-nox
  • run git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  • create ~/.vimrc and include the following configuration snippet:
    " Vundle
    set nocompatible
    filetype off
    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    Plugin 'VundleVim/Vundle.vim'
    Plugin 'vim-vdebug/vdebug'
    call vundle#end()
    filetype plugin indent on
    
  • save, exit vim, open it again and issue the :PluginInstall vim command
  • edit your PHP config (e.g. /etc/php/7.2/apache2/conf.d/20-_remote_debug.ini if you don't mind it getting overwritten during the next puppet run), add
    # vim-vdebug
    xdebug.remote_connect_back = "0"
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    
  • open the file where you want to start debugging, use F10 to set breakpoints (on the Gnome terminal you'll have to go into Preferences > Shortcuts and disable the "Enable the menu accelerator key (F10 by default)" option first), press F5 to start listening

Tgr (WMF) (talk) 04:07, 8 August 2022 (UTC)Reply