Difference between revisions of "Help:Upgrading MediaWiki"

From Web
Jump to navigation Jump to search
 
m (1 revision(s))
(No difference)

Revision as of 18:33, 18 November 2006

Template:MoveToMediaWiki Template:H:h

Pre-Upgrade Tasks

  • Read the UPGRADE file included within the package, in the mediawiki-[version number] directory of the .tar file.
  • Download or backup your existing MediaWiki files
  • Download or backup your database
  • If you have modified any source files or stock templates, you will need to re-modify them. Make a note of what modifications you have installed each time you install them to make the process much easier. You can also use a program like WinMerge, to compare old stock files with your custom files
  • Determine what route you need to take by the version number, and allocate time accordingly. The version number is constructed as such: major.minor.patchlevel - example: 1.5.3 means major version 1, minor version 5 and patch level 3.

Upgrading Tasks

Patch Version

Example: from 1.5.2 to 1.5.3

  1. Extract all the files from the new MediaWiki package
  2. Upload or copy the files from the extracted folder to your desired destination folder
  3. Delete the /config/ directory
  4. Note: Your LocalSettings.php file will be preserved, and your wiki should operate without interruption

If you are working on a Unix like system, you can untar the new MediaWiki package at some place, copy your old LocalSettings.php file into this directory and set a symbolic link to the directory. If your webserver searches in directory /var/www for files to display and you have installed your wiki into directory /var/www/myFirstWiki the easiest way to upgrade from 1.5.2 to 1.5.3 is the following:

  1. cd /var/www
  2. mv myFirstWiki mediawiki-1.5.2
  3. tar xvzf mediawiki-1.5.3.tar.gz
  4. cp mediawiki-1.5.2/LocalSettings.php mediawiki-1.5.3
  5. ln -s mediawiki-1.5.3 myFirstWiki

You only have to check that the permissions - especially on file LocalSettings.php - have been set correct. If some problems occur you simply can go back to 1.5.2 by changing the symbolic link:

  1. rm myFirstWiki
  2. ln -s mediawiki-1.5.2 myFirstWiki

As long as the database layout is not changed, you know can switch between versions by setting the symbolic link.

Minor Version

To upgrade to 1.6, see http://www.mediawiki.org/wiki/Manual:Upgrading_to_1.6.

Example: from 1.4.x to 1.5.x

  1. Extract all the files from the new MediaWiki package
  2. Lock your database to prevent editing, even if you have copied database you need to do this.
  3. Upload or copy the files from the extracted folder to your desired destination folder
  4. Rename your LocalSettings.php to LocalSettings.php.bak or similar
  5. CHMOD the /wiki/config/ folder and contents to 0777 (world writable)
    1. Recommended, but optional: Run the php maintenance/update.php program from the PHP CLI
  6. Run the installer at yoursite.com/wiki/config/
    1. Note: You will need your existing database name, user name, password, and MediaWiki prefix
  7. The installer will attempt to upgrade the database schema automatically
  8. Copy the LocalSettings.php file from the /wiki/config/ folder to the /wiki/ folder
  9. Add any modifications to your new LocalSettings.php file from your old file, making sure to check the documentation for any changes to variable names
  10. Delete the /config/ directory
  11. Note: Your LocalSettings.php file will NOT be preserved. Expect your wiki to possibly have a downtime of a couple minutes

Major Version

Example: from 1.6.3 to 2.0.1

  1. There has not been a significant major version release to date for upgrade

Upgrade Tips

Database Backups with Shell Access

  1. Make a backup of your database with mysqldump (see mysqldump for old versions, or for MySQL 4.1.x)
  2. Use the command:
    mysqldump -u wikiuser -p wikidb > wikiuser-wikidb-mediawiki-1.2.6-2004-06-23.sql
  3. Copy your mysql dump to a temporary file using: cp db.sql iso-db.sql.

Upgrade using PHPs CLI

  1. Upgrade the database schema (php -cli ./maintenance/update.php)

Broken Images

  1. Should be fixed upon saving the next edit of the page
  2. Alternatively, add your username/password to AdminSettings.php and run `php rebuildImages.php`
  3. Alternatively, postpend "?action=purge" to the url as it is most likely viewing a cached version of the page
  4. After upgrading to 1.6.x and all your images are broken, unable to generate thumbnails, or are completely black, you may need to set $wgHashedUploadDirectory = true; in your LocalSettings.php file which is by default false

Upgrading to utf-8 Before Upgrading to 1.5.x

Note - This is an interpretation: Upgrading to MediaWiki 1.5.x requires a database change to utf-8 formatting. This means that characters with accents like é cannot be used for various things.

  1. use upgrade1_5.php from /maintenance subdir, from commandline. You must create the AdminSettings.php (from AdminSettings.sample. Also make sure that $wgUseLatin1 = true is set in LocalSettings.php at least while running upgrade1_5.php)

OR

  1. From the command line use iconv:
    iconv -f iso-8859-1 -t utf-8 iso-db.sql > utf8-db.sql
  2. This utf8-db.sql is database to use in the 1.5.2 upgrade. Load the database into mysql with: mysql -pmysqlpass upgradabledb < utf8-db.sql. Change your $wgDBname to upgradabledb (in LocalSettings.php)
  • You might want to also truncate the Recent Changes table to clear corrupt rows.
  • You might also want to use the rebuildImages script, or re-upload the images

OR

use MySQL

mysqldump --user=***** --password=***** --default-character-set=latin1 --skip-set-charset wikidb > dump.sql
mysql --user=***** --password=***** --execute="DROP DATABASE wikidb; CREATE DATABASE wikidb CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql --user=***** --password=***** --default-character-set=utf8 wikidb < dump.sql

Various suggestions on upgrading to the 1.5.x series

1.4.8 to 1.5.1

  • Search index breaks in MySQL (mysql Ver 14.7 Distrib 4.1.13a, for pc-linux-gnu (i686) using EditLine wrapper

FIX: > table status like '%searchindex%' > repair table searchindex; #remember to add the prefix if you added one in the install

I had problems with collations because my sysadmin forgot to specify the default charset when Mysql was originally installed. If you have collation problems and your columns are set to swedish please run:

ALTER TABLE in_cur CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_old CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_blobs CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_archive CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_brokenlinks CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_categorylinks CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_blobs CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_hitcounter CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_image CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_imagelinks CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_interwiki CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_ipblocks CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_links CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_linkscc CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_logging CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_math CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_objectcache CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_oldimage CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_querycache CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_recentchanges CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_searchindex CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_site_stats CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_trackbacks CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_transcache CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_user CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_user_newtalk CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_user_rights CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_validate CONVERT TO character set latin1 COLLATE latin1_bin;
ALTER TABLE in_watchlist CONVERT TO character set latin1 COLLATE latin1_bin;

1.4beta6 to 1.6.3

With a copy of the LocalSettings.php and a copy of the database.

In LocalSettings.php

  • Change the $IP, $wgScriptPath, $wgDBname to point to the copy.
  • Add the $wgReadOnlyFile = "";

Then

  • Run on php CLI php maintenance/upgrade1_5.php then php maintenance/update.php

The scripts take the console user to connect to the database so I gave that user full access to the MySQL database.


1.4beta5 to 1.5.2

The upgrade fails when directly installing the 1.5.2 version over the 1.4beta5. The solution for me was a two step upgrade:

  • upgrade from 1.4beta5 to 1.4.10
  • upgrade from 1.4.10 to 1.5.2

Note that the new tables are created as InnoDB tables, which should be activated in the MySQL configuration. Otherwise, the second step will fail.

--Keran 15:56, 24 November 2005 (UTC)

1.2.x to 1.3.x

  • MediaWiki: entries that are not used by the software will be automatically moved to Template: entries at upgrade time
  • Pick the correct character encoding -- some languages were only available in Latin-1 on 1.2.x and are now available for Unicode as well. If you want to upgrade an existing wiki from Latin-1 to Unicode you'll have to dump the database to SQL, run it through iconv or another conversion tool, and restore it

Example: upgrade from 1.2 to 1.3

1.1.x or earlier to 1.2.x

You need to specify the *admin* database username and password to the installer in order for it to successfully upgrade the database structure. You may wish to manually change the GRANTs later.

If you have a very old database, you may need to manually run some of the update scripts from maintenance/archives to get up to circa November 2003 levels before the automatic updater works.

UseModWiki or old "phase 2" Wikipedia code

  • You can try using the conversion script called "importUseModWiki.php" in the maintenance folder
    • Note: This script is unmaintained. It may require tweaking and customization on a per-installation basis. Use at your own risk.

How to use:

  1. Install the original MediaWiki
  2. Call the conversion script
  3. SQL statements will be output
  4. Copy these statements to a file and then run that using mysql
  5. Rebuild the links tables etc. after importing

Template:H:f