Page MenuHomePhabricator

Allow defining constants in extension registration
Closed, DeclinedPublic

Description

Especially those relating to content handler:

  • CONTENT_MODEL_XXX
  • CONTENT_FORMAT_XXX

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
ResolvedTpt
DeclinedNone

Event Timeline

Legoktm raised the priority of this task from to Needs Triage.
Legoktm updated the task description. (Show Details)
Legoktm added subscribers: gerritbot, jayvdb, Ricordisamoa and 3 others.

Ok, I think the most consistent thing would be to convert the ContentHandlers section to an object, like it is for namespaces, and allow to set the constant there. However, this would be a breaking change, as far as I can see, and would probably be a feature for manifest_version 2. On the other hand: There aren't so much extensions, which use the ContentHandlers feature at the moment (https://github.com/search?l=JSON&q=%40wikimedia+ContentHandlers&type=Code&utf8=%E2%9C%93), so I think it would be possible to convert them. What do you think @Legoktm?

Change 325120 had a related patch set uploaded (by Florianschmidtwelzow):
WIP: registration: Add possibility to set CONTENT_MODEL_ and CONTENT_FORMAT_ constants

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

Change 325120 abandoned by Florianschmidtwelzow:
WIP: registration: Add possibility to set CONTENT_MODEL_ and CONTENT_FORMAT_ constants

Reason:
Sounds reasonable. Should we decline the phabricator task with a message that the values should be used directly, or class constants should be used? :)

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

Krinkle renamed this task from Allow defining content model and format constants in extension registration to Allow defining constants in extension registration.Jan 19 2019, 12:41 AM
Krinkle updated the task description. (Show Details)
Krinkle subscribed.
@Legoktm wrote:

I'm wary of supporting more global constants...I'd rather have extensions move away from these, maybe use class constants?

class FooBarContentHandler extends ContentHandler {
    const MODEL_NAME = 'FooBar';
}

Or something.

Works for me :)