File tree Expand file tree Collapse file tree 2 files changed +18
-15
lines changed
includes/site-health/audit-autoloaded-options
tests/includes/site-health/audit-autoloaded-options Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,7 @@ function perflab_aao_autoloaded_options_test() {
102102function perflab_aao_autoloaded_options_size () {
103103 global $ wpdb ;
104104
105- if ( function_exists ( 'wp_autoload_values_to_autoload ' ) ) {
106- $ autoload_values = wp_autoload_values_to_autoload ();
107- } else {
108- $ autoload_values = array ( 'yes ' );
109- }
105+ $ autoload_values = perflab_aao_get_autoload_values_to_autoload ();
110106
111107 return (int ) $ wpdb ->get_var (
112108 $ wpdb ->prepare (
@@ -145,11 +141,7 @@ function perflab_aao_query_autoloaded_options() {
145141 */
146142 $ option_threshold = apply_filters ( 'perflab_aao_autoloaded_options_table_threshold ' , 100 );
147143
148- if ( function_exists ( 'wp_autoload_values_to_autoload ' ) ) {
149- $ autoload_values = wp_autoload_values_to_autoload ();
150- } else {
151- $ autoload_values = array ( 'yes ' );
152- }
144+ $ autoload_values = perflab_aao_get_autoload_values_to_autoload ();
153145
154146 return $ wpdb ->get_results (
155147 $ wpdb ->prepare (
@@ -256,3 +248,18 @@ function perflab_aao_get_disabled_autoloaded_options_table() {
256248
257249 return $ html_table ;
258250}
251+
252+ /**
253+ * Gets the autoload values in the database that should trigger their option to be autoloaded.
254+ *
255+ * @since n.e.x.t
256+ *
257+ * @return array List of autoload values.
258+ */
259+ function perflab_aao_get_autoload_values_to_autoload () {
260+ if ( function_exists ( 'wp_autoload_values_to_autoload ' ) ) {
261+ return wp_autoload_values_to_autoload ();
262+ }
263+
264+ return array ( 'yes ' );
265+ }
Original file line number Diff line number Diff line change @@ -60,11 +60,7 @@ public function test_perflab_aao_autoloaded_options_test_warning() {
6060 public function test_perflab_aao_autoloaded_options_size () {
6161 global $ wpdb ;
6262
63- if ( function_exists ( 'wp_autoload_values_to_autoload ' ) ) {
64- $ autoload_values = wp_autoload_values_to_autoload ();
65- } else {
66- $ autoload_values = array ( 'yes ' );
67- }
63+ $ autoload_values = perflab_aao_get_autoload_values_to_autoload ();
6864
6965 $ autoloaded_options_size = $ wpdb ->get_var (
7066 $ wpdb ->prepare (
You can’t perform that action at this time.
0 commit comments