Page MenuHomePhabricator

Populate user_is_temp column for existing temporary accounts
Closed, ResolvedPublic2 Estimated Story Points

Description

Currently mediawiki/core does not write to the user_is_temp column in the user table. A maintenance script, which is added to update.php, should be created that populates the user_is_temp column.

Acceptance criteria
  • Create a maintenance script that populates the user_is_temp column
  • Add this script to update.php

QA Results - Local

Event Timeline

Change 992260 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Add a maintenance script to populate user_is_temp column

https://gerrit.wikimedia.org/r/992260

Change 992707 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Add populateUserIsTemp.php to update.php

https://gerrit.wikimedia.org/r/992707

Change 992260 merged by jenkins-bot:

[mediawiki/core@master] Add a maintenance script to populate user_is_temp column

https://gerrit.wikimedia.org/r/992260

Change 992707 merged by jenkins-bot:

[mediawiki/core@master] Add populateUserIsTemp.php to update.php

https://gerrit.wikimedia.org/r/992707

Suggested QA steps intended for a local wiki:

  1. Create at least 4 temporary accounts and note down their usernames
  2. Run the following SQL to simulate these temporary accounts not having user_is_temp set to 1. Replace <temp account name> with the usernames from step 1. If you have more accounts, then add , '<temp account name>' before ) but after the last comma.
UPDATE user SET user_is_temp = 0 WHERE user_name IN ('<temp account name>', '<temp account name>', '<temp account name>', '<temp account name>');
  1. Run ./maintenance/run populateUserIsTemp.php --force
  2. Verify that the following SQL produces the value 0. Replace <temp account name> in the same way as step 2 in the query:
SELECT COUNT(*) FROM user WHERE user_name IN ('<temp account name>', '<temp account name>', '<temp account name>', '<temp account name>') AND user_is_temp = 0;

@Dreamy_Jazz Do with the previous temp account format of *Unregistered 1, it seems to work as designed by changing the user_is_temp from 0 to 1 after running ./maintenance/run populateUserIsTemp.php --force1 as seen in the screenshot below. When I repeated the same steps with the new format of ~2024-8 with the configurations from https://phabricator.wikimedia.org/T349501#9435875, the user_is_temp did not update it to 1 after running the ./maintenance/run populateUserIsTemp.php --force1 as seen from the 2nd screenshot.

Status: ❌ FAIL
Environment: Local: 1.42.0-alpha (0ecd8c1)15:43, 1 February 2024
OS: macOS Sonoma 14.2.1
Browser: Chrome 120
Skins. Vector 2022
Device: MBA M2
Emulated Device:: n/a
Test Links:
http://localhost:8080/w/index.php?title=Cat&action=history

✅AC1: https://phabricator.wikimedia.org/T355181- Old Temp format ex. *Unregistered 4

2024-02-01_14-23-59.png (1×3 px, 869 KB)

❌AC2: https://phabricator.wikimedia.org/T355181 -New Temp format ex. ~2024-8. Ran with the configurations from https://phabricator.wikimedia.org/T349501#9435875

2024-02-01_15-04-19.png (1×3 px, 865 KB)

@Dreamy_Jazz After adding $wgAutoCreateTempUser['matchPattern'] = [ '~$1', '*$1']; to my LocalSettings.php, it fixed the issue as seen in the screenshot below. I will move this to Done. Thanks for all your work and steps!

Status: ✅ PASS
Environment: Local: 1.42.0-alpha (0ecd8c1)15:43, 1 February 2024
OS: macOS Sonoma 14.2.1
Browser: Chrome 120
Skins. Vector 2022
Device: MBA M2
Emulated Device:: n/a
Test Links:
http://localhost:8080/w/index.php?title=Dog&action=history

✅AC1: https://phabricator.wikimedia.org/T355181 - As seen previously

✅AC2: https://phabricator.wikimedia.org/T355181

2024-02-01_16-14-00.png (859×1 px, 151 KB)