bchmediawiki

Upgrade MediaWiki

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

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 files directory from the old installation to the new one.

    NOTE: Depending on your installation type, the files directory will be located in the following paths:

    • Approach A (Bitnami installations using system packages): /opt/bitnami/mediawiki/files

    • Approach B (Self-contained Bitnami installations): /opt/bitnami/apps/mediawiki/htdocs/files

  • 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. Depending on your installation type, you will need to execute the following commands:

      • Approach A: Bitnami installations using system packages

        $ cd /opt/bitnami/mediawiki
        
      • Approach B: Self-contained Bitnami installations

        $ cd /opt/bitnami/apps/mediawiki/htdocs
        
    • 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.
Last modification July 8, 2020