https://bugzilla.wikimedia.org/show_bug.cgi?id=28917

       Web browser: ---
             Bug #: 28917
           Summary: Install seems to try to GRANT when not necessary
           Product: MediaWiki
           Version: 1.17.0beta1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Installation
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: pi...@pioto.org
                CC: innocentkil...@gmail.com
    Classification: Unclassified


I've tried testing out installing MediaWiki 1.17.0beta1 in an environment where
the database has been created, using a user that already exists with privileges
to use the database, but not to grant use to anyone else. I've entered the same
username & password for both the "Install" database user and the regular
database user (as in, I selected the "use the same user" radio button).
However, my install ends up failing with this error:

Granting permission to user "testuser" failed: A database query syntax error
has occurred. The last attempted database query was: "GRANT ALL PRIVILEGES ON
`testuser_mediawiki`.* TO 'testuser'@'db.example.com'" from within function
"MysqlInstaller::setupUser". Database returned error "1044: Access denied for
user 'testuser'@'%' to database 'testuser_mediawiki' (db.example.com)"
Backtrace:

    0 /www/testuser/mediawiki-test/includes/db/Database.php(751):
DatabaseBase->reportQueryError('Access denied f...', 1044, 'GRANT ALL
PRIVI...', 'MysqlInstaller:...', false)
    1 /www/testuser/mediawiki-test/includes/installer/MysqlInstaller.php(503):
DatabaseBase->query('GRANT ALL PRIVI...', 'MysqlInstaller:...')
    2 [internal function]: MysqlInstaller->setupUser(Object(MysqlInstaller))
    3 /www/testuser/mediawiki-test/includes/installer/Installer.php(1293):
call_user_func(Array, Object(MysqlInstaller))
    4
/www/testuser/mediawiki-test/includes/installer/WebInstallerPage.php(1084):
Installer->performInstallation(Array, Array)
    5 /www/testuser/mediawiki-test/includes/installer/WebInstaller.php(246):
WebInstaller_Install->execute()
    6 /www/testuser/mediawiki-test/mw-config/index.php(46):
WebInstaller->execute(Array)
    7 /www/testuser/mediawiki-test/mw-config/index.php(14): wfInstallerMain()
    8 {main}

So, even though it is seeming to use the user that I entered, it seems to want
to try to grant privileges to use the database that it's already connected to
to itself, which seems silly.

I tried tracing through the code in /includes/installer/MysqlInstaller.php's
canCreateAccounts(), but I can't see why it would think this user would be able
to create an account.

I think that I might see the problem:

452                 } else {
453                         $grantableNames[] = $this->buildFullUserName(
$dbUser, $server );
454                         $tryToCreate = false;
455                 }

So, that means that it will try to grant privileges to itself, in this case, at
least as far as I can tell. Maybe the code should specifically check to see if
the $this->getVar('_InstallUser') equals $this->getVar('wgDBuser') and just
return early from setupUser()

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to