Page MenuHomePhabricator

Generate a MassMessage list of admins [M]
Open, MediumPublic

Description

Motivation

For the ongoing IP Masking consultation, we want to inform and invite all administrators across our projects to partake in the discussion. This will be done using the MassMessage extension. MassMessage extension takes in a text message, a list of users, with their preferred language wiki project, and deposits the text message on their talk page on the given wiki. The purpose of this task is to generate the list of users so we can message them.

AC
  • Generate a list of all users on our projects who hold the "sysop" right on any project in the following format:
# {{#target:User talk:ABC|ja.wikipedia.org}}
# {{#target:User talk:DEF|en.wikipedia.org}}
...
  • The wiki at the end is the project they are a sysop in.
  • Share the list in a phab paste and link in this ticket.

Here's an example page for what this list would look like on a wiki page. You can hit edit source to see the list in the above format.

This ticket can bypass QA.

Event Timeline

Niharika triaged this task as Medium priority.Nov 23 2021, 8:38 PM
Niharika created this task.
Niharika renamed this task from Generate a MassMessage list of users for IP Masking to Generate a MassMessage list of admins .Nov 23 2021, 8:39 PM
ARamirez_WMF renamed this task from Generate a MassMessage list of admins to Generate a MassMessage list of admins [M].Nov 30 2021, 4:59 PM

tl;dr: https://phabricator.wikimedia.org/P17984


I was able to generate this list fairly easily – i.e. if I've made a mistake, then it's easy to regenerate the list 😅 – thanks to both @Ladsgroup and @Marostegui. I would have liked to have done it in fewer steps but I couldn't find a way to map dbname to domain using only data from the Analytics MariaDB servers. Anyway, here are the steps that I took:

  1. ssh stat1006.eqiad.wmnet
  2. Create the following file:
T296338.sql
select
  database(),
  user_name
from
  user join user_groups
    on user.user_id = user_groups.ug_user
where
  ug_group = 'sysop'
  1. php /srv/mediawiki-config/multiversion/bin/expanddblist 'group0 + group1 + group2 - private' | xargs -I{} sh -c 'analytics-mysql {} -N < T296338.sql >> T296338.txt'
  2. Download T296338.txt
  3. Download the result of this query, which uses the meta_p.wiki table to map dbname to domain
  4. Join the contents of the files downloaded above with the following script:
T296338.php
<?php

// 1. Generate a map of dbname to domain
$dbnameToDomainMap = [];

foreach ( file( './dbname-domain.tsv', FILE_IGNORE_NEW_LINES| FILE_SKIP_EMPTY_LINES ) as $line ) {
    list( $dbname, $domain ) = explode( "\t", $line, 2 );

    $dbnameToDomainMap[$dbname] = $domain;
}

// 2. Generate the list of target parser function invocations
foreach ( file( './T296338.tsv', FILE_IGNORE_NEW_LINES| FILE_SKIP_EMPTY_LINES ) as $line ) {
    list( $dbname, $username ) = explode( "\t", $line, 2 );

    if ( !isset( $dbnameToDomainMap[$dbname] ) ) {
        // ?!

        continue;
    }

    echo sprintf( "{{#target:User_talk:%s|%s}}\n", $username, $dbnameToDomainMap[$dbname] );
}
Notes
  1. For more detail about the Analytics MariaDB servers, see https://wikitech.wikimedia.org/wiki/Analytics/Systems/MariaDB
  2. For some detail about the expanddblist binary, see https://wikitech.wikimedia.org/wiki/Wikimedia_binaries#expanddblist and https://gerrit.wikimedia.org/r/plugins/gitiles/operations/mediawiki-config/+/refs/heads/master/multiversion/bin/expanddblist