Upgrading MediaWiki

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


How to Upgrade MediaWiki

The processes involved in upgrading a MediaWiki-based website are covered in the Manual:Upgrading. However, for a hosted website the method may be different.

For example, cPanel --> Advanced --> Terminal can be used when command-line access is required.

Some of the processes and tools are described in detail in separate articles:-


An Upgrade Process

Upgrading a MediaWiki installation can be easy or difficult. A simple upgrade proceeds like this:-

Preliminary Steps
  1. Make a copy of the database so if anything gets corrupted you can roll-back to what worked.
  2. Add a User to the database copy. For convenience you could add the same user as the original database.
  3. Check that the database copy works ok. In LocalSettings.php change the values of $wgDBname to the name of the database copy, and change $wgDBuser and $wgDBpassword as appropriate.
  4. Check that the website loads and performs as per the original database.
Install a new version of MediaWiki

I like using sub-domains for testing changes. For an upgrade of mywebsite.net I may create a subdomain test.mywebsite.net with a new directory in /public_html like /public_html/MyWebsiteTest.

MediaWiki can then be installed in /MyWebsiteTest/w using cPanel --> Softaculous, or uploaded to your FTP folder and copied to the /public_html/MyWebsiteTest/w folder.

Configure the New Version of MediaWiki
  1. Copy the original LocalSettings.php file to the new installation at /public_html/MyWebsiteTest/w.
  2. In LocalSettings.php comment lines which load extensions so they won't cause a problem. Add them later when the database is upgraded.
  3. Decide which database to upgrade - the original or the copy. Upgrading the copy is perhaps safer so you can roll-back to the original if needed.
  4. If a file .htaccess exists in the /public_html/MyWebsiteTest folder, rename it so the web server will not use it. I may change it to something simple like .htaccessToUse.
Run mw-config

If the version of MediaWiki is newer than the version of the database, then the database can be upgraded using a script in the folder /w/mw-config.

To run the script from a browser simply use the URL of the website and append the path to the script, for example:-

https://test.mywebsite.net/w/mw-config

If the script loads, the page will look like this:-

Because we are upgrading an existing website and a LocalSettings.php file exists, the script requests an Upgrade Key. This is usually found in the LocalSettings.php file and for the copy database will be the same as for the original database.

Copy and paste the Upgrade Key and Continue.

Load the Website

When the database has been upgraded to the current installed version of MediaWiki, restore the name of the .htaccess file so that the web server will find and obey the directives.

The website should load in a browser with the normal URL.

Incorrect Upgrade Key

I had this problem when writing this page. The database I wanted to look at was an older version of a website so to view it with a current version of MediaWiki I went through the above steps until I was stopped by the request for the Upgarde Key. I tried several values from my records, none of which worked, so the web-based upgrade failed.

The solution was to run the update.php script from a command line. I do not use SSH or puTTy, as described in MediaWiki documentation.

I opened cPanel --> Advanced --> Terminal and used only three commands:-

  • at the $ prompt type ls for a directory listing
  • type cd followed by a directory name, to change directory
  • after using these commands to navigate to the /w/maintenance directory use php update.php to run the script.

The update script, when run from a command-line does not challenge by requesting the Upgrade Key.





Articles which relate to upgrading MediaWiki

Articles which relate to upgrading MediaWiki are included in Category:Upgrade.

The CategoryTree Extension enables a listing of relevant sub-categories and pages:-



Links

Manual:Upgrading
https://www.mediawiki.org/wiki/Manual:Upgrading
Manual:$wgUpgradeKey
https://www.mediawiki.org/wiki/Manual:$wgUpgradeKey
Terminal for cPanel
https://docs.cpanel.net/cpanel/advanced/terminal-in-cpanel/