mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance: hooked lambda for rendering admin notices.
Doing a write to the database will have a performance hit. To avoid the hit, removes the new "wp_force_deactivation_incompatible_plugins" option in favor of hooking a callback into `'admin_notice'` and passing the global into the callback via `use()`. Isn't the global unset() within wp-settings.php? Yes. It's done to avoid leaking the handler out of the file (for future BC). Doesn't unsetting the global cause it to be unavailable to the hooked lambda? No. Notice, the global is passed to the lambda (i.e. anonymous function) via `use()`. What does this do? In PHP, the _value_ of the passed variable gets inherited within the anonymous function is it (the anonymous function) is defined, not when it (the anonymous function) is called. See the PHP Manual https://www.php.net/manual/en/functions.anonymous.php#functions.anonymous#example-541 >// Inherited variable's value is from when the function >// is defined, not when called See it in action https://3v4l.org/1BocJ.
- Loading branch information
1 parent
1060707
commit af32b78
Showing
3 changed files
with
20 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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