Page MenuHomePhabricator

Replace PageContent(Insert|Save)Complete hooks
Closed, ResolvedPublic

Description

PageContentInsertComplete is called when a page is newly created
PageContentSaveComplete is called when a page revision is saved; if it was newly created both are called

Suggest replacing these with a single hook: PageSaveComplete, and having whether it is new included as a parameter.

This opportunity can also be used to clean up the hook implementations:

  • PageContentInsertComplete passes three parameters by reference for legacy reasons
  • PageContentSaveComplete passes four parameters by reference for legacy reasons
  • Both hooks include two parameters that are no longer used, isWatch and section
  • Both hooks pass a flags parameter, as well as a boolean isMinor that is simply $flags & EDIT_MINOR. The new hook would no longer have a minor parameter, and the flags would be checked.

To see if a page is newly created, use $flags & EDIT_NEW.

Deployed extensions to be updated:

Core hard deprecation: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/608676

Details

ProjectBranchLines +/-Subject
mediawiki/coremaster+18 -8
mediawiki/extensions/ConfirmEditmaster+16 -13
mediawiki/extensions/TheWikipediaLibrarymaster+89 -34
mediawiki/extensions/Gadgetsmaster+74 -17
mediawiki/extensions/FlaggedRevsmaster+43 -39
mediawiki/extensions/Cognatemaster+51 -1
mediawiki/extensions/Echomaster+24 -40
mediawiki/extensions/Jademaster+94 -143
mediawiki/extensions/Translatemaster+146 -9
mediawiki/extensions/UploadWizardmaster+17 -12
mediawiki/extensions/WikimediaEditorTasksmaster+23 -33
mediawiki/extensions/LiquidThreadsmaster+17 -21
mediawiki/extensions/FeaturedFeedsmaster+22 -2
mediawiki/extensions/EventBusmaster+33 -71
mediawiki/extensions/WikimediaEventsmaster+18 -17
mediawiki/extensions/MachineVisionmaster+19 -32
mediawiki/extensions/ProofreadPagemaster+5 -3
mediawiki/extensions/JsonConfigmaster+4 -5
mediawiki/extensions/SpamBlacklistmaster+15 -21
mediawiki/extensions/TitleBlacklistmaster+16 -8
mediawiki/extensions/AbuseFiltermaster+27 -16
mediawiki/extensions/GlobalUserPagemaster+5 -3
mediawiki/extensions/PageTriagemaster+54 -53
mediawiki/coremaster+77 -7
Show related patches Customize query in gerrit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 601099 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Add PageSaveComplete hook to replace PageContent(Insert|Save)Complete

https://gerrit.wikimedia.org/r/601099

DannyS712 moved this task from Next to In progress on the User-DannyS712 board.Jun 1 2020, 1:44 AM

Change 601099 merged by jenkins-bot:
[mediawiki/core@master] Add PageSaveComplete hook to replace PageContent(Insert|Save)Complete

https://gerrit.wikimedia.org/r/601099

Change 604509 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/PageTriage@master] Hooks: Update to use PageMoveComplete and PageSaveComplete

https://gerrit.wikimedia.org/r/604509

Please have a look at this patch. I'm wrapping up the implementation of the EditResult class which would provide the info already given by the last two parameters of this hook. My next task will be modifying hooks in the PageUpdater to pass the EditResult to extensions, so I would have to add a parameter to PageSaveComplete that makes some of this redundant.

I'll be doing this before the end of June. Could we possibly amend the definition of this hook before 1.35 release? I'd remove the $originalRevId and $undidRevId parameters in favour of an EditResult. That would certainly make for a much cleaner hook definition :)

Change 604509 merged by jenkins-bot:
[mediawiki/extensions/PageTriage@master] Hooks: Update to use PageMoveComplete and PageSaveComplete

https://gerrit.wikimedia.org/r/604509

Change 605679 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/GlobalUserPage@master] Replace PageContentInsertComplete with PageSaveComplete

https://gerrit.wikimedia.org/r/605679

Change 605679 merged by jenkins-bot:
[mediawiki/extensions/GlobalUserPage@master] Replace PageContentInsertComplete with PageSaveComplete

https://gerrit.wikimedia.org/r/605679

Change 605724 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Echo@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605724

Change 605725 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/AbuseFilter@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605725

Change 605726 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/JsonConfig@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605726

Change 605727 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/MachineVision@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605727

Change 605728 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/ProofreadPage@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605728

Change 605729 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/SpamBlacklist@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605729

Change 605730 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/TitleBlacklist@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605730

Umm, sure, ignoring my comment and deploying the hook to all extensions en masse seems like a great idea.

It will be very funny for people to read docs referencing this hook. "Introduced in 1.35 with this set of parameters, also changed in 1.35 to add another parameter that makes two other params redundant."

Umm, sure, ignoring my comment and deploying the hook to all extensions en masse seems like a great idea.

It will be very funny for people to read docs referencing this hook. "Introduced in 1.35 with this set of parameters, also changed in 1.35 to add another parameter that makes two other params redundant."

I'm sorry, I didn't see your comment earlier. Given the urgency to try and finish deprecating the Revision class before 1.35 is cut, I'd rather not wait for EditResult, sorry

I'm sorry, I didn't see your comment earlier. Given the urgency to try and finish deprecating the Revision class before 1.35 is cut, I'd rather not wait for EditResult, sorry

Then I am to be sorry for assuming bad intent! :D

I thought I should be able to finish it this week (my mentor promised me a CR today), and changing the hooks shouldn't be too complicated, assuming they are not deployed yet, that's why I suggested it. Nevertheless, if this is an urgent matter and you are afraid it could be stalled by me (which is possible), I can just add a parameter later.

Change 605725 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605725

fdans edited projects, added Analytics-Radar; removed Analytics.Jun 18 2020, 3:48 PM

Change 606976 had a related patch set uploaded (by Ostrzyciel; owner: Ostrzyciel):
[mediawiki/core@master] [WIP] Modify PageSaveComplete hook to use EditResult

https://gerrit.wikimedia.org/r/606976

Change 606980 had a related patch set uploaded (by Ostrzyciel; owner: Ostrzyciel):
[mediawiki/extensions/AbuseFilter@master] Update PageSaveComplete hook to use EditResult

https://gerrit.wikimedia.org/r/606980

Change 606981 had a related patch set uploaded (by Ostrzyciel; owner: Ostrzyciel):
[mediawiki/extensions/PageTriage@master] Update PageSaveComplete hook to use EditResult

https://gerrit.wikimedia.org/r/606981

@Ostrzyciel the work to use EditResult shouldn't be tagged as part of this task

@Ostrzyciel the work to use EditResult shouldn't be tagged as part of this task

Alright, I'll remove it. I thought it's relevant as these patches are about this hook.

@Ostrzyciel the work to use EditResult shouldn't be tagged as part of this task

Alright, I'll remove it. I thought it's relevant as these patches are about this hook.

This is specifically about replacing the old hooks, not improvements to the new hook; thanks

Change 607352 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/ConfirmEdit@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607352

DannyS712 updated the task description. (Show Details)Jun 23 2020, 7:38 PM

Change 605730 merged by jenkins-bot:
[mediawiki/extensions/TitleBlacklist@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605730

Change 605729 merged by jenkins-bot:
[mediawiki/extensions/SpamBlacklist@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605729

Change 605726 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605726

Change 605728 merged by jenkins-bot:
[mediawiki/extensions/ProofreadPage@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605728

DannyS712 updated the task description. (Show Details)Jun 24 2020, 2:25 AM

Change 605727 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/605727

Change 607656 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Translate@master] Remove use of PageContentSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607656

Change 607661 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Jade@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607661

DannyS712 updated the task description. (Show Details)Jun 25 2020, 6:20 AM

Change 607716 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/FlaggedRevs@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607716

Change 607830 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/EventBus@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607830

Change 607831 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/LiquidThreads@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607831

Change 607833 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/UploadWizard@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607833

DannyS712 updated the task description. (Show Details)Jun 25 2020, 4:45 PM

Change 607835 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/WikimediaEvents@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607835

Change 607836 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/WikimediaEditorTasks@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607836

DannyS712 updated the task description. (Show Details)Jun 25 2020, 4:59 PM

Change 607837 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Gadgets@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607837

Change 607835 merged by jenkins-bot:
[mediawiki/extensions/WikimediaEvents@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607835

Change 607840 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Cognate@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607840

DannyS712 updated the task description. (Show Details)Jun 25 2020, 5:29 PM

Change 607842 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/TheWikipediaLibrary@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607842

Change 607844 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/FeaturedFeeds@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607844

DannyS712 updated the task description. (Show Details)Jun 25 2020, 5:50 PM

Change 607830 merged by jenkins-bot:
[mediawiki/extensions/EventBus@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607830

Change 607844 merged by jenkins-bot:
[mediawiki/extensions/FeaturedFeeds@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607844

Change 607831 merged by jenkins-bot:
[mediawiki/extensions/LiquidThreads@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607831

Change 607833 merged by jenkins-bot:
[mediawiki/extensions/UploadWizard@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607833

Change 607836 merged by jenkins-bot:
[mediawiki/extensions/WikimediaEditorTasks@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/607836

DannyS712 updated the task description. (Show Details)Jun 25 2020, 11:07 PM

Change 607656 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Remove use of PageContentSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/607656

Change 607661 merged by jenkins-bot:
[mediawiki/extensions/Jade@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Jade/ /607661

DannyS712 updated the task description. (Show Details)Jun 30 2020, 12:42 AM

Change 605724 merged by jenkins-bot:
[mediawiki/extensions/Echo@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Echo/ /605724

DannyS712 updated the task description. (Show Details)Jun 30 2020, 10:42 AM

Change 607840 merged by jenkins-bot:
[mediawiki/extensions/Cognate@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Cognate/ /607840

Change 607716 merged by jenkins-bot:
[mediawiki/extensions/FlaggedRevs@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/FlaggedRevs/ /607716

Change 607837 merged by jenkins-bot:
[mediawiki/extensions/Gadgets@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Gadgets/ /607837

DannyS712 updated the task description. (Show Details)Jun 30 2020, 4:00 PM

Change 607352 merged by Ppchelko:
[mediawiki/extensions/ConfirmEdit@master] Update hooks to use PageSaveComplete

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ConfirmEdit/ /607352

Change 607842 merged by Ppchelko:
[mediawiki/extensions/TheWikipediaLibrary@master] Update hooks to use PageSaveComplete hook in MW 1.35+

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TheWikipediaLibrary/ /607842

Change 608676 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/core@master] Hard deprecate the TitleMoveComplete and PageContent(Insert|Save)Complete hooks

https://gerrit.wikimedia.org/r/c/mediawiki/core/ /608676

DannyS712 updated the task description. (Show Details)Jul 1 2020, 12:23 AM
DannyS712 updated the task description. (Show Details)

Change 608676 merged by jenkins-bot:
[mediawiki/core@master] Hard deprecate the TitleMoveComplete and PageContent(Insert|Save)Complete hooks

https://gerrit.wikimedia.org/r/c/mediawiki/core/ /608676

DannyS712 closed this task as Resolved.Jul 1 2020, 3:08 AM
DannyS712 removed a project: Patch-For-Review.