Repository navigation
Replace deprecated InterwikiLoadPrefix hook with InterwikiLookup serv… - #51
Open
alex-mashin wants to merge 1 commit into
Open
alex-mashin wants to merge 1 commit into
alex-mashin wants to merge 1 commit into
Conversation
…ice decorator The InterwikiLoadPrefix hook, through which this extension published $seqlgExternalRepositoryEndpoints as resolvable interwiki prefixes, has been deprecated since MediaWiki 1.36 and emits a deprecation warning on every interwiki resolution under MediaWiki 1.43. With Semantic MediaWiki 7.0 requiring MediaWiki 1.43 or later, the warning fired on every page view, which is unacceptable for current and future MediaWiki versions. The hook mechanism is therefore replaced by a decorator on the InterwikiLookup service (src/InterwikiLookupDecorator.php), installed through the supported MediaWikiServices hook (src/MediaWikiServicesHandler.php, declared in extension.json). The decorator preserves both consumers of interwiki registration: ByHttpRequestQueryLookup endpoint resolution and external-link rendering of mw-foo:Page titles via MediaWikiTitleCodec. Prefix matching stays case-insensitive by routing through the content language, and null/empty prefixes delegate unaltered to the inner lookup to avoid PHP 8.1 deprecations. The deprecated InterwikiLoadPrefix registration is removed from HookRegistry, which now only carries the smwAskParserFunction and smwShowParserFunction hooks. Transport failures and undecodable JSON responses in the ByHttpRequest pipeline are no longer swallowed into silent empty results: they are reported as distinct query errors (seql-http-request-failed / seql-http-response-invalid), and only responses that decode as JSON are written to the HTTP response cache, so failed fetches are retried instead of being frozen for the cache lifetime. The configuration documentation gains a "Names must align" section: the source= value, the $smwgQuerySources key, and the $seqlgExternalRepositoryEndpoints prefix must carry the same name, and a mismatch (or a later wholesale re-assignment of $smwgQuerySources) silently falls back to the local store. Verified on MediaWiki 1.43 with Semantic MediaWiki 7.0: composer test green (117 tests), in-page and Special:Ask queries against an external repository render correctly, and no deprecation warnings are emitted. Authored with assistance from an AI coding assistant (OpenCode / GLM). Fixes: SemanticMediaWiki#42
Contributor
|
You'll want to rebase, MW 1.46 added to ci and minimum php raised to 8.2. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ice decorator
The InterwikiLoadPrefix hook, through which this extension published $seqlgExternalRepositoryEndpoints as resolvable interwiki prefixes, has been deprecated since MediaWiki 1.36 and emits a deprecation warning on every interwiki resolution under MediaWiki 1.43. With Semantic MediaWiki 7.0 requiring MediaWiki 1.43 or later, the warning fired on every page view, which is unacceptable for current and future MediaWiki versions.
The hook mechanism is therefore replaced by a decorator on the InterwikiLookup service (src/InterwikiLookupDecorator.php), installed through the supported MediaWikiServices hook (src/MediaWikiServicesHandler.php, declared in extension.json). The decorator preserves both consumers of interwiki registration: ByHttpRequestQueryLookup endpoint resolution and external-link rendering of mw-foo:Page titles via MediaWikiTitleCodec. Prefix matching stays case-insensitive by routing through the content language, and null/empty prefixes delegate unaltered to the inner lookup to avoid PHP 8.1 deprecations. The deprecated InterwikiLoadPrefix registration is removed from HookRegistry, which now only carries the smwAskParserFunction and smwShowParserFunction hooks.
Transport failures and undecodable JSON responses in the ByHttpRequest pipeline are no longer swallowed into silent empty results: they are reported as distinct query errors (seql-http-request-failed / seql-http-response-invalid), and only responses that decode as JSON are written to the HTTP response cache, so failed fetches are retried instead of being frozen for the cache lifetime.
The configuration documentation gains a "Names must align" section: the source= value, the $smwgQuerySources key, and the
$seqlgExternalRepositoryEndpoints prefix must carry the same name, and a mismatch (or a later wholesale re-assignment of $smwgQuerySources) silently falls back to the local store.
Verified on MediaWiki 1.43 with Semantic MediaWiki 7.0: composer test green (117 tests), in-page and Special:Ask queries against an external repository render correctly, and no deprecation warnings are emitted.
Authored with assistance from an AI coding assistant (OpenCode / GLM).
Fixes: #42