SLOP-397: port dead PageContentSaveComplete/TitleMoveComplete hooks to PageSaveComplete/PageMoveComplete - #14
Open
tosfos wants to merge 1 commit into
Open
SLOP-397: port dead PageContentSaveComplete/TitleMoveComplete hooks to PageSaveComplete/PageMoveComplete#14tosfos wants to merge 1 commit into
tosfos wants to merge 1 commit into
Conversation
…o PageSaveComplete/PageMoveComplete PageContentSaveComplete and TitleMoveComplete were replaced in MW 1.35 by PageSaveComplete/PageMoveComplete and never fire on modern branches, so watch-state tracking silently stopped on every edit/move. Register the modern hook names and port the handlers: - onPageSaveComplete: same WikiPage-typed signature; original body kept. - onPageMoveComplete: new signature (LinkTarget $old, LinkTarget $new, UserIdentity $user, $pageid, $redirid, $reason); replaces removed Article::newFromID() with WikiPage::newFromID() and derives Titles from the passed LinkTargets. Fixes SLOP-397 (also covers the hook half of SLOP-379).
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Fixes SLOP-397 (hook half of SLOP-379).
Problem
extension.jsonregistersPageContentSaveCompleteandTitleMoveComplete. Both hooks were replaced in MediaWiki 1.35 byPageSaveComplete/PageMoveComplete; on any modern branch the old names never fire. Result:WatchStateRecorder::recordPageChange()silently never runs, so watch-state statistics drift stale after every edit and page move.A naive rename would still fatal:
onTitleMoveComplete()calls the removedArticle::newFromID().Fix
PageSaveComplete/PageMoveCompleteinstead of the dead names.onPageSaveComplete( WikiPage $wikipage ): identical first-parameter contract to whatPageSaveCompletepasses; original body kept unchanged.onPageMoveComplete( LinkTarget $old, LinkTarget $new, UserIdentity $user, $pageid, $redirid, $reason = null ): new hook signature; derivesTitles from the passedLinkTargets and replacesArticle::newFromID( $id )withWikiPage::newFromID( $id, WikiPage::READ_LATEST )(null-guarded).Verification
php -lclean on PHP 7.4-cli and PHP 8.2-cli (dockerized).jq . extension.json— valid JSON after re-registration.onPageMoveCompleteparameter order matches how MW 1.35+ invokes the hook (old,new,user,pageid,redirid,reason) with no by-reference params and$reasonoptional;onPageSaveCompleteaccepts a typedWikiPage;Article::newFromID()call remains.Risk
Low. Handlers only touch the same tables as before (
watch_tracking_*,watchlist). Behavior on pre-1.35 branches changes (new hooks don't exist there), consistent with the rest of this audit's 1.39-targeted fixes.