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

       Web browser: ---
            Bug ID: 50275
           Summary: CreateAccount API call doesn't COMMIT the operation
           Product: MediaWiki
           Version: 1.21.1
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: API
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---

The problem in a nutshell is:
- I try to create an account via an API call
- All the queries run successfully and the result is "success"
- At the end of the whole process MediaWiki closes connection without doing a
COMMIT thus losing all previous actions

The problem detailed:

1.) I use the following code for creating a new account:
<?php
$nick = 'test45';
$pwd = 'aaaaaa';
$email = '[email protected]';

$user = make_fake_request(
        array(
                'action' => 'createaccount',
                'name' => $nick,
                'password' => $pwd,
                'email' => $email,
                'token' => ''
        ));

if (isset($user['createaccount']) && $user['createaccount']['result'] ==
'needtoken') {
    $user = make_fake_request( // Felhasználó regisztrálása
            array(
                    'action' => 'createaccount',
                    'name' => $nick,
                    'password' => $pwd,
                    'email' => $email,
                    'token' => $user['createaccount']['token']
            ));

    if (isset($user['createaccount']) && $user['createaccount']['result'] ==
'success') {
        echo "OK";
    }
}
?>

The "make_fake_request" function consist of the following:
<?php
require_once ("$IP/includes/WebStart.php");
global $wgRequest;
$request = new DerivativeRequest($wgRequest, $params, true);
$api = new ApiMain($request, true);
$api->execute();
$x = & $api->getResultData();
return $x;
?>

This echoes me "OK" all the time when I fill it with valid data.

2.) In the MySQL query log the following runs:
Connect    
Init DB    
Query    SET /* DatabaseMysql::open */ NAMES utf8
Query    SET /* DatabaseMysql::open */ sql_mode = ''
Query    BEGIN /* DatabaseBase::query (Title::getCascadeProtectionSources) */
Query    SELECT /* Title::getCascadeProtectionSources [...] FROM
`templatelinks`,`page_restrictions`,`page` WHERE [...]
Query    SELECT /* Block::newLoad [...] FROM `ipblocks` WHERE [...]
Query    SELECT /* Block::newLoad [...] FROM `ipblocks` WHERE [...]
Query    SELECT /* Title::getCascadeProtectionSources [...] FROM
`templatelinks`,`page_restrictions`,`page` WHERE [...]
Query    SELECT /* Title::getCascadeProtectionSources [...] FROM
`templatelinks`,`page_restrictions`,`page` WHERE [...]
Query    SELECT /* User::idForName [...] FROM `user` WHERE [...]
Query    SELECT /* User::idFromName [...] FROM `user` WHERE [...]
Query    INSERT /* User::addToDatabase */ IGNORE INTO `user` [...]
Query    SELECT /* User::loadOptions [...] FROM `user_properties` WHERE [...]
Query    DELETE /* User::saveOptions */ FROM `user_properties` WHERE  [...]
Query    UPDATE /* User::saveSettings */  `user` SET  [...]
Query    DELETE /* User::saveOptions */ FROM `user_properties` WHERE  [...]
Query    INSERT /* User::saveOptions */  INTO `user_properties`  [...]
Query    UPDATE /* Title::invalidateCache */  `page` SET  [...]
Query    SELECT /* WikiPage::pageData [...] FROM `page` WHERE [...]
Query    UPDATE /* User::saveSettings */  `user`  [...]
Query    DELETE /* User::saveOptions */ FROM `user_properties` WHERE  [...]
Query    INSERT /* User::saveOptions */  INTO `user_properties`  [...]
Query    UPDATE /* Title::invalidateCache */  `page`  [...]
Query    SELECT /* WikiPage::pageData [...] FROM `page` WHERE [...]
Query    INSERT /* ManualLogEntry::insert */  INTO `logging`  [...]
Query    SELECT /* User::idFromName [...] FROM `user` WHERE [...]
Query    SELECT /* User::loadGroups [...] FROM `user_groups` WHERE [...]
Query    SELECT /* User::getEditCount [...] FROM `user` WHERE [...]
Query    INSERT /* RecentChange::save */  INTO `recentchanges`  [...]
Query    SELECT /* EmailNotification::notifyOnPageChange [...] FROM `watchlist`
WHERE [...]
Quit    

3.) As you can see above, there's no COMMIT at the end, so all of the changes
will be rolled back as soon as the PHP is closing its connection.

The SQL server is MySQL v5.5.30.

-- 
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
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to