Last modified: 2010-05-15 15:33:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T5360, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 3360 - DB queries fail on external Auth-Plugins
DB queries fail on external Auth-Plugins
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
User login and signup (Other open bugs)
1.4.x
PC All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: testme
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-04 20:51 UTC by Benny Baumann
Modified: 2010-05-15 15:33 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
The external AuthPlugin (phpBB Auth for Wiki) (12.60 KB, text/plain)
2005-09-05 09:02 UTC, Benny Baumann
Details

Description Benny Baumann 2005-09-04 20:51:47 UTC
When an AuthPlugin directly uses mysql_connect to connect to a different DB on
the same MySQL server any DB requests by the MediaWiki fail producing the
following stack trace:

Notice: Only variable references should be returned by reference in
/wiki/includes/Namespace.php on line 136
Notice: Only variable references should be returned by reference in
/wiki/includes/ObjectCache.php on line 369
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Notice: Only variables should be assigned by reference in
/wiki/includes/Parser.php on line 1225
Notice: Only variables should be assigned by reference in
/wiki/includes/Parser.php on line 1045
Notice: Only variables should be assigned by reference in
/wiki/includes/Parser.php on line 1140
Notice: Only variables should be assigned by reference in
/wiki/includes/Parser.php on line 2540
Notice: Only variables should be assigned by reference in
/wiki/includes/Parser.php on line 796
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Notice: Only variable references should be returned by reference in
/wiki/includes/SkinTemplate.php on line 136
Notice: Only variable references should be returned by reference in
/wiki/includes/Namespace.php on line 136
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Notice: Only variable references should be returned by reference in
/wiki/includes/Namespace.php on line 136
Warning: mysql_query(): 63 is not a valid MySQL-Link resource in
/wiki/includes/Database.php on line 349
Unable to free MySQL result

Backtrace:

    * GlobalFunctions.php line 524 calls wfbacktrace()
    * Database.php line 495 calls wfdebugdiebacktrace()
    * User.php line 594 calls databasemysql::freeresult()
    * SkinTemplate.php line 254 calls user::getnewtalk()
    * OutputPage.php line 431 calls skinmonobook::outputpage()
    * index.php line 223 calls outputpage::output()
Comment 1 Brion Vibber 2005-09-04 22:26:37 UTC
Please provide sample code to reproduce.
Comment 2 Benny Baumann 2005-09-05 09:02:37 UTC
Created attachment 854 [details]
The external AuthPlugin (phpBB Auth for Wiki)

This AuthPlugin is a modified version of
http://meta.wikimedia.org/wiki/PHPBB/Users_Integration which was modified to
work with the phpBB table if it's on a different DB than the Wiki.
Comment 3 Benny Baumann 2005-09-05 09:10:00 UTC
I forgot to mention installiation due to changes in my code:

Add the following lines somewhere in the LocalSettings.php for the Wiki:

// PHPBB User Database Plugin. (Requires MySQL Database)
require_once './extensions/Auth_phpBB.php'; 
$wgPHPBB_WikiGroupName  = 'Entwickler (Wiki)';  // Name of your phpBB group
users need to be a member of to use the wiki. (i.e. wiki)
$wgPHPBB_DBserver       = $wgDBserver;          // Name of your phpBB DB Server
$wgPHPBB_DBname         = "usr_web28_2";        // Name of your phpBB DB Name
(different from the Wiki's one)
$wgPHPBB_DBuser         = $wgDBuser;            // Name of your phpBB DB User
$wgPHPBB_DBpassword     = $wgDBpassword;        // Name of your phpBB DB Password
$wgPHPBB_UserTB         = 'phpbb_users';        // Name of your phpBB user
table. (i.e. phpbb_users)
$wgPHPBB_GroupsTB       = 'phpbb_groups';       // Name of your phpBB groups
table. (i.e. phpbb_groups)
$wgPHPBB_User_GroupTB   = 'phpbb_user_group';   // Name of your phpBB user_group
table. (i.e. phpbb_user_group)
$wgAuth                 = new Auth_PHPBB();     // Auth_PHPBB Plugin.
Comment 4 Brion Vibber 2005-09-05 20:20:04 UTC
If your server, username, and password are the same for the PHPBB 
connection, mysql_connect() will by default reuse an existing open 
connection -- which will belong to the wiki. When you do mysql_select_db() 
on that connection to use a different database, that will leave the wiki's 
connection fubar'd.

Either pass the new_link parameter to mysql_connect(), or mysql_select_db
() it back when you're done.

See: http://www.php.net/mysql_connect
Comment 5 Benny Baumann 2005-09-06 17:52:02 UTC
Well, at first a big THX for this information. But wouldn't it be more intuitive
to change the behaviour of the database object that way that the selectdb is
auto-exec bevore each query?

But well, I'll include that 4th param to fix it as suggested.
Comment 6 Brion Vibber 2005-09-06 22:14:43 UTC
That would be an unnecessary burden on performance, and very error-prone 
where multi-database stuff actually is supposed to happen. It's better to not 
corrupt your database connections in the first place! :)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links