Skip to content

Replace deprecated InterwikiLoadPrefix hook with InterwikiLookup serv… - #51

Merged
alistair3149 merged 1 commit into
SemanticMediaWiki:masterfrom
alex-mashin:master
Nov 20, 2026
Merged

alistair3149 merged 1 commit into
SemanticMediaWiki:masterfrom
alex-mashin:master

Conversation

@alex-mashin

Copy link
Copy Markdown
Contributor

…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

@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.

@alex-mashin

Copy link
Copy Markdown
Contributor Author

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

I had bumped mediawiki/mediawiki-codesniffer too high, pushed it back to the safe version supporting PHP 8.1.

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Comment thread AGENTS.md Resolved
Comment thread RELEASE-NOTES.md Resolved

@alistair3149 alistair3149 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have listed the blocking issues for merging this PR, overall it looks good

…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) that identify the repository by the label of
the configured query source, never by its endpoint URL, so rendered error
text does not leak infrastructure details into page output. 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.

The extension version is bumped to 2.0.1. The development toolchain is
pinned to mediawiki/mediawiki-codesniffer 48.0.2, the last release
supporting PHP 8.1, matching the PHP floor declared in composer.json.

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
@alistair3149
alistair3149 merged commit a5139bf into SemanticMediaWiki:master Nov 20, 2026
6 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.

InterwikiLoadPrefix hook was deprecated in MediaWiki 1.36

3 participants