Extension talk:ExtAuthDB

Latest comment: 10 years ago by Ua2004 in topic If external DB is also using MediaWiki

Auth problem MW 1.15

edit

It's not working... Theres no errors but when the extension is active I can't create accounts, the users/password of the MySQL Database are not working, and the wiki users/password are not working neither.

What can I do? --Romulocantor 16:10, 20 July 2009 (UTC)Reply

This extension was created to use an external page for create accounts.. so that if you need again, then you could send me an email and I see to add an variable about this choice. -- Bilardi 15:12, 29 September 2009 (UTC)Reply
Hi there... thanks for the response! Im using the 1.15 release and the extension is not working. Can you pls take a look at this? thanks mate.--Romulocantor 00:46, 6 October 2009 (UTC)Reply

Nope, it doesn't work. I went through the steps and I've created a database user with privileges to the user table but no dice. I suspect it has something to do with the type of hash being used. Which algorithm does mediawiki use by default? Zoef1234 14:52, 1 October 2009 (UTC)Reply

I'm using ExtAuthDB with 1.14.0 release and, about privileges, I'm using Extension:AdminWhiteList. Now, I'll install 1.15 release and I'll check errors because I don't understand which it is the problem. -- Bilardi 15:30, 1 October 2009 (UTC)Reply
Hi all, I'm testing ExtAuthDB with 1.15.1 release and, .. it works: File:ExtAuthDB_with_1.15.1.png.. so that if you paste your parameters.. maybe I could help you.. -- Bilardi 16:42, 6 October 2009 (UTC)Reply
Cool, here they are:
// add ExtAuthDB
// MySQL Host Name.
$wgExtAuthDB_MySQL_Host = '200.200.200.200';
// MySQL Username.
$wgExtAuthDB_MySQL_Username = 'sqluser';
// MySQL Password.
$wgExtAuthDB_MySQL_Password = 'password';
// MySQL Database Name.
$wgExtAuthDB_MySQL_Database = 'usersdb';
// MySQL Database Table of users data.
$wgExtAuthDB_MySQL_Table = 'userstbl';
// MySQL Database username column label.
$wgExtAuthDB_MySQL_Login = 'LOGIN_UID';
// MySQL Database login password column label
$wgExtAuthDB_MySQL_Pswrd = 'LOGIN_PWD';
// MySQL Database email column label
$wgExtAuthDB_MySQL_Email = 'EMAIL';
// MySQL Database user real name column label
$wgExtAuthDB_MySQL_RealN = 'REALNAME';
 
require_once("/var/www/wiki/extensions/ExtAuthDB/ExtAuthDB.php");
$wgAuth = new ExtAuthDB();

index.php looks blank with this (yes, I have tried the actual MySQL login and I can SELECT * FROM userstbl; fine) -- Zoef1234 16:17, 9 October 2009 (UTC)Reply

Ok, but it is not all. I would like know:
  • result about MySQL command: 'desc userstbl'
  • lines about /var/log/apache2/?.*/error.log when you look index.php blank
  • log about host name instead IP number, into $wgExtAuthDB_MySQL_Host
  • log about query from wiki server shell: mysql -h 200.200.200.200 -u sqluser -ppassword usersdb -e "select * from userstbl"
-- Bilardi 16:58, 9 October 2009 (UTC)Reply

Problem with Table Prefixes

edit

This extension assumes that either the MW database doesn't use table prefixes or that the external database uses the same prefixes as the MW tables. I.e., every query operation attempts to add my 3-letter prefix to the tablename in the external database, which doesn't have the prefix; fail. --76.8.128.114 19:49, 7 January 2010 (UTC)Reply

Agree with this. Having the same problem. My external db I'm validating off of doesn't have the mw_ prefix, of course. The only place I can see to change this is in localsettings.php -- but that then screws up the normal wiki operation database calls. There needs to be a way to override this so that it doesn't use the set prefix.

--68.225.169.164 22:07, 10 July 2011 (UTC)Reply

For MW 1.20.2

edit
    private function connectToDB()
    {
        $db = new Database( // <-- call constructor here
        $GLOBALS['wgExtAuthDB_MySQL_Host'],
        $GLOBALS['wgExtAuthDB_MySQL_Username'],
        $GLOBALS['wgExtAuthDB_MySQL_Password'],
        $GLOBALS['wgExtAuthDB_MySQL_Database'],
        0,      // <-- set to 0 here
        '');    // <-- make an empty string here '

--TomK

For MW 1.21

edit

Near the top:

    private function connectToDB()
    {
        $db = new DatabaseMysql( // <-- call constructor here
        $GLOBALS['wgExtAuthDB_MySQL_Host'],
        $GLOBALS['wgExtAuthDB_MySQL_Username'],
        $GLOBALS['wgExtAuthDB_MySQL_Password'],
        $GLOBALS['wgExtAuthDB_MySQL_Database'],
        0,      // <-- set to 0 here
        '');    // <-- make an empty string here '

and further down:

     function initUser( &$user, $autocreate=false ) {

--jhaagsma

For MW 1.22

edit
  protected function connectToDB()
  {
    $db = new DatabaseMysql(array(
      'host'        => $GLOBALS['wgExtAuthDB_MySQL_Host'],
      'user'        => $GLOBALS['wgExtAuthDB_MySQL_Username'],
      'password'    => $GLOBALS['wgExtAuthDB_MySQL_Password'],
      'dbname'      => $GLOBALS['wgExtAuthDB_MySQL_Database'],
      'flags'       => 0,
      'tablePrefix' => ''
    ));

--Tomme

For MW 1.26

edit
     protected function connectToDB()
     {
        $db = DatabaseBase::factory('mysql', array(
            'host'        => $GLOBALS['wgExtAuthDB_MySQL_Host'],
            'user'        => $GLOBALS['wgExtAuthDB_MySQL_Username'],
            'password'    => $GLOBALS['wgExtAuthDB_MySQL_Password'],
            'dbname'      => $GLOBALS['wgExtAuthDB_MySQL_Database'],
            'flags'       => 0,
            'tablePrefix' => ''
        ));

If external DB is also using MediaWiki

edit

If the external database is also for a MediaWiki website (e.g., you are making a wiki farm) then replace the authenticate function with this one

    function authenticate( $username, $password )
    {
        $db = $this->connectToDB();
        $hash_password = $db->selectRow($this->userTable,array ('user_id', $this->userPswrd), array ($this->userLogin => $username ), __METHOD__ );
        if (User::comparePasswords( $hash_password->{$this->userPswrd}, $password, $hash_password->user_id )) {
            return true;
        }
        return false;
    }

--Ua2004 (talk) 18:29, 8 June 2014 (UTC)Reply

It doesn't work.

edit

Hello. Why cannot I get worked ExtAuthDB, while I have done everything correct? I have multiple wikis, with mutual core files connected with junctions. My external user table is in different database and consists of username, password, salt, email, real_name. I couldn't figure out what is the problem. The problem is, when I try to login from the wiki, I get HTTP 500 error.

Return to "ExtAuthDB" page.