- Timestamp:
- 06/30/2021 12:33:43 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php
r49955 r51278 266 266 * @since 5.5.0 267 267 * 268 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. 269 * 268 270 * @param WP_REST_Request $request Full details about the request. 269 271 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. 270 272 */ 271 273 public function create_item( $request ) { 274 global $wp_filesystem; 275 272 276 require_once ABSPATH . 'wp-admin/includes/file.php'; 273 277 require_once ABSPATH . 'wp-admin/includes/plugin.php'; … … 330 334 331 335 if ( is_null( $result ) ) { 332 global $wp_filesystem;333 336 // Pass through the error from WP_Filesystem if one was raised. 334 if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) { 335 return new WP_Error( 'unable_to_connect_to_filesystem', $wp_filesystem->errors->get_error_message(), array( 'status' => 500 ) ); 336 } 337 338 return new WP_Error( 'unable_to_connect_to_filesystem', __( 'Unable to connect to the filesystem. Please confirm your credentials.' ), array( 'status' => 500 ) ); 337 if ( $wp_filesystem instanceof WP_Filesystem_Base 338 && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() 339 ) { 340 return new WP_Error( 341 'unable_to_connect_to_filesystem', 342 $wp_filesystem->errors->get_error_message(), 343 array( 'status' => 500 ) 344 ); 345 } 346 347 return new WP_Error( 348 'unable_to_connect_to_filesystem', 349 __( 'Unable to connect to the filesystem. Please confirm your credentials.' ), 350 array( 'status' => 500 ) 351 ); 339 352 } 340 353 … … 342 355 343 356 if ( ! $file ) { 344 return new WP_Error( 'unable_to_determine_installed_plugin', __( 'Unable to determine what plugin was installed.' ), array( 'status' => 500 ) ); 357 return new WP_Error( 358 'unable_to_determine_installed_plugin', 359 __( 'Unable to determine what plugin was installed.' ), 360 array( 'status' => 500 ) 361 ); 345 362 } 346 363
Note: See TracChangeset
for help on using the changeset viewer.