Page MenuHomePhabricator

wfGetDB error when installing MediaWiki
Closed, DeclinedPublic

Description

Author: ruben.cheng

Description:
I tried to install for the first time mediawiki, and I got the following message:


Mediawiki tried to access the database via wfGetDB(). This is not allowed.

Backtrace:

#0 /export/www/intranet/ingenieria/proc-1.18.1/includes/GlobalFunctions.php(3224): LBFactory_Fake->getMainLB(false)
#1 /export/www/intranet/ingenieria/proc-1.18.1/includes/GlobalFunctions.php(3214): wfGetLB(false)
#2 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(1028): wfGetDB(-2)
#3 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(302): User->loadFromDatabase()
#4 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(268): User->loadFromId()
#5 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(1995): User->load()
#6 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(988): User->getToken()
#7 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(271): User->loadFromSession()
#8 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(3927): User->load()
#9 /export/www/intranet/ingenieria/proc-1.18.1/includes/User.php(2124): User->loadOptions()
#10 /export/www/intranet/ingenieria/proc-1.18.1/includes/RequestContext.php(220): User->getOption('language')
#11 /export/www/intranet/ingenieria/proc-1.18.1/includes/StubObject.php(151): RequestContext->getLang()
#12 /export/www/intranet/ingenieria/proc-1.18.1/includes/StubObject.php(103): StubUserLang->_newObject()
#13 /export/www/intranet/ingenieria/proc-1.18.1/includes/StubObject.php(57): StubObject->_unstub('getCode', 5)
#14 /export/www/intranet/ingenieria/proc-1.18.1/includes/StubObject.php(147): StubObject->_call('getCode', Array)
#15 /export/www/intranet/ingenieria/proc-1.18.1/includes/parser/ParserOptions.php(227): StubUserLang->call('getCode', Array)
#16 /export/www/intranet/ingenieria/proc-1.18.1/includes/parser/ParserOptions.php(227): StubUserLang->getCode()
#17 /export/www/intranet/ingenieria/proc-1.18.1/includes/parser/ParserOptions.php(175): ParserOptions->initialiseFromUser(NULL)
#18 /export/www/intranet/ingenieria/proc-1.18.1/includes/installer/Installer.php(357): ParserOptions->
construct()
#19 /export/www/intranet/ingenieria/proc-1.18.1/includes/installer/WebInstaller.php(114): Installer->construct()
#20 /export/www/intranet/ingenieria/proc-1.18.1/mw-config/index.php(23): WebInstaller->
construct(Object(WebRequest))
#21 /export/www/intranet/ingenieria/proc-1.18.1/mw-config/index.php(18): wfInstallerMain()

#22 {main}

The server is running PHP Version 5.3.3 with OpenSuse x64 and apache 2.2.13
Directory is chmoded to 777


Version: 1.18.x
Severity: major
OS: Linux
Platform: Other

Details

Reference
bz33684

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:09 AM
bzimport set Reference to bz33684.
bzimport added a subscriber: Unknown Object (MLST).

Are you using Postgres? Mysql? Sqlite?

For other devs maybe looking at this: Looks like a change in ParserOptions causes this to load from the RequestContext user (which doesn't exist in the installer!). Although it's a similar bug, it's *not* the same as bug 28172 per the stack trace.

ruben.cheng wrote:

The server's php has postgres, mysql and sqlite capabilities. I tried disabling postgres module from PHP and got the same error. The database that I will use is mysql but the error appears just entering the URL for installattion, it didn't even show up the first step. I have read the bug 28172 and it's similar but not the same (seems to be some steps ahead).

ruben.cheng wrote:

What strange!.... I tried few minutes ago again without changing anything using the same URL and the installation worked!

Stumbled upon a similar error. Just cloned from github, Composer installed and run the installation. It crashes while creating the administrator account:
[423fc2fd] /mediawiki/mw-config/?page=Name DBAccessError from line 364 of /home/spoom/eclipse/workspace/mediawiki/includes/db/LBFactory.php: Mediawiki tried to access the database via wfGetDB(). This is not allowed.

Backtrace:

#0 /home/spoom/eclipse/workspace/mediawiki/includes/GlobalFunctions.php(3614): LBFactoryFake->getMainLB(boolean)
#1 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(348): wfGetLB()
#2 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(2991): User->load()
#3 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(3006): User->getGroups()
#4 /home/spoom/eclipse/workspace/mediawiki/includes/password/UserPasswordPolicy.php(103): User->getEffectiveGroups()
#5 /home/spoom/eclipse/workspace/mediawiki/includes/password/UserPasswordPolicy.php(74): UserPasswordPolicy->getPoliciesForUser(User)
#6 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(859): UserPasswordPolicy->checkUserPassword(User, string)
#7 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(807): User->checkPasswordValidity(string)
#8 /home/spoom/eclipse/workspace/mediawiki/includes/installer/WebInstallerPage.php(912): User->getPasswordValidity(string)
#9 /home/spoom/eclipse/workspace/mediawiki/includes/installer/WebInstallerPage.php(739): WebInstallerName->submit()
#10 /home/spoom/eclipse/workspace/mediawiki/includes/installer/WebInstaller.php(280): WebInstallerName->execute()
#11 /home/spoom/eclipse/workspace/mediawiki/mw-config/index.php(77): WebInstaller->execute(array)
#12 /home/spoom/eclipse/workspace/mediawiki/mw-config/index.php(36): wfInstallerMain()
#13 {main}

Version: MediaWiki 1.26alpha installation
OS: Ubuntu 15.04 + MySQL

Stumbled upon a similar error. Just cloned from github, Composer installed and run the installation. It crashes while creating the administrator account:
[423fc2fd] /mediawiki/mw-config/?page=Name DBAccessError from line 364 of /home/spoom/eclipse/workspace/mediawiki/includes/db/LBFactory.php: Mediawiki tried to access the database via wfGetDB(). This is not allowed.

Backtrace:

#0 /home/spoom/eclipse/workspace/mediawiki/includes/GlobalFunctions.php(3614): LBFactoryFake->getMainLB(boolean)
#1 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(348): wfGetLB()
#2 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(2991): User->load()
#3 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(3006): User->getGroups()
#4 /home/spoom/eclipse/workspace/mediawiki/includes/password/UserPasswordPolicy.php(103): User->getEffectiveGroups()
#5 /home/spoom/eclipse/workspace/mediawiki/includes/password/UserPasswordPolicy.php(74): UserPasswordPolicy->getPoliciesForUser(User)
#6 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(859): UserPasswordPolicy->checkUserPassword(User, string)
#7 /home/spoom/eclipse/workspace/mediawiki/includes/User.php(807): User->checkPasswordValidity(string)
#8 /home/spoom/eclipse/workspace/mediawiki/includes/installer/WebInstallerPage.php(912): User->getPasswordValidity(string)
#9 /home/spoom/eclipse/workspace/mediawiki/includes/installer/WebInstallerPage.php(739): WebInstallerName->submit()
#10 /home/spoom/eclipse/workspace/mediawiki/includes/installer/WebInstaller.php(280): WebInstallerName->execute()
#11 /home/spoom/eclipse/workspace/mediawiki/mw-config/index.php(77): WebInstaller->execute(array)
#12 /home/spoom/eclipse/workspace/mediawiki/mw-config/index.php(36): wfInstallerMain()
#13 {main}

Version: MediaWiki 1.26alpha installation
OS: Ubuntu 15.04 + MySQL

Thank you for reporting that, but you hit a different issue here. I filled your bug as T104519.