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

       Web browser: ---
            Bug ID: 47490
           Summary: resetUserTokens.php not usable on large wikis
           Product: MediaWiki
           Version: 1.22-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Maintenance scripts
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified
   Mobile Platform: ---

resetUserTokens.php calls User::saveSettings(), which is fast enough for most
things, but far too slow for the task of modifying every user in the database.
It may even have scary side-effects like preference normalisation. 

Also, the main SELECT query is not batched and may use a lot of memory.

What's needed is something that just does updates user_token for each user and
nothing else. Calling authentication plugin hooks while this is going on is
probably harmful: CentralAuth can more efficiently update gu_auth_token in a
script of its own.

MySQL doesn't provide a particularly convenient method for updating multiple
rows at a time with different literal values, but something like this seems to
be possible:

CREATE TEMPORARY TABLE new_tokens (nt_user_id int, nt_token varbinary(32));
INSERT INTO new_tokens VALUES (...), (...), ...;
UPDATE user SET user_token = (SELECT nt_token FROM new_tokens WHERE
nt_user_id=user_id) WHERE user_id BETWEEN ... AND ...;

Maybe if the rows were updated in batches of 50 or so, a large wiki could have
its tokens reset in a reasonable amount of time.

-- 
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