Page MenuHomePhabricator

Properly deprecate UnknownAction hook
Closed, ResolvedPublic

Description

r86041 deprecated the UnknownAction hook with a comment in Action.php.

There is no mention of the deprecation in Wiki.php which is the first place that I think most people would look for the deprecation notice.

Also the hook run code does not issue a deprecation warning, it's not marked deprecated in doc/hooks.txt, sample code still uses it, ...


Extensions still using this hook (as of 2017-01-01): (No WMF-deployed extensions)

  • AccessControl
  • ApprovedRevs
  • AuthorProtect
  • BlueSpiceExtensions/Blog
  • Cargo
  • examples/ContentAction (this one needs addressing)
  • Favorites
  • ImageTagging
  • PageSchemas
  • PdfBook
  • Push
  • SemanticPageMaker
  • WikiArticleFeeds
  • Wikilog

Details

Reference
bz52027
Related Gerrit Patches:
mediawiki/extensions/examples : masterRemoved deprecated 'UnknownAction' hook usage
mediawiki/core : masterFully deprecate 'ContentAction' hook

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:46 AM
bzimport set Reference to bz52027.
bzimport added a subscriber: Unknown Object (MLST).
Zellfaze created this task.Jul 25 2013, 2:03 PM

mails2vichu wrote:

Can you please give me a brief about how to fix this.Im new to this and I would Like to work on this Sir.

Vishnu Nk: If I was you I'd look for other deprecated stuff in the codebase and how it is marked as deprecated.

ankur24september wrote:

Commented accordingly

Attached:

(In reply to Ankur from comment #3)

Created attachment 14349 [details]
Commented accordingly

Are you going to commit it?

Attached:

The comment does not clearly mention *what* is deprecated, "update with" is unclear in the patch summary, there is a typo ("depreceted"), and the patch should go into Gerrit: https://www.mediawiki.org/wiki/Developer_access

Change 122098 had a related patch set uploaded by Rahul mishra:
UnknownAction hook not mentioned as deprecated in Wiki.php

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

Spage added a subscriber: Spage.

It looks like this hook was not properly deprecated. I think the procedure to deprecate a hook is something like:

  • Document UnknownAction as "DEPRECATED" in docs/hooks.txt, explain "To add an action in an extension, create a subclass of Action, and add a new key to $wgActions".
  • In includes/MediaWiki.php, pass 1.19 as the $deprecatedVersion parameter in its invocation of Hooks::run( 'UnknownAction', ... ) and add a comment "// NOTE: deprecated hook. Add to $wgActions instead".
  • Fix the sample code extensions/examples/ContentAction/ContentAction.php to not use this hook (!).
  • document UnknownAction hook is obsolete in Manual:Hooks/UnknownAction
  • Add "Note this hook is obsolete since MediaWiki 1.19 to Category:UnknownAction_extensions page.
  • In Manual:Hooks tables indicate that this hook and others are obsolete since MW1.xx.

This is all straightforward stuff for a professional, but it's not trivial.
(I added this checklist "How to deprecate a hook" section to Deprecation , update that if I got this wrong.)

Spage renamed this task from UnknownAction hook not mentioned as deprecated in Wiki.php to Properly deprecate UnknownAction hook.Mar 17 2015, 4:02 AM
Spage updated the task description. (Show Details)
Spage removed a project: Patch-For-Review.
Spage set Security to None.
TTO updated the task description. (Show Details)Jan 1 2017, 4:48 AM
TTO removed a subscriber: wikibugs-l-list.

Change 330138 had a related patch set uploaded (by Filip):
Fully deprecate 'ContentAction' hook

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

Change 330168 had a related patch set uploaded (by Filip):
Removed deprecated 'UnknownAction' hook usage

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

Filip added subscribers: TTO, Filip.Jan 2 2017, 6:29 PM

@Spage @TTO Completed this list, 2 patches need review, added note to wiki.

Change 330138 merged by jenkins-bot:
Fully deprecate 'ContentAction' hook

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

Filip closed this task as Resolved.Jan 3 2017, 6:51 AM
Filip claimed this task.

And merged, marking as resolved.

Change 330168 merged by jenkins-bot:
Removed deprecated 'UnknownAction' hook usage

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