Skip to content

Conversation

@rosalieper
Copy link
Contributor

@rosalieper rosalieper commented Jan 8, 2026

Bug: T410856

@rosalieper rosalieper marked this pull request as draft January 8, 2026 13:50
Copy link
Contributor

@tarrow tarrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good direction to start in. Definitely a bit different from the raw string matching in the ticket but seems a fine idea to me. I like the test. I guess you're also working on one for Wiki data too?

One comment I added for myself to worry about because I have some vague memory about these connections being a bit odd when we set them like this but I need to do some research


$manager = app()->db;
$manager->purge('mw');
$mwConn = $manager->connection('mw');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Tom to look up:

  • do we also need to undo this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving this open for @tarrow

@rosalieper rosalieper marked this pull request as ready for review January 9, 2026 12:18
Copy link
Contributor

@AndrewKostka AndrewKostka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it out and it works for me locally. I added a few suggestions for ways we could reduce the number of queries if we run into any performance issues. However, the benefits only kick in for larger email lists. I don't suspect we'll use this feature that heavily, so I'd ignore these suggestions for now.

$pdo = $this->db->connection('mw')->getPdo();

$mwDatabases = $pdo
->query("SHOW DATABASES LIKE 'mwdb_%'")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could choose to run this query only once per command execution.

}

private function findUserTable(PDO $pdo, string $dbName): ?string {
$stmt = $pdo->prepare("
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also choose to run this query only once per command execution.

$stmt = $pdo->prepare("
SELECT 1
FROM {$dbName}.{$table}
WHERE user_email = :email
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could check all emails in bulk using one query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants