[wiki-tech] WordPress/MediaWiki AuthPlugin
Greg Elin
greg at fotonotes.net
Sat Aug 27 01:15:08 GMT 2005
Rob,
I solved problem by including the remaining $wgAuth lines. My first
attempt only had the first three lines.
require_once( 'extensions/AuthPress.php' );
$wgAuth = new AuthPress();
$wgAuth->setAuthPressTablePrefix('wp_');
It worked if I included all the lines:
# Use bbPress Authentication
require_once( 'extensions/AuthPress.php' );
$wgAuth = new AuthPress();
$wgAuth->setAuthPressTablePrefix('wp_');
# Only include the following if you aren't using the same db as
MediaWiki
$wgAuth->setAuthPressDBServer ('localhost');
$wgAuth->setAuthPressDBName('wordpress');
$wgAuth->setAuthPressUser('');
$wgAuth->setAuthPressPassword('
The correction in the database connection is only made if a different
database is selected.
One solution is to have users always specify the full details, which
is what I did, or refactor this function.
Preference?
function &getAuthPressDB () {
if( $this->mUseSeparateAuthPressDB ) {
//print $this->mAuthPressDBServer;
//print $this->mAuthPressUser;
//print $this->mAuthPressPassword;
//print $this->mAuthPressDBName;
if(! is_object($this->mDBconn) ) {
$this->mAuthPressDBconn =
new Database($this->mAuthPressDBServer,
$this->mAuthPressUser,
$this->mAuthPressPassword,
$this->mAuthPressDBName,
false,
0,
$mAuthPressTablePrefix);
}
return $this->mAuthPressDBconn;
}
else {
return wfGetDB( DB_SLAVE );
}
}
Greg
On Aug 26, 2005, at 5:49 PM, Rob Lanphier wrote:
> The problem is probably because AuthPress using the MediaWiki database
> helper functions to access the WordPress database. It appears that
> those functions prepend the MediaWiki namespace on the front.
>
> So, there's a couple things you can do:
> * Not use a prefix on your MediaWiki database. Kludgey as hell, but
> would do the trick.
> * Alter the call to the Database constructor in getAuthPressDB.
> It can
> have 4-7 parameters. The current version uses the 4 parameter
> version,
> and relies on the defaults for parameters 5-7. The last three
> parameters and their defaults are $failFunction = false, $flags = 0,
> $tablePrefix = 'get from global'. So, tack this on to the end of the
> call: false, 0, ''.
>
> Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wiki-tech/attachments/20050827/fb09e226/attachment.html
More information about the wiki-tech
mailing list