0

I use latest MediaWiki (either on Arch Linux or Debian stable) in a personal project - I'm the only one who works on it, and I use MediaWiki in a core-only way (I don't install any extensions whatsoever).

  • I'd like the core version to always be upgraded to enjoy all newest features.

  • I have daily/weekly backups.

  • I tried to read here but I didn't recognize anything about automatic upgrades.

What is the correct way to have automatic upgrades for MediaWiki?

BTW, This is how I upgrade all my Drupal apps in a given Debian-based environment; maybe a similar approach can be taken for MediaWiki in Arch Linux:

#!/bin/bash

cat <<-EOF > /etc/cron.daily/cron_daily
    #!/bin/bash
    for dir in ${drt}/*/; do
        if pushd "$dir"; then
            rws
                composer update drupal/* webflo/drupal-core-require-dev --with-dependencies
                drush updatedb
                drush cache:rebuild
            rws
        popd
        fi
    done 2> $HOME/myErrors
EOF

cat <<-EOF > /etc/cron.weekly/cron_weekly
    #!/bin/bash
    find "$drt" -path "*/cache/*" -type f -delete
    certbot renew -q
EOF

chmod +x /etc/cron{.daily,.weekly}
  • A cron job to run `pacman -Syu mediawiki` ? – aksh1618 Jan 09 '19 at 15:20
  • I plan to have at least 2 MediaWiki in one document root directory. I don't recognize how this could help (though I never used Arch before and might be wrong). –  Jan 09 '19 at 17:07
  • Have you installed from Git? That can make it easier to script upgrades. – Sam Wilson Jan 09 '19 at 17:51
  • I've yet to ever install it, but I guess I'll install it from a zip, but how should I automatically upgrade it afterwards? –  Jan 09 '19 at 18:07
  • Update your files, run `composer update`, run `maintenance/update.php`. – Tgr Jan 09 '19 at 21:22
  • Hello @Tgr I now give a bounty for a canonical answer based on these comments. You might want to expend the comment by exampling what and how you will do (for example, will you run composer update for all paths or just run it as-is). –  Jan 11 '19 at 11:05
  • Just the usual warning: sooner or later, automatic upgrades lead to broken systems. E.g. right now, [mediawiki](https://www.archlinux.org/packages/?name=mediawiki) is [broken on Arch Linux](https://wiki.archlinux.org/index.php/MediaWiki) "because MediaWiki does not support PHP 7.3. [FS#61070](https://bugs.archlinux.org/task/61070)". – fra-san Jan 13 '19 at 17:28
  • @fra-san It's a good point but I personally won't necessarily upgrade the LAMP stack (unless it's a security upgrade by `unattended-upgrades` or similar program). I meant automatic upgrades only in the context of MediaWiki. –  Jan 13 '19 at 18:27
  • Have you considered using Docker? –  Jan 14 '19 at 02:19
  • @LukeM I haven't, how can this help me to automatically upgrade MediaWiki itself? –  Jan 14 '19 at 02:44
  • @JohnDoea - Docker means that you don't have to upgrade any other part of your system to keep up-to-date - esp since those upgrades might conflict with something else you might have installed. This and many other aspects of docker will make the upgrade path simpler. I am in the same situation but use dokuwiki instead where an upgrade is simply `docker-compose down && docker-compose up -d --build`. –  Jan 14 '19 at 10:17
  • @LukeM I don't know about Docker. A sysadmin once told me it's a program that solves many problems but cause others. As for now I can't see how one can not-upgrade but still keep upgraded at the same time. An answer on this would be most valued and I'll gladly give the bounty. –  Jan 14 '19 at 14:33
  • I don't think Docker helps with database updates, which is anyway the only part that can go wrong in non-obvious ways. – Tgr Jan 17 '19 at 07:39

1 Answers1

1

The standard upgrade process is:

  1. Update the files. If you are using git, this will be something like git checkout REL1_32. If you are using a tarball, you can just uncompress it over an old one (although for a live server a better approach is to have a separate directory for the old and new version, and use symlinks to swap them out so it's fast and easy to undo if something goes wrong).
  2. Update dependencies. If you use git, run composer update in the MediaWiki root directory. If you use the vendor repo (probably a bad idea), do a git checkout on it as well. If you use a tarball, it probably includes the updated dependencies (running composer doesn't harm though).
  3. Run the upgrade script: php maintenance/update.php --quick.

If it's a live wiki used by others, you probably want to set $wgReadOnly for the process (or even better to lock users out entirely).

There's a doc page but like most things on mediawiki.org it's a bit too verbose...

Tgr
  • 2,740
  • 1
  • 15
  • 12