Page MenuHomePhabricator

Improve support for constants in extension registration
Closed, DeclinedPublic

Description

Currently we only support namespace constants in the ExtensionProcessor. In looking at more extensions to convert, there are a few more types of constants that extensions use:

  • FOOBAR_VERSION - typically used to check whether an extension is installed
  • CONTENT_MODEL_XXX / CONTENT_FORMAT_XXX
  • Things to help making LocalSettings more readable, like MW_MATH_XXX

Event Timeline

Legoktm created this task.Feb 2 2015, 9:24 PM
Legoktm raised the priority of this task from to High.
Legoktm updated the task description. (Show Details)
Legoktm added a subscriber: Legoktm.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 2 2015, 9:24 PM
Se4598 added a subscriber: Se4598.Feb 19 2015, 5:47 PM

Change 226436 had a related patch set uploaded (by Physikerwelt):
Convert the math integer constants to string constants

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

Change 226436 abandoned by Physikerwelt:
Convert the math integer constants to string constants

Reason:
Reviwing 3 times seems to be too much work
merged everything to
I6d1094ece79e912d9ddbef6681a25196c7a6e801

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

Legoktm closed this task as Declined.Aug 7 2015, 6:01 AM
Legoktm claimed this task.

Support for arbitrary defines is not being added at this time.

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptAug 7 2015, 6:01 AM

@Legoktm maybe to help with the migration we could add some type of support for it including define but marking it as deprecated and recommended they update to a format that should be used as you described.

Introducing features/functionality and immediately marking them as deprecated should be used in very very rare cases, only. In this case, I absolutely don't see the reason to do that, as the "old" way of initializing extensions is still working and supported (however, extension registration should be used, if possible). So, extensions, that can't migrate for a special reason or incompatibility, should open a task (like T108285: Allow defining constants in extension registration) so other ways and solutions can be found and implemented as needed. This makes sure, that we implement functions that cover a specific use case and/or MediaWiki feature and make extension registration more and more useable, but keep it easy to use, maintain and understand.