Changeset 45234 for trunk/src/wp-admin/includes/class-wp-site-health.php
- Timestamp:
- 04/17/2019 02:34:12 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-site-health.php
r45196 r45234 72 72 if ( 'site-health' === $screen->id && ! isset( $_GET['tab'] ) ) { 73 73 $tests = WP_Site_Health::get_tests(); 74 74 75 // Don't run https test on localhost 75 76 if ( 'localhost' === preg_replace( '|https?://|', '', get_site_url() ) ) { 76 77 unset( $tests['direct']['https_status'] ); 77 78 } 79 78 80 foreach ( $tests['direct'] as $test ) { 79 $test_function = sprintf( 80 'get_test_%s', 81 $test['test'] 82 ); 83 84 if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) { 85 $health_check_js_variables['site_status']['direct'][] = call_user_func( array( $this, $test_function ) ); 86 } else { 81 if ( is_string( $test['test'] ) ) { 82 $test_function = sprintf( 83 'get_test_%s', 84 $test['test'] 85 ); 86 87 if ( method_exists( $this, $test_function ) && is_callable( array( $this, $test_function ) ) ) { 88 $health_check_js_variables['site_status']['direct'][] = call_user_func( array( $this, $test_function ) ); 89 continue; 90 } 91 } 92 93 if ( is_callable( $test['test'] ) ) { 87 94 $health_check_js_variables['site_status']['direct'][] = call_user_func( $test['test'] ); 88 95 } … … 90 97 91 98 foreach ( $tests['async'] as $test ) { 92 $health_check_js_variables['site_status']['async'][] = array( 93 'test' => $test['test'], 94 'completed' => false, 95 ); 99 if ( is_string( $test['test'] ) ) { 100 $health_check_js_variables['site_status']['async'][] = array( 101 'test' => $test['test'], 102 'completed' => false, 103 ); 104 } 96 105 } 97 106 } … … 1799 1808 1800 1809 /** 1801 * Add or modify which site status tests are r an on a site.1810 * Add or modify which site status tests are run on a site. 1802 1811 * 1803 1812 * The site health is determined by a set of tests based on best practices from … … 1808 1817 * Or maybe you want to introduce a new test, is caching enabled/disabled/stale for example. 1809 1818 * 1810 * Test may be added either as direct, or asynchronous ones. Any test that may require some time1819 * Tests may be added either as direct, or asynchronous ones. Any test that may require some time 1811 1820 * to complete should run asynchronously, to avoid extended loading periods within wp-admin. 1812 1821 * … … 1823 1832 * 1824 1833 * @type string $label A friendly label for your test to identify it by. 1825 * @type string $test The ajax action to be called to perform the tests. 1834 * @type mixed $test A callable to perform a direct test, or a string AJAX action to be called 1835 * to perform an async test. 1826 1836 * } 1827 1837 * }
Note: See TracChangeset
for help on using the changeset viewer.