Changeset 44984 for branches/5.1/src/wp-admin/includes/ajax-actions.php
- Timestamp:
- 03/23/2019 03:17:14 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.1/src/wp-admin/includes/ajax-actions.php
r44843 r44984 4836 4836 wp_send_json_success( $response ); 4837 4837 } 4838 4839 /** 4840 * Ajax handler for site health checks on server communication. 4841 * 4842 * @since 5.2.0 4843 */ 4844 function wp_ajax_health_check_dotorg_communication() { 4845 check_ajax_referer( 'health-check-site-status' ); 4846 4847 if ( ! current_user_can( 'install_plugins' ) ) { 4848 wp_send_json_error(); 4849 } 4850 4851 if ( ! class_exists( 'WP_Site_Health' ) ) { 4852 require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' ); 4853 } 4854 4855 $site_health = new WP_Site_Health(); 4856 wp_send_json_success( $site_health->get_test_dotorg_communication() ); 4857 } 4858 4859 /** 4860 * Ajax handler for site health checks on debug mode. 4861 * 4862 * @since 5.2.0 4863 */ 4864 function wp_ajax_health_check_is_in_debug_mode() { 4865 wp_verify_nonce( 'health-check-site-status' ); 4866 4867 if ( ! current_user_can( 'install_plugins' ) ) { 4868 wp_send_json_error(); 4869 } 4870 4871 if ( ! class_exists( 'WP_Site_Health' ) ) { 4872 require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' ); 4873 } 4874 4875 $site_health = new WP_Site_Health(); 4876 wp_send_json_success( $site_health->get_test_is_in_debug_mode() ); 4877 } 4878 4879 /** 4880 * Ajax handler for site health checks on background updates. 4881 * 4882 * @since 5.2.0 4883 */ 4884 function wp_ajax_health_check_background_updates() { 4885 check_ajax_referer( 'health-check-site-status' ); 4886 4887 if ( ! current_user_can( 'install_plugins' ) ) { 4888 wp_send_json_error(); 4889 } 4890 4891 if ( ! class_exists( 'WP_Site_Health' ) ) { 4892 require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' ); 4893 } 4894 4895 $site_health = new WP_Site_Health(); 4896 wp_send_json_success( $site_health->get_test_background_updates() ); 4897 } 4898 4899 4900 /** 4901 * Ajax handler for site health checks on loopback requests. 4902 * 4903 * @since 5.2.0 4904 */ 4905 function wp_ajax_health_check_loopback_requests() { 4906 check_ajax_referer( 'health-check-site-status' ); 4907 4908 if ( ! current_user_can( 'install_plugins' ) ) { 4909 wp_send_json_error(); 4910 } 4911 4912 if ( ! class_exists( 'WP_Site_Health' ) ) { 4913 require_once( ABSPATH . 'wp-admin/includes/class-wp-site-health.php' ); 4914 } 4915 4916 $site_health = new WP_Site_Health(); 4917 wp_send_json_success( $site_health->get_test_loopback_requests() ); 4918 } 4919 4920 /** 4921 * Ajax handler for site health check to update the result status. 4922 * 4923 * @since 5.2.0 4924 */ 4925 function wp_ajax_health_check_site_status_result() { 4926 check_ajax_referer( 'health-check-site-status-result' ); 4927 4928 if ( ! current_user_can( 'install_plugins' ) ) { 4929 wp_send_json_error(); 4930 } 4931 4932 set_transient( 'health-check-site-status-result', wp_json_encode( $_POST['counts'] ) ); 4933 4934 wp_send_json_success(); 4935 }
Note: See TracChangeset
for help on using the changeset viewer.