Skip to content

Replace deprecated InterwikiLoadPrefix hook with InterwikiLookup serv… - #51

Open
alex-mashin wants to merge 1 commit into
SemanticMediaWiki:masterfrom
alex-mashin:master
Open

alex-mashin wants to merge 1 commit into
SemanticMediaWiki:masterfrom
alex-mashin:master

Conversation

@alex-mashin

Copy link
Copy Markdown

…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

…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
@paladox

paladox commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

You'll want to rebase, MW 1.46 added to ci and minimum php raised to 8.2.

@paladox
paladox requested a review from alistair3149 November 16, 2026 14:17
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.

InterwikiLoadPrefix hook was deprecated in MediaWiki 1.36

2 participants