User:MOphaswongse (WMF)/Notes

This is an assortment of things that are useful in my daily work.

Docs

 * MediaWiki JS
 * MediaWiki PHP
 * VisualEditor
 * OOUI

Videos on Phabricator
Current limitations: only videos under 4mb can be uploaded; no fallback support for video types (if a webm video is uploaded and the user is using Safari, there will be an empty box in lieu of the video); no inline playback for mp4/movs

To work around this and to ensure cross-browser compatibility, I typically convert the video into an animated gif using ffmpeg and gifsicle using this command: ffmpeg -i input.mov -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 > output.gif

Saving preferences via JS
During local development, it might be useful to go through a flow several times. For flows that are only shown to the user for a limited number of times, user preferences are used to track the state that should be presented to the user. This can be cleared via running  from the browser console.

Show the unactivated state of the suggested edits module new mw.Api.saveOption( 'growthexperiments-homepage-suggestededits-activated', '0' )

Show onboarding for add a link mw.Api.saveOption( 'growthexperiments-addlink-onboarding', '0’ )

Misc JS snippets
View homepage events in browser console —run the following from Special:Homepage mw.trackSubscribe( 'event.HomepageModule', console.log )

MediaWiki API query

For example, imageinfo API:

Misc commands
MediaWiki PHP code sniffer — run the following from MediaWiki directory vendor/bin/phpcs -p -s ${directory or file}

Creating a new admin account in local MediaWiki php /maintenance/createAndPromote.php --sysop

Reset MariaDB password locally (for MariaDB installed via Homebrew) sudo $(brew --prefix mariadb)/bin/mysqladmin -u root password NEWPASS

SymfonyCasts

 * PHP
 * OOP