How to Setup an I-Name-Enabled Mediawiki

From I-names Development Wiki

Jump to: navigation, search

Perform the following steps to iname-enable version 1.8 of Mediawiki. Please feel free to add any missing information or provide questions to the Tech FAQs page.

1. Download Mediawiki from http://www.mediawiki.org/wiki/Download.

2. Follow the Mediawiki instructions for uploading and installing Mediawiki, as required.

3. Download the OpenID extension located at http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/OpenID/ into the extensions/OpenID directory of your MediaWiki installation. There is a README file that explains the installation steps.

4. Download the PHP OpenId library from http://www.openidenabled.com/openid/libraries/php. Upload as required.

5. Edit LocalSettings.php, as required.

  • Note that for this wiki, LocalSettings.php was edited as follows:
# To prevent anonymous users from editing
$wgGroupPermissions['*']['edit'] = false;

# To change the default login/create account screen with the OpenId prompt.
$wgSpecialPages['Userlogin'] = array('SpecialPage', 'OpenIDLogin');


require_once("$IP/extensions/OpenID/OpenID.php");
$wgOpenIDConsumerDenyByDefault = false;
$wgTrustRoot = 'http://dev.inames.net/wiki/index.php';
$wgOpenIDConsumerStoreType = 'file';
$wgOpenIDServerStoreType = 'file';
$wgOpenIDConsumerStorePath = '/tmp/openid-consumer';
$wgOpenIDServerStorePath = '/tmp/openid-server';

6. Apply the following patch if you configure your mySql database with a prefix.

diff -crN temp/Consumer.php temp2/Consumer.php
*** temp/Consumer.php	2006-12-28 16:15:50.000000000 -0800
--- temp2/Consumer.php	2006-12-28 16:16:07.000000000 -0800
***************
*** 426,437 ****
  	# Find the user with the given openid, if any
  
  	function OpenIDGetUser($openid) {
- 		global $wgSharedDB, $wgDBprefix;
- 		$tableName = "${wgDBprefix}user_openid";
- 		if (isset($wgSharedDB)) {
- 			$tableName = "`$wgSharedDB`.$tableName";
- 		}
  		$dbr =& wfGetDB( DB_SLAVE );
  		$id = $dbr->selectField($tableName, 'uoi_user',
  								array("uoi_openid = '${openid}'"));
  		if ($id) {
--- 426,433 ----
  	# Find the user with the given openid, if any
  
  	function OpenIDGetUser($openid) {
  		$dbr =& wfGetDB( DB_SLAVE );
+ 		$tableName = $dbr->tableName('user_openid');
  		$id = $dbr->selectField($tableName, 'uoi_user',
  								array("uoi_openid = '${openid}'"));
  		if ($id) {
***************
*** 615,627 ****
  		$openid_url = null;
  
  		if (isset($user) && $user->getId() != 0) {
- 			global $wgSharedDB, $wgDBprefix;
- 
- 			$tableName = "${wgDBprefix}user_openid";
- 			if (isset($wgSharedDB)) {
- 				$tableName = "`${wgSharedDB}`.$tableName";
- 			}
  			$dbr =& wfGetDB( DB_SLAVE );
  			$res = $dbr->select(array($tableName),
  								array('uoi_openid'),
  								array('uoi_user = ' . $user->getId()),
--- 611,618 ----
  		$openid_url = null;
  
  		if (isset($user) && $user->getId() != 0) {
  			$dbr =& wfGetDB( DB_SLAVE );
+ 			$tableName = $dbr->tableName('user_openid');
  			$res = $dbr->select(array($tableName),
  								array('uoi_openid'),
  								array('uoi_user = ' . $user->getId()),
***************
*** 657,663 ****
  			$dbw->selectDB($wgSharedDB);
  		}
  
! 		$dbw->insert('user_openid', array('uoi_user' => $user->getId(),
  										  'uoi_openid' => $url));
  
  		if (isset($wgSharedDB)) {
--- 648,655 ----
  			$dbw->selectDB($wgSharedDB);
  		}
  
! 		$tableName = $dbw->tableName('user_openid');
! 		$dbw->insert($tableName, array('uoi_user' => $user->getId(),
  										  'uoi_openid' => $url));
  
  		if (isset($wgSharedDB)) {
***************
*** 675,681 ****
  			$dbw->selectDB($wgSharedDB);
  		}
  
! 		$dbw->set('user_openid', 'uoi_openid', $url,
  				  'uoi_user = ' . $user->getID());
  
  		if (isset($wgSharedDB)) {
--- 667,674 ----
  			$dbw->selectDB($wgSharedDB);
  		}
  
! 		$tableName = $dbw->tableName('user_openid');
! 		$dbw->set($tableName, 'uoi_openid', $url,
  				  'uoi_user = ' . $user->getID());
  
  		if (isset($wgSharedDB)) {

7. Modify the following to customize the text on the login screen: /extensions/OpenId/OpenId.php


Personal tools