1. Summary
  2. Report Spam
  3. Create account
  4. Log in

Moving MediaWiki to 5.0-Nano

From mpgcan

Revision as of 11:06, 9 August 2009 by Mpgcan (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Moving and upgrading MediaWiki 5.0-Nano

Introduction

While testing Uniform Server 5.0-Nano I wanted an application with an already populated database. I fished out a copy of MediaWiki from my original write-up “Moving and upgrading MediaWiki on Uniform Server”.

Like Uniform Server, MediaWiki has moved on hence I wondered if my original write-up was still viable. Being a personal Wiki each page has numerous edits these are redundant and just add clutter to the database. There is a plugin that removes all edits thought I would throw this in while testing.

This step-by-step guide shows how to move an existing copy of MediaWiki to Uniform Server 5.0-Nano and how to upgrade MediaWiki to remove all old edits.

Original Configuration:

  • Server: Uniform Server 3.5 Apollo or (4.0-Mona)
  • MediaWiki: mediawiki-1.13.1
  • Server folder: www\wiki
  • Server database: \Uniform Server\udrive\usr\local\mysql\data\wikidb

New Configuration:

  • Server: Uniform Server 5.0-Nano
  • MediaWiki: mediawiki-1.15.0
  • Server folder: www\wiki
  • Server database: \Uniform Server\usr\local\mysql\data\wikidb

Top

Preparation

Mirror existing Wiki

Mirror existing Wiki on new server as follows:

  1. Create a new folder a_test (Can be any name. I have also ssumed C drive)
  2. Unpack Uniform Server 5.0-Nano to this folder.
  3. From old installation, copy wiki folder *\www\wiki to new server C:\a_test\UniServer\www\wiki
  4. From old installation, copy database folder: Uniform Server\udrive\usr\local\mysql\data\wikidb
  5. To new server folder: C:\a_test\UniServer\usr\local\mysql\data

Top

New MediaWiki

Copy new MediaWiki files to mirrored server.

  1. Downloaded new version of MediaWiki and unpacked it.
  2. Copy all files in folder mediawiki-1.15.0
  3. To new server, folder C:\a_test\UniServer\www\wiki allow overwrite of any existing files.

For details see Installing MediaWiki on 5.0-Nano for details

Top

Admin Settings

Upgrading requires setting MediaWiki Amin privileges in the admin settings file as follows:
Locate the file AdminSettings.sample found in folder C:\a_test\UniServer\www\wiki
make a copy and rename it AdminSettings.php

Edit this new file (AdminSettings.php) locate these two lines:

$wgDBadminuser      = 'wikiadmin';
$wgDBadminpassword  = 'adminpass';

Change as shown (If you have changed the password use that instead of root)

$wgDBadminuser      = 'root';
$wgDBadminpassword  = 'root';   

Top

Run update.php!

The upgrade guide informs you to run update.php from a command prompt.
This will fail because Uniform Server adds nothing to your PC hence the PHP executable is not on any system path.

Solution is to create a batch file and run the command from the PHP root folder.

Create the following batch file name it wiki_update.bat
Save to folder C:\a_test\UniServer\usr\local\php The batch file runs update.php in CLI mode.

php.exe ..\..\..\www\wiki\maintenance\update.php
pause 

Note: If you have named your wiki folder something else just substitute it in the above.

Top

Run update

The update script writes to the MySQL server hence the servers to be running procced as follows:

  1. Start UniTray, in folder C:\a_test\UniServer double click on Start.exe tray icon created.
  2. Switch to production, Left click tray icon > Advanced > click php.ini switch to Production.
  3. Start Uniform Server. Left click tray icon > click Start UniServer
  4. Navigate to folder: C:\a_test\UniServer\usr\local\php
  5. Run update double click on file wiki_update.bat
  6. Be prepared for a long wait however if your Wiki database is small it is fairly quick.

Locked out

After running the above if you get locked out of the database elevate wikiuser to root as follows.

Edit file: C:\a_test\UniServer\www\wiki\LocalSettings.php change line:

$wgDBuser           = "wikiuser";

To:

$wgDBuser           = "root";

Top

General note

The above applies to minor version updates for major version upgrades please read any notes supplied with that version.

Top

Plugin to remove all edits

Introduction

I mentioned in the introduction page edits build up and generally are surplus to requirement. This section looks at installing and using a neat plugin to remove all page edits originaly designed by Marc Noirot and Gunter Schmidt now maintained by Jehy at www.mediawiki.org.

Top

Install

Copy extension to Wiki:

  1. Create a new folder C:\a_test2 (can be any name just used for reference)
  2. Download latest version currently 1.4 from Extension:SpecialDeleteOldRevisions2
  3. Copy the file downloaded (specialdeleteoldrevisions2.zip) to the above folder
  4. Extract this archive to the current path.
  5. Copy folder C:\a_test2\specialdeleteoldrevisions2\SpecialDeleteOldRevisions2
  6. To folder: C:\a_test\UniServer\www\wiki\extensions

Edit file C:\a_test\UniServer\www\wiki\LocalSettings.php

Add the following lines to the end of this file:

// Extension DeleteOldRevisions
$wgGroupPermissions['sysop']['DeleteOldRevisions'] = true;
require_once( $IP.'/extensions/SpecialDeleteOldRevisions2/SpecialDeleteOldRevisions2.php');

Top How to use:

  1. Start server and login to Wiki
  2. From left menu select special pages
  3. Scroll to bottom of this page.
  4. A new menu item “Delete old revisions” has been created.
  5. Click this, a new page opens, default is to delete all revisions.
  6. Note the two buttons “Delete history” and “Test only
  7. Click “Delete history

That will take some time on completion a conformation message is displayed “The old revisions were successfully deleted.

Top

PhpMyAdmin

In addition to the above line you will see “Remember to shrink your database after deleting many articles.” This is performed using phpMyAdmin as follows:

  1. Start phpMyAdmin: left click tray icon > click phpMyAdmin
  2. From phpMyAdmin’s left menu click wikidb
  3. A page displays all tables in this database, scroll down to end of page.
  4. To the left click “check all” this selects all tables.
  5. To the right, click the drop down menu "With selected:" to display it’s items. Select “Optimize table”.
  6. Apart from wikidb.hitcounter you will see either OK or Table is already up to date confirming operation was successful. For wikidb.hitcounter you will see “The storage engine for the table doesn't support o...” ignore this, it is OK

Top

Is it worth the effort!

Its relatively easy to set up, my original database was 53.1 MB after running the script and optimizing, database reduced to 8.23 MB. That’s a massive saving and well worth the effort.

Top

Move Servers

One of Uniform Server’s unique features is the capability to run more than one complete server on the same PC. When running a server from a USB memory stick you can use this to great advantage and prevent server clashes. You will have noticed UniTray’s icon displays one (meaning standard ports). Moving UniServer increments this digit and so on for each server move. In reality it’s not just a port change but a complete server update, running server status displays the server characteristics.

Move Servers and Wiki:

  1. Stop all running Uniform Servers
  2. Start UniTray, in folder UniServer double click on Start.exe tray icon created.
  3. Move servers, Left click tray icon > Advanced > click Move Servers multi-server operation.
  4. In the pop-up window at all prompts press enter to accept defaults.
  5. The tray icon will display 2, if you already use a server with this number repeat steps 3 and 4 each server must have a unique number. I run my Wiki on icon2 (server 2).


I moved the servers to icon 2 hence Apache port = 81 and MySQL port = 3307

  • After moving the servers Apache and MySQL automatically use the new ports.
  • However before proceeding you need to configure the Wiki to use the new MySQL port.
  • To find this: Left click tray icon > Server Status


  1. Edit file UniServer\www\wiki\LocalSettings.php
  2. Locate line (61)
    Change line: $wgDBserver = "localhost";
    To: $wgDBserver = "localhost:3307";
  3. Save file.

Note 1:

After installation Access your wiki by typing the following into your browser address bar:

  • http://localhost:81/wiki/ or
  • http://localhost:81/wiki/index.php/Main_Page

Note 2: Use the port numbers that matches your server.

Top

Conclusion

Minor updates are really that easy note when upgrading an existing server make a backup copy of the server first. In either case the batch file wiki_update.bat and AdminSettings.php need creating.

Space on a USB memory stick is valuable real estate hence removing any dross or redundant files are worth the effort. Added to that the smaller the faster you can copy to it.

Top

All the best MPG (Ric)


Personal tools