wordpress-develop/tests/phpunit/tests/hooks
Jonny Harris 4ee594761f Plugins: Store result of call to array_keys, to save repeated calls in WP_Hook class.
In the `WP_Hook` class the function `array_keys` was called every time an array of hook priorities was needed. For sites with lots of filters or actions, this would result in thousands of calls to the `array_keys` function, which uses server resources. Instead of recomputing this array every time it is needed, only compute it when filters are added and removed, then store the result as a class property. Improve unit tests to ensure this behaviour is tested. 

Props spacedmonkey, bor0, flixos90, hellofromTonya, mukesh27.
Fixes #58458.

git-svn-id: https://develop.svn.wordpress.org/trunk@56609 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-18 12:39:18 +00:00
..
addFilter.php Plugins: Store result of call to array_keys, to save repeated calls in WP_Hook class. 2023-09-18 12:39:18 +00:00
applyFilters.php Coding Standards: Remove superfluous blank lines at the end of various classes. 2023-09-08 09:30:38 +00:00
doAction.php Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
doAllHook.php Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
hasFilter.php Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
hasFilters.php Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
iterator.php Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
preinitHooks.php Tests: Update the terminology used for action or filter names in hook tests. 2022-07-31 15:03:46 +00:00
removeAllFilters.php Plugins: Store result of call to array_keys, to save repeated calls in WP_Hook class. 2023-09-18 12:39:18 +00:00
removeFilter.php Plugins: Store result of call to array_keys, to save repeated calls in WP_Hook class. 2023-09-18 12:39:18 +00:00