Page MenuHomePhabricator

Allow features to be registered with unnamed requirements
Open, MediumPublic


Quoting @polishdeveloper:

[The] existing solution is pretty verbose, creating single Feature requires us to define name, config variable, group.

The most basic (and likely most common) usecase for the developer will be to create a feature that has one or more requirements that are specific to that feature. Vector's Feature Manager currently requires that requirements be created separately to features, e.g.

$featureManager->registerSimpleRequirement( 'foo_enabled', $config->get( 'wgFooEnabled' ) );
$featureManager->registerRequirement( new LatestSkinVersionRequirement() );
$featureManager->registerFeature( 'FooFeature', [
] );

It should be possible to write the above using on function call:

$featureManager->registerFeature(  'FooFeature', [
  $config->get( 'wgFooEnabled' ),
  new LatestSkinVersionRequirement(),
] );

Event Timeline

ovasileva triaged this task as Medium priority.May 4 2020, 11:25 AM
ovasileva added a project: Readers-Web-Backlog.
ovasileva moved this task from Incoming to Triaged but Future on the Readers-Web-Backlog board.

Change 626359 had a related patch set uploaded (by Phuedx; owner: Phuedx):
[mediawiki/skins/Vector@master] featureManager: Register requirements implicitly

Change 649402 had a related patch set uploaded (by Jdlrobson; owner: DannyS712):
[mediawiki/core@master] Add Skin::supportsFeature

Change 649402 abandoned by Jdlrobson:
[mediawiki/core@master] Add Skin::supportsFeature

Let's discuss further on ticket. Can't review unless we agree on the approach first

Change 626359 abandoned by Phuedx:

[mediawiki/skins/Vector@master] featureManager: Register requirements implicitly


This isn't The Fix™. When I get a little down time (next Monday is the most likely), then I'll create a task detail The Fix™.