Opened 17 years ago
Closed 16 years ago
#12913 closed enhancement (duplicate)
Notification mechanism for deprecated actions
| Reported by: | strider72 | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Plugins | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Attaching a patch that implements a system for notifying when code uses an action that has been deprecated. The action 'retreive_password' has been marked as deprecated.
Doesn't apply to filters yet.
Attachments (1)
Change History (8)
#1
@
17 years ago
- Keywords has-patch added
- Milestone Unassigned → 3.1
- Type defect (bug) → enhancement
#2
@
17 years ago
- Summary Notification mechanism for deprecated filters/actions → Notification mechanism for deprecated actions
#3
@
17 years ago
- Component General → Plugins
- Milestone 3.1 → Future Release
- Owner set to
- Status new → reviewing
#5
@
17 years ago
Okay... here's a thought: Is there a definitive "last" hook in WordPress? Right after that fires we could fire off a function that looks at did_action and compares it to an array of deprecated hooks, and fires _deprecated_filter as needed.
I was first trying to figure how to hook it after the do_action is called, but of course the problem there is that do_action fires even if there are no hooks attached to it.
Would it slow down do_action/apply_filter too much if we simply added an in_array to compare $tag to an array of deprecated hooks?
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
I've been wanting to do this for a while.
I don't think it is a good idea to add this directly to do_action and apply_filters calls, as we need these to perform as fast as possible. Additionally, the patch as attached would break any action that has multiple args attached to it.
Instead, I would suggest we issue a call
_deprecated_hook( name of hook, version, replacement, message )just after the hook is executed, and use did_action() in _deprecated_hook() to see whether we should actually trigger a deprecated_hook_used action and issue the E_NOTICE (if WP_DEBUG).Might not be a bad idea to use _deprecated_action() and _deprecated_filter(), have one wrap the other, and simply use slightly different messages, just to be clear in both the source code and in the E_NOTICE that is produced.