Support Semantic MediaWiki 7.0#44
Merged
Merged
Conversation
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.
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.
Summary
Adds support for Semantic MediaWiki 7.0 and modernises the extension. Three commits:
mediawiki/http-request(Onoi\HttpRequest) dependency in favour of MediaWiki core's HTTP client.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 MediaWikiBagOStuff).QueryResult::getLink()was removed from the base class; the override is renamed togetQueryLink(), and theCannedResultArray/QueryResultoverrides now match the native return types the SMW 7.0 base classes declare.SMW\DataItems\*,SMW\DataValues\DataValue,SMW\Query\Query,SMW\Formatters\Infolink), including in the test mocks.HTTP layer
QueryResultFetchernow usesMediaWiki\Http\HttpRequestFactory::create()/execute()/getContent(). The response cache is a MediaWikiBagOStuffkeyed by$seqlgHttpResponseCacheType, and the authenticated-session flow uses a core\CookieJarinstead of a curl cookie file. This removes the externalmediawiki/http-requestdependency and its transitiveonoi/cache.CI / toolchain
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..travis.yml,.scrutinizer.yml,phpmd.xmlandtests/travis/.Verification
composer analyze(lint + PHPCS + minus-x) clean.composer phpunitgreen — 101 tests, 194 assertions — withonoi/*removed fromvendor/.{{#ask: … |source=… }}query against a self-configured external endpoint renders the expectedsmwtableend-to-end (query routing → interwiki resolution → HTTP via coreHttpRequestFactory→ JSON parse → result render), on both a cache miss and a cache hit.Known limitation (pre-existing, not introduced here)
HookRegistryregisters handlers forsmwAskParserFunction/smwShowParserFunctionto restrictsource=queries by namespace. These hook names do not exist anywhere in the Semantic MediaWiki source or its history, so that namespace guard never fires — onmastertoday just as on SMW 7.0. It is left untouched here (out of scope for the version bump) and tracked in #45.