Skip to content

Require MediaWiki 1.43 and replace APIs removed or deprecated after it - #196

Merged
malberts merged 6 commits into
masterfrom
fix/require-mediawiki-1.43
Nov 12, 2026
Merged

malberts merged 6 commits into
masterfrom
fix/require-mediawiki-1.43

Conversation

@alistair3149

@alistair3149 alistair3149 commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #190

Wikibase Export now requires MediaWiki 1.43 and PHP 8.1, drops code that only older MediaWiki versions needed, and
replaces MediaWiki and Wikibase APIs that 1.44 to 1.47 removed or deprecated. On MediaWiki 1.47 this stops every page
view failing on the removed Title alias, makes the subject search of Special:WikibaseExport work again, and
restores the check that refuses invalid configuration on MediaWiki:WikibaseExport, which stopped running when 1.47
removed the EditFilter hook. Builds on #195: merge it after #195, then retarget it to master.

Human input

Goal and shape: goal set by @alistair3149; Claude chose the changes within it.

  • Directions: "For WikibaseExport, we probably should bump the minimum requirement to 1.43 as well, and do an audit
    to drop deprecated methods and classes", following "the WikibaseExport CI was already broken, not from this PR,
    we should fix it".
  • Choices:
  • Redirections:
    • The README no longer names the releases for older MediaWiki versions: "you can drop the … part in the
      requirements since it will just keep growing for info that is no long relevant".
    • composer.json no longer declares a PHP version: "can be dropped too, MW already enforces it".

Outcome: not reviewed by a human yet. Left for you: a skim of the diff.

Claude's calls

  • Not discussed with @alistair3149:
    • PHP 8.1, MediaWiki 1.43's own minimum, in the README's requirements.
    • Only MediaWiki replacements that exist in 1.43. So Skin, Article and SpecialPageTestBase keep their global
      names: their namespaced classes arrive in 1.44 and 1.46, and their aliases, deprecated, still exist in 1.47.
    • Configuration is validated in EditFilterMergedContent, which sees the whole page after section merging. It
      refuses with one message that includes the error table, under the new key
      wikibase-export-config-invalid-errors: the table needs a parameter that the 21 translations of
      wikibase-export-config-invalid lack. The old key is no longer used and is gone from en.json and qqq.json.
      The edit form shows one error box, as before, and API clients now get the error code
      wikibase-export-config-invalid-errors with the errors in its info, instead of hookaborted.
    • The hook also runs for Special:ChangeContentModel and action=mcrundo, where EditFilter never ran. Core passes
      a context titled with the page and a User there on 1.43 and 1.47, so the handler's types match; no test covers
      these two paths.
    • Search uses WbSearch::getItemSearchHelper() when that method exists, and
      WikibaseRepo::getEntitySearchHelper() otherwise. The check is method_exists(), not class_exists(): Wikibase
      1.44 and 1.45 have a WbSearch class without that method. PHPStan and Psalm, which run against 1.43, get
      baseline entries for it.
    • The config page is looked up through PageLookup before getRevisionByTitle(): 1.43 fails on a plain
      PageReference there, and passing a LinkTarget is deprecated since 1.45. PageStore checks the link cache
      before it queries the page table.
    • Three edge-to-edge API tests no longer skip on PHP 8.1 and later ("Wikibase does not yet work with PHP 8.1"),
      which skipped them on every PHP version MediaWiki 1.43 supports.
    • ConfigPageSmokeTest no longer deletes the config page after each test: 1.47's deletePage() fails for a page
      that does not exist, and MediaWiki resets the tables between tests since 1.42.
  • Considered by Claude, omitted:
  • Not verified: MediaWiki 1.44 to 1.46, where the search branch rests on reading Wikibase's REL1_44 to REL1_46; PHP
    versions other than 8.3.

The change

  • extension.json: requires MediaWiki 1.43; registers EditFilterMergedContent instead of EditFilter.
  • composer.json: no PHP version constraint; MediaWiki enforces its own.
  • README.md: PHP 8.1, MediaWiki and Wikibase 1.43, without pointers to the releases for older MediaWiki versions.
  • i18n/en.json, i18n/qqq.json: wikibase-export-config-invalid-errors replaces wikibase-export-config-invalid.
  • src/: namespaced imports; getDescription() of both special pages returns a Message without the 1.41 version
    check; MediaWikiHooks::onEditFilterMergedContent(); PageContentFetcher takes a PageLookup;
    WikibaseExportExtension picks the item search helper.
  • PHPStan and Psalm baselines: entries for the removed version checks gone, entries for the WbSearch check added.
  • Tests: new ConfigPageEditValidationTest; the PHP 8.1 skip, the teardown deletion and one unneeded setup call
    removed.

#194 changes the SpecialWikibaseExport constructor and merges with this branch except in phpstan-baseline.neon:
keep #194's "If condition is always false" entry and this branch's two WbSearch entries, and drop the "If
condition is always true" ones.

Verification evidence

Run locally on SQLite and PHP 8.3, with Wikibase from the matching REL branch. On 1.47, "strict" adds
convertDeprecationsToExceptions, so deprecation warnings fail tests.

  • Full suite, MediaWiki 1.43: before (Fix CI: update mediawiki-codesniffer and drop MediaWiki 1.39 to 1.42 jobs #195's head), 117 tests OK, 3 skipped; after, 122 tests OK, none skipped.
  • Full suite, MediaWiki 1.47, before: 14 errors, both plain and strict: 10 TypeErrors and 3 follow-on teardown
    errors from the removed Title alias, and SpecialWikibaseExportTest on the constructor (Fix Special:WikibaseExport constructor on MediaWiki 1.46 and later #194).
  • Full suite, MediaWiki 1.47, after: 1 error, both plain and strict, SpecialWikibaseExportTest on the constructor.
    With Fix Special:WikibaseExport constructor on MediaWiki 1.46 and later #194's changes applied on top: 123 tests OK, both plain and strict.
  • On the way, strict 1.47 showed the getRevisionByTitle() deprecation in 7 tests, the deletePage() failure in
    ConfigPageSmokeTest::testEditSmoke, and SearchEntitiesApiTest's two tests failing on
    getEntitySearchHelper(); all pass now.
  • ConfigPageEditValidationTest: before the hook change, testRefusesInvalidConfig and
    testRefusalNamesTheInvalidSetting fail on 1.47 because the edit is saved, and on 1.43 on hookaborted. Against
    the two-message refusal, they fail on 1.47 with "(multiple errors)" and with an error text lacking
    defaultStartYear. With the namespace check removed from isConfigTitle(),
    testSavesOtherPagesWithoutValidatingThem fails.
  • Edit form, invalid defaultStartYear, submitted as Admin over HTTP, on 1.43 and 1.47: the page is not created,
    and one error box shows the intro and the error table.
  • action=edit with the same config, default error format, on 1.43 and 1.47: code
    wikibase-export-config-invalid-errors, info "Your changes were not saved. They contain the following error:
    /defaultStartYear The data (string) must match the type: integer, null".
  • Search over HTTP on 1.43 and 1.47: after creating item Q1 labelled "Acme Corporation" with wbeditentity,
    search-entities?search=Acme&language=en returns it with HTTP 200.
  • MediaWiki 1.47 over HTTP: Main_Page, the config page's edit form, Special:WikibaseExportConfig and the
    search-entities endpoint return 200 or 302 (500 before), with no deprecation warnings in the output;
    Special:WikibaseExport and Special:SpecialPages return 500 on the constructor (Fix Special:WikibaseExport constructor on MediaWiki 1.46 and later #194).
  • PHPCS, PHPStan and Psalm on MediaWiki 1.43: no errors.
  • CI on the last commit (pull_request run 43268945233, push run 43268926938): PHPUnit on MediaWiki 1.43 (122 tests
    OK), static analysis, code style and linting all pass.

AI-authored — Claude Code, Opus 5.5, on a Professional Wiki account

alistair3149 and others added 6 commits November 12, 2026 11:08
Composer now refuses to install package versions with known security
advisories. MediaWiki 1.39 to 1.42 pin dependencies that have one, such as
PHPUnit 9.6.16 and Guzzle, so these jobs fail while installing MediaWiki,
before any test runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Composer refuses to install mediawiki-codesniffer 40 because the
PHP_CodeSniffer version it pins has a security advisory, so the code style
and static analysis CI jobs failed during composer install. Version 52
requires PHP_CodeSniffer 3.13.6, which has the fix.

Apply the new rules with phpcbf: static arrow functions, explicit nullable
types and whitespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raise the minimum MediaWiki and Wikibase version to 1.43, the oldest
version CI still tests. Stop declaring a PHP version in composer.json:
MediaWiki enforces its own minimum. The README's requirements no longer
name the releases for older MediaWiki versions, a list that would keep
growing; the release notes record when support was dropped.

Remove what only older versions needed: the string return of the
special pages' getDescription() for MediaWiki before 1.41, its PHPStan
baseline entries, Psalm baseline entries left over from a MediaWiki 1.39
check, and the skip of three edge-to-edge API tests on PHP 8.1 and
later, which skipped them on every PHP version MediaWiki 1.43 supports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #190

MediaWiki 1.47 removed the global aliases of Title, Html and EditPage,
so on 1.47 every page view failed in the BeforePageDisplay hook. Import
the namespaced classes, which all exist in MediaWiki 1.43, for every
class that has one there: Title, TitleParser, MalformedTitleException,
Content, JsonContent, Html, Message, SpecialPage, EditPage, OutputPage
and IContextSource.

Skin, Article, WikiPage and SpecialPageTestBase keep their global names:
MediaWiki 1.43 has no namespaced version of them, and their aliases
still exist in 1.47.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MediaWiki 1.47 removed the EditFilter hook, so invalid configuration
on MediaWiki:WikibaseExport got saved. Validate it in the
EditFilterMergedContent hook instead, which MediaWiki 1.43 also has. The
hook refuses the edit with one message that includes the error table,
so API clients now get the errors too, instead of "hookaborted". The
message needs a parameter for the table, which the translations of
wikibase-export-config-invalid lack, so it gets a new key,
wikibase-export-config-invalid-errors.

Since MediaWiki 1.45, getRevisionByTitle() emits a deprecation warning
when given a LinkTarget. Look the config page up with PageLookup and
pass the resulting page to it; a PageReference that is not a page
identity fails on MediaWiki 1.43.

Since MediaWiki 1.47, deletePage() in tests fails for a page that does
not exist. Stop deleting the config page after each ConfigPageSmokeTest
test: MediaWiki resets the tables between tests since 1.42.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wikibase 1.47 removed WikibaseRepo::getEntitySearchHelper(), so the
subject search of Special:WikibaseExport failed on MediaWiki 1.47. Use
WbSearch::getItemSearchHelper(), added in Wikibase 1.46, when it exists,
and getEntitySearchHelper() before that. PHPStan and Psalm run against
MediaWiki 1.43, whose Wikibase has no WbSearch, so their errors on that
branch are baselined.

Also drop setup that the no-matches search test does not need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alistair3149
alistair3149 force-pushed the fix/require-mediawiki-1.43 branch from 4226a95 to fb47b44 Compare November 12, 2026 17:23
@alistair3149
alistair3149 marked this pull request as ready for review November 12, 2026 17:27
Base automatically changed from fix/ci-codesniffer-52 to master November 12, 2026 20:03
@malberts
malberts merged commit c4adff8 into master Nov 12, 2026
8 checks passed
@malberts
malberts deleted the fix/require-mediawiki-1.43 branch November 12, 2026 20:08
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.

Use namespaced classes

2 participants