Extension talk:AuthJoomla

Adaption - additional code suggestion
 2009/12/18 => Platform releases => Joomla 1.5.15, MediaWiki 1.15.1, PHP 5.2.11  To have a correct behavior, with the following extension as is, I have done the following adaptation : To manage users through Joomla : Install the dedicated extension from the MediaWiki Website => Extension:AuthJoomla And make the following adaptation

1 - Setup the correct data to your Joomla database and provide a correct path to Joomla in LocalSettings.php

$wgAuthJoomla_Path            = $IP.'/Relative Path to Joomla Directory/'; $IP the absolute Wiki Path

2.1 - In the file AuthJoomla.php, make the followig correction in the method => private function connectToDB : $db = & Database :: newFromParams(       $GLOBALS['wgAuthJoomla_MySQL_Host'],        $GLOBALS['wgAuthJoomla_MySQL_Username'],        $GLOBALS['wgAuthJoomla_MySQL_Password'],        $GLOBALS['wgAuthJoomla_MySQL_Database'], $failFunction = false, $flags = 0, $tablePrefix = 'Joomla' );

2.2 - In the file AuthJoomla.php In the method => function authenticate( $username, $password ) On line ~ 87 the following lines have to be added if(!is_object($hash_password)) return false;

3 - In the MediaWiki file => RootMediaWiki/include/db/Database.php Line 309 => Method newFromParams, make the following correction for the constructor calling :

Add => " $failFunction = false, $flags = 0, $tablePrefix " in the argument as following

/**    * Same as new Database( ... ), kept for backward compatibility * @param $server String: database server host * @param $user String: database user name * @param $password String: database user password * @param $dbName String: database name * @param failFunction * @param $flags */   static function newFromParams( $server, $user, $password, $dbName, $failFunction = false, $flags = 0, $tablePrefix ) {       return new Database( $server, $user, $password, $dbName, $failFunction, $flags, $tablePrefix Bold text); }

4 - In the MediaWiki file => RootMediaWiki/include/db/Database.php Line 296 =>  Method _constructor

/** Get the default table prefix*/ '''if ( $tablePrefix == 'Joomla' ) { $this->mTablePrefix = ''; } else'''if ( $tablePrefix == 'get from global' ) { $this->mTablePrefix = $wgDBprefix; } else { $this->mTablePrefix = $tablePrefix; }

After that everything seems correct and I can also wrap the WIKI inside Joomla so I have a coherent graphic interface.

How do I get this to work?
I copy and pasted the stuff into LocalSettings.php; and the php file into AuthJoomla.php but when I go to my wiki page (even the main page) it's blank (completely white). Can you give some more detailed instructions on the installation? (I don't know much PHP) I'm using the latest Joomla and MW.

Ty.

Thanks for a very useful extension
However, it does not work when the MediaWiki database tables are given a prefix. The problem is that the SQL user authentication query tries to parse a table in the joomla database containing both the joomla prefix, example (jos_) and the MediaWiki prefix, example (mw_). The table which is searched has the form "joomla_db.mw_jos_users". This table does not exist and an error is returned. The correct table should have been joomla_db.jos_users which is what results without the mw_ prefix attached.

Has anyone managed to get the extension to work with the MediaWiki database tablenames prefixed?

P.S. The extension works fine when no prefix is attached to the MediaWiki database tables.

I am running : Joomla 1.5.3 MediaWiki 1.12 (same result on 1.11.1) PHP 5.2.5 MySQL 5.0.45 Apache 2.2.6

Thanks

You can try to write yourself the queries: I made this: $query = 'SELECT password FROM jos_users WHERE username = \''. $username. '\' LIMIT 1'; $hash_password = mysql_fetch_object(mysql_query($query));

and this: $query = 'SELECT password FROM jos_users WHERE username = \''. $user->mName. '\' LIMIT 1'; $juser = mysql_fetch_object(mysql_query($query));

Thanks for replying but I am a bit lost. Where (in which file) do I place those queries??? It would be much more helpful, if you could provide a step by step guide.

Password Problems
I'm connecting to the DB fine and can authenticate the username; however, something's going wrong with the password authentication in this segment so that I always get an "incorrect password" response:

---

function authenticate( $username, $password ) {       $db = $this->connectToDB; $hash_password = $db->selectRow($this->userTable, array ( 'password' ), array ( 'username' => $username ), __METHOD__ ); $parts = explode( ':', $hash_password->password ); $crypt = $parts[0]; $salt = @$parts[1]; if ( is_file($GLOBALS['wgAuthJoomla_Path'].'/libraries/joomla/user/helper.php')) {           require_once $GLOBALS['wgAuthJoomla_Path'].'/libraries/joomla/user/helper.php'; $testcrypt = JUserHelper::getCryptedPassword($password, $salt); }       if ($crypt == $testcrypt) { return true; }       return false; } ---

My configuration:
 * Joomla 1.5.2
 * MediaWiki 1.12
 * PHP 5.2.6
 * MySQL 5.0.45

I'd appreciate any advice on how to fix. Thanks!

Joomla 1.0.x
Hi, I want to use this with Joomla 1.0.12 or higher versions. Is it possible, or I need to change things in the script?

DB prefix "wiki_"
hi! how setup AuthJoomla in new MediaWiki-1.14 install with DB prefix 'wiki_'? "AuthJoomla::authenticate". MySQL error "1146: Table 'table_name.wiki_jos_users' doesn't exist (localhost)".--Mazapura 21:38, 8 March 2009 (UTC)
 * I have exacty the same problem. But to fix it? --87.158.199.77 17:55, 22 March 2009 (UTC)

Bugs Fix

 * Hi! The problem is that it is using the MediaWiki database prefix with either "wiki_" or another, you must remove the code that database and everything works properly. I translated the post for the extension to all Spanish and notifying users of the same to use the database without any prefix. This is the link: Extension:AuthJoomla/es -- Alakentu 21:31, 27 April 2009 (UTC)

—

A fix
This occurs because the wiki database layer has it's own table prefix. You can fix this by editing the JoomlaAuth file as follows, (DO NOT EDIT CORE, that's silly).

nb. I have this working with my staging site running Joomla 1.6 :). -- Webpigeon (16 Dec 2010 22:17 UTC)

MW_ database prefix
Hi,

Tried using this extension. I read about the mw_ issue. Anyone found a fix for this yet?

Thanks

Ralph october 1st 2009

Whether the script to work with MediaWiki 1.17.0rc1?
I apologize for my English. Native for me language is Russian.

I would also be interested if this script works with MediaWiki 1.18. Thanks. --Nilsja 09:56, 18 October 2011 (UTC)

Doesnt looks like:

Fatal error: Call to undefined method User::setupSession in /extensions/AuthJoomla2/AuthJoomla2.php on line 152

Is there an update in progress?

AuthJoomla2
Hello! I found that plugin in internet, already with its settings in LocalSettings and with Joomla plugin.

There is a code in LocalSettings: //set these URLs to appropriate targets: $wgAuthJoomla_domain = 'http://mydomain.com/'; //location Joomla index.php file $wgAuthJoomla_LogoutLink = base64_encode($wgScriptPath); //return location logout $wgAuthJoomla_LoginLink = base64_encode($wgScriptPath); //return location login $wgAuthJoomla_LoginURL = $wgAuthJoomla_domain .'index.php?option=com_user&view=login&return='. $wgAuthJoomla_LoginLink; $wgAuthJoomla_LogoutURL = $wgAuthJoomla_domain. 'index.php?option=com_user&task=logout&return='. $wgAuthJoomla_LogoutLink;

I set up everything properly, but it does nt work: in settings I set u the login page as "" when I press "Log in / create account" it redirects me to Joomla page "mydomain.com/index.php?option=com_user&view=login&return=" without any argument. Also, there may be problems with my "Mediawiki Cookie Domain" and "Mediawiki Cookie Path" in Joomla plugin in settings. What I should set to them, if wiki is installed to wiki.mydomain.com?

Help me please!

--TheAlex626 21:51, 19 June 2011 (UTC)

@TheAlex626 - "...when I press "Log in / create account" it redirects me to Joomla page...", that is exactly what it is supposed to do... Cookies domain ideally is left blank... Cookie Path depends on whether you set mediawiki up to use the same database or it's own, either way the format is pretty straight forward, without quotes or plus signs... (name of database) + "_" + database-prefix_ ... Example: joomladatabasename_jom_ or if you installed in same databse as joomla - example: joomladatabasename_mw_ where mw_ is mediawiki prefix in the joomla database

p.s. from what I understand the extension currently does not support subdomain indstalls of mediawiki.