I would really like to have full integration of mediaWiki on my drupal site. Basically, I would like shared user tables, or at least synced user tables, so that when a user on my site logs into drupal, then clicks on the wiki link, he will automatically be logged into the wiki. There is a very old post from January of 2006 for this with drupal 4.7, but I'm using 5.x. I found this MediaWiki extension: http://www.mediawiki.org/wiki/Extension:AuthDrupal, but I don't know if it's going to do exactly what I want, since I'm using Drupal 5.2. Any help/advice on this?
Thanks,
Brandon

Comments

anisotropic’s picture

You'll want to check out this:

http://www.mediawiki.org/wiki/Extension:AuthDrupal

I got it working well with MW 1.10 and Drupal 5.2 after some wrangling of return types in AuthDrupal.php, here is my patch:

--- ./AuthDrupal-0.4/AuthDrupal.php	2007-07-29 15:28:12.000000000 -0700
+++ /var/www/wiki/extensions/AuthDrupal/AuthDrupal.php	2007-09-21 11:41:35.000000000 -0700
@@ -161,10 +161,11 @@
 	if ($rc && $tmpuser->isLoggedIn()) {
 		if ( $wgAuth->authenticate( $tmpuser->getName(), '' ) ) {
 			//!dbg wfDebug("AuthDrupal: User " . $tmpuser->getName() . " already logged in\n");
-			return;
+			return true;
 		} else {
 			// log out the existing user and continue below to start over
 			$tmpuser->logout();
+			return false;
 		}
 	}
 
@@ -174,7 +175,7 @@
 	$name = getCurrentDrupalUsername();
 
 	if ( empty( $name ) ) {
-		return;
+		return false;
 	}
 
 	$user = User::newFromName( $name );
@@ -186,7 +187,7 @@
 
 		if ( empty( $drupal_user ) ) {
 			wfDebug( __FUNCTION__ . " AuthDrupal ERROR: " . $name . " not found in Drupal DB \n" );
-			return;
+			return false;
 		}
 
 		//!dbg wfDebug( "AuthDrupal: logging in NEW user " . $name . "\n" );
@@ -220,6 +221,7 @@
 	$wgAuth->logit( $message );
 
 	$return_user = $user;
+	return true;
 }
 
 /**
@@ -261,6 +263,7 @@
 			"You have to <a href='" . $GLOBALS['wgAuthDrupal_LoginURL']
 			. "'>log in</a> to edit pages"
 	 */
+	return true;
 }
 
 /**
@@ -273,7 +276,7 @@
 	$personal_urls['logout'] = array (
 		'text' => wfMsg('userlogout' ),
 		'href' => $GLOBALS['wgAuthDrupal_LogoutURL'] );
-
+	return true;
 }
 
 /**

BDaggerhart’s picture

Thanks for that patch!

Do you think this DrupalAuth will in any way interfere with my Farmer extension (a wikifarm extension) on Media Wiki?

anisotropic’s picture

I have no idea, sorry.

tiendoan’s picture

Anisotropic:

your installation of mediawiki, is it a subdirectory under drupal or is it on its own? also, do mediawiki and drupal shares the same database?

Thanks Anisotropic

Regards

alex-and-r’s picture

I'm sorry for returning to this topic after quite a time, but I'm trying to integrate drupal and mediawiki and I get the following error when i address wiki after i finished installation:

Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook Auth_drupal_loginlink_hook failed to return a value; should return true to continue hook processing or false to abort.' in /adress/of/Hooks.php:133

Could you help me out here and point to what is wrong?

drupal.naresh’s picture

Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook Auth_drupal_loginlink_hook failed to return a value; should return true to continue hook processing or false to abort.' in /home/content/x/x/x/username/html/mwiki_home/includes/Hooks.php:133

I am trying my best to fix it... If anyone has patch, please do post it.

- Naresh

lavanyashastri’s picture

MediaWiki internal error.

Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook Auth_drupal_loginlink_hook failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/mysite/mediawiki-1.11.0/includes/Hooks.php:133
Stack trace:
#0 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(585): wfRunHooks('PersonalUrls', Array)
#1 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(436): SkinTemplate->buildPersonalUrls()
#2 /var/www/mysite/mediawiki-1.11.0/includes/OutputPage.php(696): SkinTemplate->outputPage(Object(OutputPage))
#3 /var/www/mysite/mediawiki-1.11.0/includes/Wiki.php(301): OutputPage->output()
#4 /var/www/mysite/mediawiki-1.11.0/index.php(90): MediaWiki->finalCleanup(Array, Object(LoadBalancer), Object(OutputPage))
#5 {main}

Exception caught inside exception handler: exception 'MWException' with message 'Detected bug in an extension! Hook Auth_drupal_loginlink_hook failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/mysite/mediawiki-1.11.0/includes/Hooks.php:133
Stack trace:
#0 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(585): wfRunHooks('PersonalUrls', Array)
#1 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(436): SkinTemplate->buildPersonalUrls()
#2 /var/www/mysite/mediawiki-1.11.0/includes/OutputPage.php(696): SkinTemplate->outputPage(Object(OutputPage))
#3 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(86): OutputPage->output()
#4 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(111): MWException->reportHTML()
#5 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(191): MWException->report()
#6 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(225): wfReportException(Object(MWException))
#7 [internal function]: wfExceptionHandler(Object(MWException))
#8 {main}

lavanyashastri’s picture

MediaWiki internal error.

Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook Auth_drupal_loginlink_hook failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/mysite/mediawiki-1.11.0/includes/Hooks.php:133
Stack trace:
#0 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(585): wfRunHooks('PersonalUrls', Array)
#1 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(436): SkinTemplate->buildPersonalUrls()
#2 /var/www/mysite/mediawiki-1.11.0/includes/OutputPage.php(696): SkinTemplate->outputPage(Object(OutputPage))
#3 /var/www/mysite/mediawiki-1.11.0/includes/Wiki.php(301): OutputPage->output()
#4 /var/www/mysite/mediawiki-1.11.0/index.php(90): MediaWiki->finalCleanup(Array, Object(LoadBalancer), Object(OutputPage))
#5 {main}

Exception caught inside exception handler: exception 'MWException' with message 'Detected bug in an extension! Hook Auth_drupal_loginlink_hook failed to return a value; should return true to continue hook processing or false to abort.' in /var/www/mysite/mediawiki-1.11.0/includes/Hooks.php:133
Stack trace:
#0 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(585): wfRunHooks('PersonalUrls', Array)
#1 /var/www/mysite/mediawiki-1.11.0/includes/SkinTemplate.php(436): SkinTemplate->buildPersonalUrls()
#2 /var/www/mysite/mediawiki-1.11.0/includes/OutputPage.php(696): SkinTemplate->outputPage(Object(OutputPage))
#3 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(86): OutputPage->output()
#4 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(111): MWException->reportHTML()
#5 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(191): MWException->report()
#6 /var/www/mysite/mediawiki-1.11.0/includes/Exception.php(225): wfReportException(Object(MWException))
#7 [internal function]: wfExceptionHandler(Object(MWException))
#8 {main}