Mediawiki 1.17.0 Upgrade
As php version is upgraded to 5.36 in apache under centos5.6 in new server. So I have also migrated our intranet running mediawiki from version 1.6.9 to 1.17.0 to it . But it’s not straight forward like it mentions in the upgrade file , actually , I have met several problem during the progress. Here is my refined upgrade steps :
Copy the old intranet wiki filesystem and wiki database to the new server . Since the old intranet running MediaWiki 1.6.9 , and the new apache server is of php 5.3.6 so the intranet wiki won’t be shown up. Before the migration , backup the original mediawiki filesystem and also the mediawiki database “wiki1” :
% tar cvf intranet.tar {website path}/intranet
% mysqldump -u wikiuser -p wiki1 –single-transaction –default-character-set=latin1 -c > wiki1.sql
Do a fix the privilege tables as follows (to avoid the flush privileges problem during migration) :
# cd /usr/share/mysql
# mysql -u root -p mysql < mysql_fix_privilege_tables.sql
Enter password:
ERROR 1060 (42S21) at line 102: Duplicate column name ‘File_priv’
Yet, you can safely ignore all ‘Duplicate column’ and ‘Unknown column’ errors above . Then grant the wiki user “wikiuser” with the correct rights for creating tables and indexes for MediaWiki database “wiki1” in the later course of upgrade .
% mysql -u root -p
mysql> grant all PRIVILEGES on wiki1.* to ‘wikuser’@’localhost’ ;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
According to UPGRADE text file under mediawiki1.17.0 source directory, replace the existing MediaWiki files with the new files from 1.17.0 . Preserve the LocalSettings.php file and the “extensions” and “images” directories. Then run web-based installation script in mw-config/index.php , in my case : https://www.mysite.com:1443/intranet/mw-config/index.php. Here is how it looks from the start :
Then place an upgrade string in the LocalSettings.php to proceed :
When it read your LocalSettings.php , it will detect you have MediaWiki tables in the database , so it will upgrade them for version 1.17.0 :
However, when it proceed , you will find the web installer “stalls” in the place for
….
Creating page_restrictions table…done
Migrating old restrictions to new table…
The above problem occurs because page_restrictions table cannot be created which is opposed to what the log says in the web installer above. To fix the above problem , manually create all new required tables by :
% cd {MediaWiki dir}/maintenance/
% cp tables.sql tables-new.sql
Then edit tables-new.sql with your favourite editor and do the following :
– replace all occurrence of /*_*/ with correct table prefix
– remove all occurrence of /*i*/
Then drop the existing database manually , and then create all tables and populate their content in the new MediaWiki database wiki1 as follows :
% mysql -u root -p
mysql> drop database wiki1;
mysql> create database wiki1
mysql> grant usage on *.* to wikiuser@localhost;
mysql> grant all privileges on wiki1.* to wikiuser@localhost;
% mysql -u wikiuser -p wiki1 < tables-new.sql
Edit the mysqldump output file “wiki1.sql” created during backup as follows
– Replace all occurrence of “CREATE TABLE” with “CREATE TABLE IF NOT EXISTS”
– Remove all lines of “DROP TABLE” because you don’t want to remove all tables updated in tables-new.sql
%sed ‘s/CREATE TABLE/CREATE TABLE IF NOT EXISTS/;/DROP TABLE/d’ wiki1.sql > wiki2.sql
Then populate the table content in the new wiki1 MySQL database :
% mysql -u wikiuser -p wiki1 < wiki2.sql
After new tables are created , click “Restart Installation” on the stalled page to restart the installation . You will need to key in the upgrade string that you have pasted into LocalSettings.php in the first time :
As it proceeds, you will find it still “stalls” in some place like in below diagram. But actually , the upgrade is already done .
Now can go to the website directly and see the final upgraded look : https://www.mysite.com:1443/intranet/
I have checked that there are no missing figures, tables and pages in the upgraded version.