Repository navigation
Fix Special:WikibaseExport constructor on MediaWiki 1.46 and later - #194
Merged
Merged
Conversation
Special:WikibaseExport passed its read restriction to the SpecialPage constructor. MediaWiki 1.46 deprecates that parameter and 1.47 removes it, so the page emits a deprecation warning on 1.46 and fails with "Unknown named parameter $restriction" on 1.47. The page now declares the right by overriding getRestriction(), and still passes it to the constructor before 1.46, where MediaWiki checks only that value. Users without read stay refused on every supported version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test pinned the wrapper's whole opening tag, so harmless markup changes such as attribute order failed it. The id is what the page's JavaScript looks up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nstructor-args Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Special:WikibaseExport passed its
readrestriction to theSpecialPageconstructor. MediaWiki 1.46 deprecatesthat parameter and 1.47 removes it, so the page emits a deprecation warning on 1.46 and fails with "Unknown named
parameter $restriction" on 1.47. The page now declares the right by overriding
getRestriction(), and still passesit to the constructor before 1.46, where MediaWiki reads the constructor's value instead of calling
getRestriction(). Users withoutreadstay refused before and after 1.46.Human input
Goal and shape: goal set by @alistair3149; shape Claude's.
fix: declare Special:ThumbroTest restriction via getRestriction() StarCitizenTools/mediawiki-extensions-Thumbro#112 applies to us", then "So we only need to
patch PageApprovals, WikibaseExport, SemanticCite, SemanticWatchlist, and KnowledgeGraph".
Outcome: not reviewed by a human yet. Left for you: the 1.46 boundary of the version check, and whether the two
tests cover the restriction you expect.
Claude's calls
getRestriction()override, as in SimpleBatchUpload and SemanticMediaWiki, rather than Thumbro's overrides of
isRestricted(),userCanExecute()anddisplayRestrictionError(): the check is oneifto delete once 1.46 is the minimum.testWrapperIsPresentbecomestestShowsTheExportPageToAUserWhoMayRead, runs as a user with onlyread, andasserts only the wrapper's
id, which the page's JavaScript looks up, instead of its whole opening tag. The newtestRefusesAUserWhoMayNotReadruns as a user withoutread.baseline already does for the 1.41 check in this class.
getRevisionByTitle()deprecation inPageContentFetcher. Until Use namespaced classes #190 is fixed, the extension still fails on 1.47 outside this constructor.SpecialPageon each branch. Fix CI: update mediawiki-codesniffer and drop MediaWiki 1.39 to 1.42 jobs #195 fixes the Code style and Static Analysis jobs and drops the 1.39 to 1.42 jobs.Verification evidence
Run locally on SQLite and PHP 8.3, with Wikibase from the matching REL branch.
SpecialWikibaseExport: both tests error withUnknown named parameter $restriction.testRefusesAUserWhoMayNotReadpasses.testShowsTheExportPageToAUserWhoMayReadgets past the constructor and the permission check, then errors on the
getRevisionByTitle()deprecation; withthat deprecation filtered in a temporary, uncommitted
setUp(), both tests pass. Without thegetRestriction()override,
testRefusesAUserWhoMayNotReadfails.getRestriction()override and the name-only constructor on every version,testRefusesAUserWhoMayNotReadfails ("Failed asserting that exception of type "PermissionsError" is thrown");with this branch, it passes.
Titlealias (Use namespaced classes #190); the 14th is thegetRevisionByTitle()deprecation above.changed lines.
remaining jobs. The other six jobs fail before
any test runs, as on master: Composer refuses to install packages that have security
advisories (
squizlabs/php_codesnifferpinned by mediawiki-codesniffer, and core's dependencies on 1.39 to 1.42).