Easiest way of upgrading or updating Mediawiki version on Debian/Ubuntu/etc.

So far this is the easiest way I have found to update Mediawiki. This presumes SSH access.   Back up your database and files first!  
cd
wget https://releases.wikimedia.org/mediawiki/1.31/mediawiki-1.31.1.tar.gz
(if going for another version, replace with the appropriate link)
tar -xvzf mediawiki-1.31.1.tar.gz
cp -rf mediawiki-1.31.1/* /var/www/YOURSITE
If your sites are stored elsewhere, replaces /var/www/YOURSITE with whatever the path name is. Copy with the rf flags forces over-write and copies recursively.
Visit https://yoursitename/mw-config/ in your browser
Follow the instructions from there – you will need the upgrade key from your existing LocalSettings.php file, which should be found in your existing Wiki directory via:

cat LocalSettings.php | grep -A 2 key