Extension:DrupalIntegration

What can this extension do?
Have you ever wanted to have forum, blogs, calendar of events, comments in threaded discussions, and other things together with your MediaWiki application. If yes, then one possible solution is to use existing CMS instead of integrating many applications/extensions.

This extension allows to use Drupal with MediaWiki. It synchronizes users, groups and user-to-groups assignments from MediaWiki to users, roles and user-to-role assignments of Drupal. User accesses MediaWiki and Drupal with the same original account of MediaWiki. User logs in through MediaWiki and becomes automatically logged in to Drupal. Users logs out from MediaWiki and becomes logged out from Drupal too. (For the logging in through Drupal see Extension:AuthDrupal )

It was designed to be used in the case of operated MediaWiki site with new installation of Drupal.

Please let me know if you use this code. I will keep this info in secret. It will be used to update compatibility matrix.

How it works

 * Upon installation users, groups and user-to-group assignments are copied from MediaWiki to Drupal in the batch routine. Users in Drupal are replaced by users from MediaWiki.
 * In operation changes to user-to-group assignments are propagated to user-to-role assignments in Drupal
 * When user logs in MediaWiki, token is stored to cookie as user checked Remember my login on this computer. Drupal authenticates the user with this token against token stored in MediaWiki database, when user tries to access Drupal's pages.
 * User is logged into Drupal if tokens match. If they do not match, then
 * user is redirected to MediaWiki login page if anonymous browsing of Drupal's pages is prohibited
 * user accesses Drupal as anonymous user if anonymous browsing of Drupal's pages is allowed vikas edit

Download instructions

 * Download the latest stable release from http://designvmeste.com.ua/DrupalIntegration/
 * Optionally you can download current development version from github repository https://github.com/naumenko/DrupalIntegration
 * Extract to temporary folder
 * Read installation instructions in INSTALL.txt file or section below

Installation
1. Download the DrupalIntegrationx.x.x.zip file and unpack files into temporary location. You will have two folders. One "di" has MediaWiki extension. Another "mwi" has Drupal module.

2. Installing MediaWiki extention 2.1 Place "di" folder with all files to your_wiki_path/extensions/ 2.2 Edit configuration settings in file your_wiki_path/extensions/di/iwDrupalConfig.php 2.3 Put the following line in LocalSettings.php: include_once ($IP . '/extensions/di/iwDrupal.php'); 2.4 Go to special page Version and check that DrupalIntegration extension is listed in installed extensions your_wiki_url/index.php?title=Special:Version

3. Installing Drupal module 3.1 Place "mwi" folder to your_drupal_path/sites/all/modules 3.2 Run sql command in mwi/install.sql file in Drupal database 3.3 Edit configuration settings in file your_drupal_path/sites/all/modules/mwi/mwi.config 3.4 Sign in as Drupal admin and go to drupal admin pages, then to site building, then to module panel. your_drupal_url/admin/build/modules 3.5 Enable "Drupal Integration" module at "mediawiki" section. This will run batch synchronization routine. If you are not logged into Wiki, you will be logged out of Drupal as admin user account will be replaced with WikiSysop account from your wiki. If you are logged into Wiki, you will be logged in to Drupal as WikiSysop that is admin user in Drupal from now on. You might see number of notices and warnings if Drupal has roles with the same names as transfered wiki groups. Ignore them. 3.6 Login to wiki as WikiSysop 3.7 Go to Drupal as you are recognized by Drupal as WikiSysop then installation is completed

4. Customizing Drupal 4.1 Go to administration of Drupal. 4.2 In order to remove Drupal login form that does not work anyway go to site building->blocks for User login block select none and press save blocks 4.4 In order to remove log out link in user's menu that does not work anyway go to site building->menus->navigation uncheck Log out menu item to disable it   Save configuration 4.5 In order to add log out link at the same place, but with logging out from wiki go to site building->menus->navigation->add item enter path to log out url, e.g. http://example.com/wiki/index.php?title=Special:UserLogout&returnto=Special:UserLogin enter menu link title, e.g. Log out give weight of 10 to have log out link at the bottom of navigation menu 4.6 In order to add login link at Drupal pages go to site building->menus->primary links->add item enter path to login url, e.g. http://example.com/wiki/index.php?title=Special:UserLogin enter menu link title, e.g. Login

Configuration parameters

 * You have to configure MediaWiki extension to access Drupal's database. These configuration parameters are in di/iwDrupalConfig.php file.
 * Assign values according to your environment or
 * These config params can be copied to LocalSettings.php file to overwrite default settings in iwDrupalConfig.php file
 * You also have to configure Drupal module. These configuration parameters are in mwi/mwi.config file.

Compatibility
Tested with
 * MW 1.13.0 + Drupal 6.6
 * MW 1.13.3 + Drupal 6.8
 * MW 1.14.0 + Drupal 6.10
 * MW 1.14.1 + Drupal 6.14
 * MW 1.16.0 + Drupal 6.15
 * MW 1.16.2 + Drupal 6.20
 * MW 1.17.0 + Drupal 6.20

Reported problems with
 * MW 1.12

Contribute
You can contribute or create your own more advanced integration extensions based on repository at https://github.com/naumenko/DrupalIntegration