Last modified: 2010-05-15 15:38:40 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 T3976, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1976 - $wgSharedDB not working -- bad if statement in Database.php
$wgSharedDB not working -- bad if statement in Database.php
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.5.x
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://aroip.com/el/
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-25 17:37 UTC by Leonard Burton
Modified: 2010-05-15 15:38 UTC (History)
0 users

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


Attachments
patch for HEAD (656 bytes, patch)
2005-05-08 07:49 UTC, Michael Keppler
Details
patch for REL14 (671 bytes, patch)
2005-05-08 07:50 UTC, Michael Keppler
Details

Description Leonard Burton 2005-04-25 17:37:30 UTC
I had trouble getting $wgSharedDB working and I uncovered an error on Database.php.

Line 984 reade: "if ( isset( $wgSharedDB ) && 'user' == $name ) {"

when it should read something like:
if (isset( $wgSharedDB ) && $this->mTablePrefix.'user' == $name ) {

It is not comparing the table prefixes

After the code edit it works on my installation.

Thanks,

Leonard


Original Code

        function tableName( $name ) {
                global $wgSharedDB;
                # Skip quoted literals
                if ( $name{0} != '`' ) {
                        if ( $this->mTablePrefix !== '' &&  strpos( '.', $name )
=== false ) {
                                $name = "{$this->mTablePrefix}$name";
                        }
                        if ( isset( $wgSharedDB ) && 'user' == $name ) {
                                $name = "`$wgSharedDB`.`$name`";
                        } else {
                                # Standard quoting
                                $name = "`$name`";
                        }
                }
                return $name;
        }



What I did for my purpose

function tableName( $name ) {
                global $wgSharedDB;
                # Skip quoted literals
                if ( $name{0} != '`' ) {
                        if ( $this->mTablePrefix !== '' &&  strpos( '.', $name )
=== false ) {
                                $name = "{$this->mTablePrefix}$name";
                        }
                        if (isset( $wgSharedDB ) && $this->mTablePrefix.'user'
== $name ) {
                                $name = "`$wgSharedDB`.`$name`";
                        } else {
                                # Standard quoting
                                $name = "`$name`";
                        }
                }
                return $name;
        }
Comment 1 Michael Keppler 2005-05-08 07:49:08 UTC
Created attachment 503 [details]
patch for HEAD

The patch adds the tablePrefix to the comparison string (using the same quoted
string like two lines above with $name replaced by user).
Comment 2 Michael Keppler 2005-05-08 07:50:07 UTC
Created attachment 504 [details]
patch for REL14

patch for REL14 does the same as for HEAD
Comment 3 Brion Vibber 2005-06-06 00:39:41 UTC
Fix applied to CVS HEAD and REL1_4.

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


Navigation
Links