Website:Wiki/Upgrade
From ReactOS
This documentation has been written to describe the Update process of the ReactOS Wiki (based on the MediaWiki software), so it is easier for the future. As an example, I take the Update from the MediaWiki 1.10 series to 1.12.0.
The ReactOS Wiki was modified in some parts to integrate into the ReactOS Website Design and to allow an easy login through our Global Login System. Also some unneeded and non-working options were removed like changing the account information on the Wiki Preferences page (this has to be done on the myReactOS page) and selecting another skin (all skins except "roscms" were removed).
Contents |
Changes in the files
In both MediaWiki versions, these changes had to be done in the same files. Let's hope that this also applies to future versions :-)
Integrating the Wiki into the Global Login System
These changes have to be done in the following files:
includes/SpecialUserlogin.php
Here we only need the function "wfSpecialUserlogin", so the first step is to delete everything below this function from the file. Then remove the lines in the function, which create the MediaWiki Login Form. Replace them with the following lines:
require_once(ROSCMS_PATH . "lib/RosCMS_Autoloader.class.php"); /** * constructor */ function wfSpecialUserlogin( $par = '' ) { require_once(ROSCMS_PATH . "lib/RosCMS_Autoloader.class.php"); /* Login to RosCMS */ $target = "/wiki"; Subsystem_Wiki::in(Login::REQUIRED, $target); /* Just redirect us to the main page in case we were called but already logged in */ header("Location: $target"); exit; }
This is already everything needed for the Login page.
includes/SpecialUserlogout.php
This file is pretty simple in the current version of the Wiki. The only function "wfSpecialUserlogout" only contains these calls:
/** * constructor */ function wfSpecialUserlogout() { global $wgUser; $wgUser->logout(); header("Location: ../roscms/?page=logout"); exit; }
The RosCMS Logout page then does the rest for you.
includes/User.php
This file has to be changed, so that it gets the User ID from RosCMS instead of using Wiki functions for this. This is currently done by changing the "loadFromSession" function to get the ID from the result of a roscms_subsys_login call.
/* This function has been completely rewritten for RosCMS to notice login/logout attempts and handle them properly. */ require_once(ROSCMS_PATH . "lib/RosCMS_Autoloader.class.php"); /* The session is usually set up through the Special:Userlogin page, but we can't rely on it */ if(session_id() == '') wfSetupSession(); $this->mId = Subsystem_Wiki::in(Login::OPTIONAL, ''); if(!$this->mId) { /* Resetting wsUserID is usually done in logout(), but our Logout page does not call this function. */ $_SESSION["wsUserID"] = 0; $this->loadDefaults(); return false; } if ( !$this->loadFromId() ) { # Not a valid ID, loadFromId has switched the object to anon for us return false; } $_SESSION['wsToken'] = $this->mToken; /* If the User ID we got does not match with the User ID stored in the session variable, a login/logout was performed, so invalidate the cache. */ if(isset($_SESSION["wsUserID"]) && $_SESSION["wsUserID"] != $this->mId) { $_SESSION["wsUserID"] = $this->mId; $this->invalidateCache(); } wfDebug("Logged in through RosCMS\n"); return true;
Now the Wiki should already work with our Global Login System. When you use the MediaWiki Login feature, you will be redirected to the ReactOS Login page. The same applies to the Logout button.
Integrating the Wiki into the Website Design
For this case, I created an own MediaWiki skin based on the MonoBook skin. It is called "roscms". You don't need to update the skin every time when you update MediaWiki. In this case, I updated the skin, because our former skin was still based on the MonoBook skin from MediaWiki 1.5.x.
First add a reference to the "/style.css" file, which contains all the styles of the ReactOS Website. Then remove the MonoBook "portlets" from the original MonoBook skin. Replace them with links to the main ReactOS pages and individual links to some Wiki pages like Login, Logout, My page, My contributions, etc. Make sure that these links are placed before the "globalWrapper" box. Look in the "RosCMS.php" file of the skin how I did it here. Now place a "wikiContent" box around the "globalWrapper" box. In the "main.css" file of the skin, you have to add "#wikiContent" in front of some styles, so these styles only apply to the Wiki content and not to the rest of the web page. The "main.css" file also needs to be edited. Especially the positions of "#content" and "#p-cactions" need to be adjusted, so the Wiki content is displayed next to the menus. Now you can do some additional adjustments. Try the skin on multiple browsers and if there are problems, change the CSS files appropriately.
Changing the Preferences page
The last file changes have to be done in the "includes/SpecialPreferences.php" page. Here we disable the some functions, namely changing the E-Mail address, real name, password, signature and the used skin. Simply put /* before and */ after the sections, which add the input fields for these values and also do this for the sections, which set these values. To find out the right sections, it's the best if you compare the current "SpecialPreferences.php" file with the original MediaWiki 1.10.0 "SpecialPreferences.php" file.
Final fine-tuning
Finally, you can remove some files, which are not needed now. These files include the other skins and some directories, which are not required for MediaWiki to work (like the "tests" directory).
Changes in other components
In some cases, you also have to make changes to other components. Some examples:
MediaWiki's database layout changed
If the database layout of the Wiki changed in some main parts, the Subsystem_wiki.class.php file probably needs an update to reflect the database changes.
There are login or session problems
In such cases, you often have to change the roscms/inc/subsys_login.php file. While updating MediaWiki from version 1.7.1 to 1.10.0, I also had to make changes here as newer MediaWiki versions require that a session is set up for working properly.

