Extension:DrupalIntegration

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
DrupalIntegration

Release status: beta

Implementation User activity
Description Integrates Drupal while MediaWiki remains sign in master
Author(s) Anton Naumenko (Naumenkotalk)
Last version 0.0.7 (2009-03-20)
MediaWiki 1.13.x, 1.14.0
License GPL2
Download http://designvmeste.com.ua/DrupalIntegration/ or https://github.com/naumenko/DrupalIntegration
Parameters

Extension:DrupalIntegration#Configuration_parameters

Hooks used
UserRights

UserSetCookies

Check usage and version matrix

Contents

What can this extension do? [edit]

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 [edit]

  • 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

Download instructions [edit]

Installation [edit]

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 [edit]

  • 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
$iwParameters['DrupalDBserver'] = "localhost";
$iwParameters['DrupalDBuser'] = "drupaldb";
$iwParameters['DrupalDBpassword'] = "test";
$iwParameters['DrupalDBname'] = "drupaldb";
$iwParameters['DrupalDBprefix'] = "";
  • You also have to configure Drupal module. These configuration parameters are in mwi/mwi.config file.
$GLOBALS['wgSitename'] = "wiki14";
$GLOBALS['wgCookiePrefix'] = "wikidb14";//by default it is wiki DB name with DB prefix if set
// Database settings should correspond to MediaWiki settings in LocalSettings.php
// Wiki database type equals to $wgDBtype in LocalSettings.php
$GLOBALS['wgDBtype'] = "mysql";
// Wiki server equals to $wgDBserver in LocalSettings.php
$GLOBALS['wgDBserver'] = "localhost";
// Wiki database name equals to $wgDBname in LocalSettings.php
$GLOBALS['wgDBname'] = "wikidb14";
// Wiki database user name equals to $wgDBuser in LocalSettings.php
$GLOBALS['wgDBuser'] = "wikidb14";
// Wiki database user password equals to $wgDBpassword in LocalSettings.php
$GLOBALS['wgDBpassword'] = "test";
// Wiki database prefix equals to $wgDBprefix in LocalSettings.php
$GLOBALS['wgDBprefix'] = "";
// URL of the login page that will be used. MediaWiki login page was tested.
$GLOBALS['wgPathToLogin'] = "http://localhost:8080/wiki14/index.php?title=Special:UserLogin";
// If false then anonymous user will be redirected to login page above
// If true then anonymous user will be allowed to access Drupal
$GLOBALS['wgAllowAnonymousBrowsingOfDrupal'] = true;
// If true will output debug logging info into php log. Keep it false for production sites.
$GLOBALS['iwDebug'] = true;

Compatibility [edit]

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 [edit]

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

See also [edit]