Changeset 57312 for trunk/src/wp-includes/rest-api/class-wp-rest-server.php
- Timestamp:
- 01/19/2024 05:37:05 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r57147 r57312 87 87 */ 88 88 protected $embed_cache = array(); 89 90 /** 91 * Stores request objects that are currently being handled. 92 * 93 * @since 6.5.0 94 * @var array 95 */ 96 protected $dispatching_requests = array(); 89 97 90 98 /** … … 984 992 */ 985 993 public function dispatch( $request ) { 994 $this->dispatching_requests[] = $request; 995 986 996 /** 987 997 * Filters the pre-calculated result of a REST API dispatch request. … … 1009 1019 } 1010 1020 1021 array_pop( $this->dispatching_requests ); 1011 1022 return $result; 1012 1023 } … … 1016 1027 1017 1028 if ( is_wp_error( $matched ) ) { 1018 return $this->error_to_response( $matched ); 1029 $response = $this->error_to_response( $matched ); 1030 array_pop( $this->dispatching_requests ); 1031 return $response; 1019 1032 } 1020 1033 … … 1041 1054 } 1042 1055 1043 return $this->respond_to_request( $request, $route, $handler, $error ); 1056 $response = $this->respond_to_request( $request, $route, $handler, $error ); 1057 array_pop( $this->dispatching_requests ); 1058 return $response; 1059 } 1060 1061 /** 1062 * Returns whether the REST server is currently dispatching / responding to a request. 1063 * 1064 * This may be a standalone REST API request, or an internal request dispatched from within a regular page load. 1065 * 1066 * @since 6.5.0 1067 * 1068 * @return bool Whether the REST server is currently handling a request. 1069 */ 1070 public function is_dispatching() { 1071 return (bool) $this->dispatching_requests; 1044 1072 } 1045 1073
Note: See TracChangeset
for help on using the changeset viewer.