Page MenuHomePhabricator

Add configuration flag to enable/disable Phonos rendering
Closed, ResolvedPublic2 Estimated Story Points

Description

As mentioned by @MusikAnimal on Slack:

what might be nice is to have a flag that controls rendering of new audio. Sure, that's the entire point of Phonos, but it could act like a kill switch in the event of widespread misuse. So if audio rendering is disabled, it simply shows the output without a link (unless the file already exists). That way, we don't have a situation where Phonos is in use on a lot of pages, and we want to roll it all back.
If we don't have this "kill switch", we'd have to disable the entire extension, which would make the raw <phonos> syntax visible everywhere it is in-use.

Acceptance criteria

  • A configuration variable, $wgPhonosAudioGenerationEnabled, is set to true by default
  • When $wgPhonosAudioGenerationEnabled is set to false, no new Phonos renders occur (i.e., no API requests/new files saved)
    • Where a persisted file already exists, clicking the Phonos button will play the file
    • Where a persisted file does not already exist, the Phonos button will display an error state (phonos-render-disabled)

Event Timeline

Change 869284 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/extensions/Phonos@master] [WIP] PhonosRenderEnabled: Add config variable to enable/disable renders

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

FWIW in Score this is named $wgScoreDisableExec, it continues showing old scores, but stops rendering new ones.

Change 869284 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] PhonosIPARenderingEnabled: Add config variable to enable/disable renders

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

Change 875319 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/extensions/Phonos@master] Rename `PhonosIPARenderingEnabled` to `PhonosAudioGenerationEnabled`

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

Change 875319 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Rename `PhonosIPARenderingEnabled` to `PhonosAudioGenerationEnabled`

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

@TheresNoTime looks like it is working as expected but do you think we should even out the error box space since it has extra at the end of it?

T325571_Phonos_Error Box Space.png (733Γ—2 px, 466 KB)

@TheresNoTime

When $wgPhonosAudioGenerationEnabled is set to false, no new Phonos renders occur (i.e., no API requests/new files saved)

  • Where a persisted file already exists, clicking the Phonos button will play the file
  • Where a persisted file does not already exist, the Phonos button will display an error state (phonos-render-disabled)

The functions above are working as designed as seen in the screenshots below. I did come across an issue with the spacing of the error being off in each of the skins (Vector 2022, Vector 2010, MinervaNeue, Timeless & Monobook). I created T326267 for the error spacing issues since this is a different problem. As for this ticket, I will move this to Production Sign-Off. Thanks!

Where a persisted file already exists, clicking the Phonos button will play the file

T325571_Phonos_Error Box Space_Vector2010.png (733Γ—2 px, 466 KB)

Where a persisted file does not already exist, the Phonos button will display an error state (phonos-render-disabled)
{F35990055}