vmware-marketplacemediawiki

Upgrade MediaWiki

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.

Migrate the database from an old version to a new one

To migrate the database from an old version to a new one, follow these steps:

  • Launch a new MediaWiki cloud server instance.

  • Copy the database backup to the new server.

  • Stop all servers and start only MySQL:

      $ sudo /opt/bitnami/ctlscript.sh stop
      $ sudo /opt/bitnami/ctlscript.sh start mysql
    
  • Remove the previous database and create a new one:

      $ mysql -u root -p
      Password: ****
      mysql> drop database bitnami_mediawiki;
      mysql> create database bitnami_mediawiki;
    
  • Restore the new database:

      $ mysql -u root -p bitnami_mediawiki < backup.sql
    
  • Copy the MediaWiki /opt/bitnami/mediawiki/files directory from the old installation to the new one.

  • If you have installed plugins in the previous version, copy the folders from the vendor/plugins directory into the new installation directory, into the plugins directory.

  • Restart the servers.

      $ sudo /opt/bitnami/ctlscript.sh restart
    

Upgrade the MediaWiki database

You can upgrade the MediaWiki database in two ways: from the command line or from the web browser (since version 1.17). Upgrading from the command line is recommended, since this reduces the risk of the upgrade process being interrupted by a timeout or connection reset.

Command-line upgrade

  • Make sure that your web server (such as Apache) and your database sever (such as MySQL) are running.

  • From the command line follow these steps:

    • Navigate to the MediaWiki directory:

        $ cd /opt/bitnami/mediawiki
      
    • Update the database schema:

        $ php maintenance/update.php
      

MediaWiki will inspect the existing schema and update it to work with the new code, adding tables and columns as needed. If you use a shared database, you should pass the --doshared parameter if you want the shared tables to be updated. Otherwise they won’t be touched by the update script.

Web browser upgrade

NOTE: If your database is already large in size and in high production usage, then you should not be using the Web updater, as the update process might time out when the script’s maximum execution time is reached. In that case you should use the command-line interface (not from the web). Always backup before performing database maintenance.

Follow these steps:

  • Navigate your browser to /mw-config/. For example, if your wiki is at mydomain.com/mediawiki/Main_Page, then navigate to mydomain.com/mediawiki/mw-config/.

  • Select your language and click continue.

  • The existing installation should be detected. Follow the instructions on the screen to upgrade it. If asked for the “upgrade key”, open the MediaWiki configuration file, LocalSettings.php, and look for the key assigned to $wgUpgradeKey. The configuration file can be found in the /opt/bitnami/mediawiki directory.

Last modification February 9, 2023