Page MenuHomePhabricator

Have TemplateStyles register an image link for any image referenced via url
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):

If i do something like background-image: url( 'https://upload.wikimedia.org/wikipedia/commons/thumb/...' ); have it register that the image being referenced is being used by the TemplateStyles page

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

Would allow commons admins to know if and where a specific image is being used.

Event Timeline

Change #1222765 had a related patch set uploaded (by Brian Wolff; author: Brian Wolff):

[mediawiki/extensions/TemplateStyles@master] Add ability to mark images used in url() as in use

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

Not sure if it would be better to do some of this in the CssSanitizer interfaces instead of solely in the TemplateStyles extension

AFAIK CSS content model doesn't do this either and I bet I can fish out a task for it if I look hard enough, so it might be a reasonable adjustment in core as well.

However, file links show up in WLH at least when added in CSS comments, so while I can appreciate the task, adding a /* [[File:Example.svg]] */ is enough.

Not sure if it would be better to do some of this in the CssSanitizer interfaces instead of solely in the TemplateStyles extension

I think that would be better. There's a lot of customization in TemplateStyles that needs to be copy-pasted into other similar users of css-sanitizer. The mediawiki-specific "file names" termiology could be replaced with "resource identifiers".

Change #1222765 merged by jenkins-bot:

[mediawiki/extensions/TemplateStyles@master] Add ability to mark images used in url() as in use

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

Change #1270583 had a related patch set uploaded (by Brian Wolff; author: Brian Wolff):

[operations/mediawiki-config@master] Record file usage from TemplateStyles pages

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

Change #1270585 had a related patch set uploaded (by Brian Wolff; author: Brian Wolff):

[mediawiki/extensions/TemplateStyles@master] When capturing file names from url, be sure to decode percent encoding

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

Change #1270585 merged by jenkins-bot:

[mediawiki/extensions/TemplateStyles@master] When capturing file names from url, be sure to decode percent encoding

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

Change #1270583 merged by jenkins-bot:

[operations/mediawiki-config@master] Record file usage from TemplateStyles pages

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

Mentioned in SAL (#wikimedia-operations) [2026-04-15T20:36:59Z] <jforrester@deploy1003> Started scap sync-world: Backport for [[gerrit:1268300|Drop 1.5x logos (T246054)]], [[gerrit:1271839|Enwikinews: disable lingering FlaggedRevs template processing (T423512)]], [[gerrit:1270583|Record file usage from TemplateStyles pages (T413707)]]

Mentioned in SAL (#wikimedia-operations) [2026-04-15T20:38:53Z] <jforrester@deploy1003> jforrester, bawolff, pppery: Backport for [[gerrit:1268300|Drop 1.5x logos (T246054)]], [[gerrit:1271839|Enwikinews: disable lingering FlaggedRevs template processing (T423512)]], [[gerrit:1270583|Record file usage from TemplateStyles pages (T413707)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-04-15T20:46:14Z] <jforrester@deploy1003> Finished scap sync-world: Backport for [[gerrit:1268300|Drop 1.5x logos (T246054)]], [[gerrit:1271839|Enwikinews: disable lingering FlaggedRevs template processing (T423512)]], [[gerrit:1270583|Record file usage from TemplateStyles pages (T413707)]] (duration: 09m 15s)

Bawolff claimed this task.