Skip to content

Register declaratively and remove the root entry-point class#46

Merged
paladox merged 1 commit into
masterfrom
migrate-extension-json-registration
Jun 5, 2026
Merged

Register declaratively and remove the root entry-point class#46
paladox merged 1 commit into
masterfrom
migrate-extension-json-registration

Conversation

@alistair3149

Copy link
Copy Markdown
Member

What

Completes the move of this extension's registration into extension.json, eliminating the legacy procedural entry point. Settings were already declarative (config + config_prefix: seqlg); this change removes the last procedural piece — the root SemanticExternalQueryLookup class and its ExtensionFunctions callback.

Why an extension function is kept (not fully declarative)

The callback set up two class_alias calls — SMWExternalAskQueryLookup (the documented public name used in $smwgQuerySources) and the deprecated SMWExternalQueryLookup. class_alias has no declarative equivalent in extension.json and must run at setup time, so a thin extension function is unavoidable here. It is now a namespaced SEQL\Setup::onExtensionFunction rather than a root-class static method.

Changes

  • Add SEQL\Setup holding the class_alias calls and the HookRegistry registration, reading seqlgExternalRepositoryEndpoints directly from the populated config global.
  • extension.json: point ExtensionFunctions at SEQL\Setup::onExtensionFunction; drop AutoloadClasses (the class now autoloads via AutoloadNamespaces).
  • Drop load_composer_autoloader: there is no composer autoload block and no third-party runtime dependency (require is php + composer/installers only — the mediawiki/http-request runtime dep was already removed), so there is nothing local to load.
  • Drop the SEQL_VERSION constant and SemanticExternalQueryLookup::getVersion(); the test bootstrap now reads the version from extension.json.
  • Delete the root SemanticExternalQueryLookup.php.

No user-facing configuration changes: the seqlg* globals, the SMWExternalAskQueryLookup/SMWExternalQueryLookup aliases, and all hook behavior are preserved.

Verification

Run in the docker-compose-ci stack against MW 1.43 / SMW dev-master:

  • composer analyze clean (parallel-lint + PHPCS + minus-x, no warnings).
  • composer phpunit green (101 tests, 194 assertions).
  • Live checks via eval.php: seqlg* config globals populated; InterwikiLoadPrefix, smwAskParserFunction, smwShowParserFunction registered in the hook container; SEQL\Setup present; root SemanticExternalQueryLookup class gone; both SMWExternal* aliases resolve to SEQL\ByHttpRequestQueryLookup; SEQL_VERSION no longer defined.
  • Live render path: #ask parses with no error/exception markup, and invoking the registered smwAskParserFunction handler through the hook container correctly gates the source= parameter by namespace — confirming the relocated callback wires a working handler end-to-end.

Move the remaining procedural registration out of the root
SemanticExternalQueryLookup class into the namespace. The extension
function is retained (it must run setup-time PHP for the class_alias
calls, which have no declarative equivalent) but relocated to
SEQL\Setup::onExtensionFunction, reading seqlgExternalRepositoryEndpoints
directly from the populated config global.

- Add SEQL\Setup with the class_alias calls (SMWExternalQueryLookup,
  SMWExternalAskQueryLookup) and the HookRegistry registration.
- Point extension.json ExtensionFunctions at SEQL\Setup::onExtensionFunction
  and drop AutoloadClasses; the class now autoloads via AutoloadNamespaces.
- Drop load_composer_autoloader: there is no composer autoload block and
  no third-party runtime dependency, so there is nothing local to load.
- Drop the SEQL_VERSION constant and SemanticExternalQueryLookup::getVersion();
  the test bootstrap now reads the version from extension.json.
- Delete the root SemanticExternalQueryLookup.php.
@alistair3149 alistair3149 marked this pull request as ready for review June 5, 2026 23:18
@alistair3149 alistair3149 requested a review from paladox June 5, 2026 23:18
@paladox paladox merged commit 4c8c7bc into master Jun 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants