Skip to content

Support Semantic MediaWiki 7.0#44

Merged
paladox merged 6 commits into
masterfrom
support-smw-7
Jun 5, 2026
Merged

Support Semantic MediaWiki 7.0#44
paladox merged 6 commits into
masterfrom
support-smw-7

Conversation

@alistair3149

@alistair3149 alistair3149 commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

Adds support for Semantic MediaWiki 7.0 and modernises the extension. Three commits:

  1. Support Semantic MediaWiki 7.0 — raises the minimum requirements to MediaWiki 1.43 and Semantic MediaWiki 7.0 (PHP 8.1+) and adapts to the SMW 7.0 API.
  2. Use MediaWiki core HttpRequestFactory — drops the mediawiki/http-request (Onoi\HttpRequest) dependency in favour of MediaWiki core's HTTP client.
  3. Add security policy — adds SECURITY.md.

SMW 7.0 API changes addressed

All verified against the SMW 7.0 source:

  • DataValueFactory::newDataItemValue() / newPropertyObjectValue()newDataValueByItem() / newDataValueByProperty().
  • DIProperty::findPropertyTypeId() / setPropertyTypeId()findPropertyValueType() / setPropertyValueType().
  • CacheFactory::newMediaWikiCompositeCache() was removed; the HTTP response cache is rebuilt (and in commit 2 moved onto a MediaWiki BagOStuff).
  • QueryResult::getLink() was removed from the base class; the override is renamed to getQueryLink(), and the CannedResultArray / QueryResult overrides now match the native return types the SMW 7.0 base classes declare.
  • Deprecated SMW class aliases moved to their canonical namespaced names (SMW\DataItems\*, SMW\DataValues\DataValue, SMW\Query\Query, SMW\Formatters\Infolink), including in the test mocks.

HTTP layer

QueryResultFetcher now uses MediaWiki\Http\HttpRequestFactory::create() / execute() / getContent(). The response cache is a MediaWiki BagOStuff keyed by $seqlgHttpResponseCacheType, and the authenticated-session flow uses a core \CookieJar instead of a curl cookie file. This removes the external mediawiki/http-request dependency and its transitive onoi/cache.

CI / toolchain

  • MariaDB-only matrix with a per-row LTS spread (10.11 / 11.4 / 11.8 / 12.3) across MediaWiki 1.43–1.45, PHP 8.1–8.4.
  • actions/checkout@v6, codecov/codecov-action@v6, informational coverage so it never gates CI.
  • Removed the dead .travis.yml, .scrutinizer.yml, phpmd.xml and tests/travis/.

Verification

  • composer analyze (lint + PHPCS + minus-x) clean.
  • composer phpunit green — 101 tests, 194 assertions — with onoi/* removed from vendor/.
  • Live smoke test inside the container: an {{#ask: … |source=… }} query against a self-configured external endpoint renders the expected smwtable end-to-end (query routing → interwiki resolution → HTTP via core HttpRequestFactory → JSON parse → result render), on both a cache miss and a cache hit.

Known limitation (pre-existing, not introduced here)

HookRegistry registers handlers for smwAskParserFunction / smwShowParserFunction to restrict source= queries by namespace. These hook names do not exist anywhere in the Semantic MediaWiki source or its history, so that namespace guard never fires — on master today just as on SMW 7.0. It is left untouched here (out of scope for the version bump) and tracked in #45.

Raise the minimum requirements to MediaWiki 1.43 and Semantic
MediaWiki 7.0 (PHP 8.1+) and adapt to the SMW 7.0 API changes:

- Replace the removed DataValueFactory::newDataItemValue() /
  newPropertyObjectValue() with newDataValueByItem() /
  newDataValueByProperty().
- Replace the removed DIProperty::findPropertyTypeId() /
  setPropertyTypeId() with findPropertyValueType() /
  setPropertyValueType().
- Rebuild the HTTP response cache without the removed
  CacheFactory::newMediaWikiCompositeCache().
- Rename the QueryResult::getLink() override to getQueryLink() and
  match the native return types the SMW 7.0 ResultArray and
  QueryResult base classes now declare.
- Move the deprecated SMW class aliases to their canonical namespaced
  names (SMW\DataItems\*, SMW\DataValues\DataValue, SMW\Query\Query,
  SMW\Formatters\Infolink).

Also modernise CI (a per-row MariaDB LTS matrix on MediaWiki
1.43-1.45, current action majors, informational coverage) and remove
the dead Travis and Scrutinizer configuration.
Replace the mediawiki/http-request (Onoi\HttpRequest) dependency with
MediaWiki core's HttpRequestFactory, dropping the external library and
its onoi/cache transitive dependency.

- Issue the ask and login requests through HttpRequestFactory::create()
  and read the body via getContent(), gating on execute()->isOK().
- Reimplement the HTTP response cache on a MediaWiki BagOStuff
  (ObjectCacheFactory keyed by $seqlgHttpResponseCacheType) instead of
  the Onoi composite cache.
- Carry the authenticated session across requests with a core CookieJar
  instead of a curl cookie file.
Document how to privately report security vulnerabilities via GitHub's
private vulnerability reporting, the disclosure process, and where to
report issues that belong to MediaWiki or Semantic MediaWiki instead.
The global `Title` alias is not reliably autoloadable on its own under
MediaWiki 1.43+ (it only exists once MediaWiki\Title\Title has been
loaded). Depending on the PHPUnit execution order this surfaced as
`Class "Title" not found` errors in the unit tests on PHP 8.2/8.3/8.4
in CI, while passing on PHP 8.1.

Reference the canonical MediaWiki\Title\Title directly so the class is
always autoloaded regardless of order.
Both integration tests carried `@covers I18nJsonFileIntegrity`, which is
not a valid class or method reference. PHPUnit's strict coverage
validation reports it as an invalid annotation, and the resulting
warnings (one per data-provider row) fail CI on PHP 8.2+.

Point the faux-response test at the class it actually exercises
(`\SEQL\ByHttpRequest\JsonResponseParser`) and mark the i18n file
integrity test, which covers no source class, as `@coversNothing`.
Version 43.0.0 bundles PHP_CodeSniffer / PHPCSUtils releases that emit
an "implicitly nullable parameter" deprecation under PHP 8.4, which
fails the 8.4 CI job during the phpcs step. Bump to 48.0.0 (the version
Semantic MediaWiki core uses), pulling PHP_CodeSniffer 3.13 and
PHPCSUtils 1.1, which are PHP 8.4 clean.

Also declare the ValidGlobalName allowedPrefixes property in .phpcs.xml
with <element> nodes, replacing the comma-separated string form that is
deprecated in PHP_CodeSniffer 3.3.
@alistair3149 alistair3149 marked this pull request as ready for review June 5, 2026 22:38
@alistair3149 alistair3149 requested a review from paladox June 5, 2026 22:38
@paladox paladox merged commit 816c247 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