Page MenuHomePhabricator

Use ExtensionRegistry instead of class_exists to check for CirrusSearch in Wikibase
Closed, ResolvedPublic

Description

Details

Created as the one remaining part of T183096: Use ExtensionRegistry instead of class_exists to check for enabled extensions.
This is blocked on CirrusSearch using Extension registration in the first place. T87892: Convert CirrusSearch to use extension registration

Wikibase use class_exists checks in tests as well as production code to check if a specific extension is enabled:

if ( !class_exists( 'CirrusSearch' ) ) {

This binds against a fully qualified class name in a super-problematic way that does not fail when the class is renamed or moved to another namespace.
This has already caused many regressions in other (related and unrelated) codebases.

All these conditionals must be replaced with a proper check :

if ( !ExtensionRegistry::getInstance()->isLoaded( 'CirrusSearch' ) ) {

See https://gerrit.wikimedia.org/r/398511 for an example.

ExtensionRegistry can only be used, when the extension to check is using extension.json

Impact & priority

This change could avoid confusion and regression in the future when class names get change or namespaces moved.
The task itself is easy to complete, so lets get it done as soon as possible.

Task & Acceptance Criteria

  • All occurrences of class_exists( 'CirrusSearch' ) (or another CirrusSearch class in Wikibase have been converted to use Extension Registration checks.

Event Timeline

Addshore changed the task status from Open to Stalled.Aug 20 2018, 8:01 AM
Addshore triaged this task as Medium priority.

Stalled as T87892 needs to be done first

Addshore moved this task from incoming to ready to go on the Wikidata board.
dcausse changed the task status from Stalled to Open.Jun 20 2019, 8:25 AM
Addshore lowered the priority of this task from Medium to Low.Jan 22 2021, 10:39 PM
Addshore moved this task from Small Code Fixes to legacy-backlog on the [DEPRECATED] wdwb-tech board.
MPhamWMF subscribed.

Closing out low/est priority tasks over 6 months old with no activity within last 6 months in order to clean out the backlog of tickets we will not be addressing in the near term. Please feel free to reopen if you think a ticket is important, but bare in mind that given current priorities and resourcing, it is unlikely for the Search team to pick up these tasks for the indefinite future. We hope that the requested changes have either been addressed by or made irrelevant by work the team has done or is doing -- e.g. upgrading Elasticsearch to a newer version will solve various ES-related problems -- or will be subsumed by future work in a more generalized way.

thiemowmde changed the task status from Declined to Resolved.Aug 2 2022, 7:58 AM