Page MenuHomePhabricator

Allow defining constants in extension registration
Closed, DeclinedPublic

Description

Especially those relating to content handler:

  • CONTENT_MODEL_XXX
  • CONTENT_FORMAT_XXX

Event Timeline

Legoktm created this task.Aug 7 2015, 5:55 AM
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.
Liuxinyu970226 set Security to None.Oct 2 2015, 1:06 PM
Paladox added a subscriber: Paladox.Aug 9 2016, 5:20 PM
Florian added a subscriber: Florian.Dec 2 2016, 8:32 PM

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 closed this task as Declined.Jan 19 2019, 12:59 AM
Krinkle added a subscriber: Krinkle.
@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 :)

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptJan 19 2019, 12:59 AM