Page MenuHomePhabricator

Unused and orphaned i18n messages
Closed, ResolvedPublic

Description

Originally filed for oathauth-token; can't find any obvious usages in the PHP code...

If there is, add some grep-ability... Else remove it.

Event Timeline

Reedy triaged this task as Low priority.Jan 8 2024, 6:57 PM

(Using @Esanders's unmerged tool from 971262):

➜  OATHAuth git:(review/reedy/985933) ✗ node check-messages/index.js
Finding i18n files...
Searching code for message keys...
Searching git history for missing message keys...

Warning: 29 unused or undocumented keys found (out of 98):

* disableoathforuser
         en: Disable user's two-factor authentication
        qqq: {{doc-special|DisableOATHForUser}}
             not found in git history
* verifyoathforuser
         en: Verify two-factor authentication status
        qqq: {{doc-special|VerifyOATHForUser}}
             not found in git history
* specialpages-group-oath
         en: Two-factor authentication
        qqq: {{doc-special-group|like=[[Special:OATH]]}}

             See [[w:en:Two_factor_authentication|Wikipedia article on two factor authentication]].

             {{Identical|Two factor authentication}}
             not found in git history
* oathauth-token
         en: Code
        qqq: HTMLForm label, found on [[Special:OATH]], when verifying OATH.
             {{Identical|Token}}
  last seen: e38c68c
    subject: Remove pre authmanager MW support
      files: OATHAuth.hooks.legacy.php
* oathauth-step1
         en: Step 1: Download a two-factor authentication program
        qqq: Label for step 1 on Special:OATH form
  last seen: 017d8c8
    subject: Support for multiple keys, improved module form logic #2
      files: src/Special/TOTPEnable.php
* oathauth-step2
         en: Step 2: Scan the QR code
        qqq: Label for step 2, the QR code, on Special:OATH
  last seen: ca3b49b
    subject: TOTPEnableForm: Add message for step 2 before qr code image
      files: src/HTMLForm/TOTPEnableForm.php
* oathauth-step3
         en: Step 3: Write down the recovery codes
        qqq: Label for step 3 information on Special:OATH
             not found in git history
* oathauth-step4
         en: Step 4: Verification
        qqq: Label for step 4 information on Special:OATH
             not found in git history
* right-oathauth-disable-for-user
         en: Disable two-factor authentication for a user
        qqq: {{doc-right|oathauth-disable-for-user}}
             not found in git history
* action-oathauth-disable-for-user
         en: disable two-factor authentication for a user
        qqq: {{doc-action|oathauth-disable-for-user}}
             not found in git history
* right-oathauth-verify-user
         en: Verify whether a user has two-factor authentication enabled
        qqq: {{doc-right|oathauth-verify-user}}
             not found in git history
* action-oathauth-verify-user
         en: verify whether a user has two-factor authentication enabled
        qqq: {{doc-action|oathauth-verify-user}}
             not found in git history
* right-oathauth-view-log
         en: Access the log of two-factor authentication changes
        qqq: {{doc-right|oathauth-view-log}}
             not found in git history
* action-oathauth-view-log
         en: access the log of two-factor authentication changes
        qqq: {{doc-action|oathauth-view-log}}
             not found in git history
* right-oathauth-enable
         en: Enable two-factor authentication
        qqq: {{doc-right|oathauth-enable}}
             not found in git history
* action-oathauth-enable
         en: enable two-factor authentication
        qqq: {{doc-action|oathauth-enable}}
             not found in git history
* grant-group-authentication
         en: Perform authentication actions for self and others
        qqq: {{Related|Grant-group}}
             not found in git history
* grant-oath
         en: Access two-factor authentication (OATH) information for self and others
        qqq: Name for grant "oath".
             {{Related|Grant}}
             not found in git history
* right-oathauth-api-all
         en: Query and validate OATH information for self and others
        qqq: {{doc-right|oathauth-api-all}}
             not found in git history
* action-oathauth-api-all
         en: check OATH status
        qqq: {{doc-action|oathauth-api-all}}
             not found in git history
* oath-log-name
         en: Two-factor authentication log
        qqq: The Special:Log log name that appears in the drop-down on the Special:Log page
             not found in git history
* oath-log-header
         en: These events track changes to users' two-factor authentication status.
        qqq: The Special:Log description that appears on the Special:Log page when you filter logs on this specific log name
             not found in git history
* log-action-filter-oath
         en: Type of two-factor authentication operation:
        qqq: {{Doc-log-action-filter-type|oath}}
             {{Related|Log-action-filter}}
             not found in git history
* log-action-filter-oath-verify
         en: Checking if two-factor authentication is enabled
        qqq: {{doc-log-action-filter-action|oath|verify}}
             not found in git history
* log-action-filter-oath-disable-other
         en: Disabling two-factor authentication for another user
        qqq: {{doc-log-action-filter-action|oath|disable-other}}
             not found in git history
* oathmanage
         en: Manage Two-factor authentication
        qqq: {{doc-special|OATHManage}}
             not found in git history
* oathauth-invalid-key-type
         en: Key set on the user does not match the required type for selected auth method
        qqq: Error message when key class is unexpected
  last seen: 6ef3d24
    subject: Database-level support for multiple auth devices
      files: src/Module/TOTP.php
* notification-header-oathauth-disable
         en: Two-factor authentication has been disabled on {{GENDER:$2|your account}}.
        qqq: Notification header for when two-factor authentication has been disabled.
             $2 - Name of user for GENDER
             not found in git history
* notification-header-oathauth-enable
         en: Two-factor authentication has been enabled on {{GENDER:$2|your account}}.
        qqq: Notification header for when two-factor authentication has been enabled.
             $2 - Name of user for GENDER
             not found in git history

Some of these are used by MW itself automatically (e.g. right-oathauth-enable and action-oathauth-enable), but others look potentially actually unused, such as the un-namespaced right labels.

A couple of them look like they could/should be used too..

Reedy renamed this task from Is the 'oathauth-token' message used or orphaned? to Unused and orphaned i18n messages.Jan 11 2024, 2:53 PM
Reedy updated the task description. (Show Details)

A couple of them look like they could/should be used too..

The tool greps for the message key in the codebase. It wouldn't catch constructed keys (e.g. 'oathauth-step' . $n), but such keys should document their generated output in comments.

Change 989925 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@master] Add grepable usages of i18n messages

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

Change 989925 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] Add grepable usages of i18n messages

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

Change 989947 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OATHAuth@master] More greppable messages

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

Between those two patches, that should fix most of them

With my patch:

Warning: 9 unused or undocumented keys found (out of 96):

* right-oathauth-view-log
         en: Access the log of two-factor authentication changes
        qqq: {{doc-right|oathauth-view-log}}
             not found in git history
* action-oathauth-view-log
         en: access the log of two-factor authentication changes
        qqq: {{doc-action|oathauth-view-log}}
             not found in git history
* grant-group-authentication
         en: Perform authentication actions for self and others
        qqq: {{Related|Grant-group}}
             not found in git history
* grant-oath
         en: Access two-factor authentication (OATH) information for self and others
        qqq: Name for grant "oath".
             {{Related|Grant}}
             not found in git history
* oath-log-name
         en: Two-factor authentication log
        qqq: The Special:Log log name that appears in the drop-down on the Special:Log page
             not found in git history
* oath-log-header
         en: These events track changes to users' two-factor authentication status.
        qqq: The Special:Log description that appears on the Special:Log page when you filter logs on this specific log name
             not found in git history
* log-action-filter-oath
         en: Type of two-factor authentication operation:
        qqq: {{Doc-log-action-filter-type|oath}}
             {{Related|Log-action-filter}}
             not found in git history
* log-action-filter-oath-verify
         en: Checking if two-factor authentication is enabled
        qqq: {{doc-log-action-filter-action|oath|verify}}
             not found in git history
* log-action-filter-oath-disable-other
         en: Disabling two-factor authentication for another user
        qqq: {{doc-log-action-filter-action|oath|disable-other}}
             not found in git history

All of these are standard MW structural ones.

Change 989950 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/OATHAuth@master] i18n: Drop three unused messages

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

Change 989947 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] More greppable messages

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

Change 989950 merged by jenkins-bot:

[mediawiki/extensions/OATHAuth@master] i18n: Drop three unused messages

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

Reedy assigned this task to Jdforrester-WMF.