From 64dae1c22ccb5e573b82e840384ce8ec2ac9904f Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 13 Dec 2024 10:19:34 +0530 Subject: [PATCH 1/5] Move wpcom/v2/publicize/connections endpoint to publicize package --- ...pcom-v2-publicize-connections-to-publicize | 4 + .../publicize/src/class-connection-fields.php | 170 ++++++++++ .../publicize/src/class-publicize-assets.php | 3 + .../publicize/src/class-publicize-base.php | 2 +- .../rest-endpoints/class-base-controller.php | 88 +++++ .../class-connections-controller.php | 303 ++++++++++++++++++ .../wpcom-endpoints/publicize-connections.php | 23 +- ...pcom-v2-publicize-connections-to-publicize | 4 + 8 files changed, 574 insertions(+), 23 deletions(-) create mode 100644 projects/packages/publicize/changelog/update-move-wpcom-v2-publicize-connections-to-publicize create mode 100644 projects/packages/publicize/src/class-connection-fields.php create mode 100644 projects/packages/publicize/src/rest-endpoints/class-base-controller.php create mode 100644 projects/packages/publicize/src/rest-endpoints/class-connections-controller.php create mode 100644 projects/plugins/jetpack/changelog/update-move-wpcom-v2-publicize-connections-to-publicize diff --git a/projects/packages/publicize/changelog/update-move-wpcom-v2-publicize-connections-to-publicize b/projects/packages/publicize/changelog/update-move-wpcom-v2-publicize-connections-to-publicize new file mode 100644 index 0000000000000..9d87109f63b2c --- /dev/null +++ b/projects/packages/publicize/changelog/update-move-wpcom-v2-publicize-connections-to-publicize @@ -0,0 +1,4 @@ +Significance: patch +Type: changed + +Moved wpcom/v2/publicize/connections endpoint to publicize package diff --git a/projects/packages/publicize/src/class-connection-fields.php b/projects/packages/publicize/src/class-connection-fields.php new file mode 100644 index 0000000000000..95e7a2a1fc3a7 --- /dev/null +++ b/projects/packages/publicize/src/class-connection-fields.php @@ -0,0 +1,170 @@ +get_connection_meta( $connection ); + } + + /** + * Get the ID of a connection. + * + * @param array $connection The connection. + * @return string + */ + public static function get_connection_id( $connection ) { + return (string) self::publicize()->get_connection_id( $connection ); + } + + /** + * Returns a display name for the Connection + * + * @param string $service_name 'facebook', 'twitter', etc. + * @param object|array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return string + */ + public static function get_display_name( $service_name, $connection ) { + return self::publicize()->get_display_name( $service_name, $connection ); + } + + /** + * Returns the external handle for the Connection. + * + * @param string $service_name 'facebook', 'linkedin', etc. + * @param object|array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return string + */ + public static function get_external_handle( $service_name, $connection ) { + $cmeta = self::get_connection_meta( $connection ); + + switch ( $service_name ) { + case 'mastodon': + return $cmeta['external_display'] ?? ''; + + case 'bluesky': + case 'threads': + return $cmeta['external_name'] ?? ''; + + case 'instagram-business': + return $cmeta['connection_data']['meta']['username'] ?? ''; + + default: + return ''; + } + } + + /** + * Returns the external ID for the Connection. + * + * @param object|array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return string + */ + public static function get_external_id( $connection ) { + $connection_meta = self::get_connection_meta( $connection ); + + return $connection_meta['external_id'] ?? ''; + } + + /** + * Returns an external URL to the Connection's profile + * + * @param string $service_name 'facebook', 'twitter', etc. + * @param object|array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return false|string False on failure. URL on success. + */ + public static function get_profile_link( $service_name, $connection ) { + return self::publicize()->get_profile_link( $service_name, $connection ); + } + + /** + * Returns a profile picture for the Connection + * + * @param object|array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return string + */ + public static function get_profile_picture( $connection ) { + return self::publicize()->get_profile_picture( $connection ); + } + + /** + * Returns a display name for the Service + * + * @param string $service_name 'facebook', 'twitter', etc. + * @return string + */ + public static function get_service_label( $service_name ) { + return self::publicize()->get_service_label( $service_name ); + } + + /** + * Returns whether the Connection is shared + * + * @param array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return bool + */ + public static function is_shared( $connection ) { + return empty( self::get_user_id( $connection ) ); + } + + /** + * Returns the status for the Connection + * + * @param array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return string + */ + public static function get_status( $connection ) { + return $connection['status'] ?? 'ok'; + } + + /** + * Returns the user ID for the Connection + * + * @param array $connection The Connection object (WordPress.com) or array (Jetpack). + * @return int + */ + public static function get_user_id( $connection ) { + $connection_meta = self::get_connection_meta( $connection ); + + $connection_data = $connection_meta['connection_data']; + + return (int) $connection_data['user_id']; + } +} diff --git a/projects/packages/publicize/src/class-publicize-assets.php b/projects/packages/publicize/src/class-publicize-assets.php index e74fe44dcf5bc..f3e718ae6b9f3 100644 --- a/projects/packages/publicize/src/class-publicize-assets.php +++ b/projects/packages/publicize/src/class-publicize-assets.php @@ -7,6 +7,8 @@ namespace Automattic\Jetpack\Publicize; +use Automattic\Jetpack\Publicize\Rest_Endpoints\Connections_Controller; + /** * Publicize_Assets class. */ @@ -17,5 +19,6 @@ class Publicize_Assets { */ public static function configure() { Publicize_Script_Data::configure(); + new Connections_Controller(); } } diff --git a/projects/packages/publicize/src/class-publicize-base.php b/projects/packages/publicize/src/class-publicize-base.php index b88bd1a6b12ca..726ea9e9c1cd2 100644 --- a/projects/packages/publicize/src/class-publicize-base.php +++ b/projects/packages/publicize/src/class-publicize-base.php @@ -608,7 +608,7 @@ public function get_username( $service_name, $connection ) { * @param object|array $connection The Connection object (WordPress.com) or array (Jetpack). * @return string */ - private function get_profile_picture( $connection ) { + public function get_profile_picture( $connection ) { $cmeta = $this->get_connection_meta( $connection ); if ( isset( $cmeta['profile_picture'] ) ) { diff --git a/projects/packages/publicize/src/rest-endpoints/class-base-controller.php b/projects/packages/publicize/src/rest-endpoints/class-base-controller.php new file mode 100644 index 0000000000000..1b1318dc63919 --- /dev/null +++ b/projects/packages/publicize/src/rest-endpoints/class-base-controller.php @@ -0,0 +1,88 @@ +wpcom_is_wpcom_only_endpoint = true; + } + + /** + * Check if we are on WPCOM. + * + * @return bool + */ + public static function is_wpcom() { + return ( new Host() )->is_wpcom_simple(); + } + + /** + * Filters out data based on ?_fields= request parameter + * + * @param array $item Item to prepare. + * @param WP_REST_Request $request Full details about the request. + * + * @return WP_REST_Response filtered item + */ + public function prepare_item_for_response( $item, $request ) { + if ( ! is_callable( array( $this, 'get_fields_for_response' ) ) ) { + return rest_ensure_response( $item ); + } + + $fields = $this->get_fields_for_response( $request ); + + $response_data = array(); + foreach ( $item as $field => $value ) { + if ( in_array( $field, $fields, true ) ) { + $response_data[ $field ] = $value; + } + } + + return rest_ensure_response( $response_data ); + } + + /** + * Verify that user can access Publicize data + * + * @return true|WP_Error + */ + public function get_items_permission_check() { + global $publicize; + + if ( ! $publicize ) { + return new WP_Error( + 'publicize_not_available', + __( 'Sorry, Jetpack Social is not available on your site right now.', 'jetpack-publicize-pkg' ), + array( 'status' => rest_authorization_required_code() ) + ); + } + + if ( $publicize->current_user_can_access_publicize_data() ) { + return true; + } + + return new WP_Error( + 'invalid_user_permission_publicize', + __( 'Sorry, you are not allowed to access Jetpack Social data on this site.', 'jetpack-publicize-pkg' ), + array( 'status' => rest_authorization_required_code() ) + ); + } +} diff --git a/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php b/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php new file mode 100644 index 0000000000000..83affcaa48278 --- /dev/null +++ b/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php @@ -0,0 +1,303 @@ +namespace = 'wpcom/v2'; + $this->rest_base = 'publicize/connections'; + + add_action( 'rest_api_init', array( $this, 'register_routes' ) ); + } + + /** + * Register the routes. + */ + public function register_routes() { + register_rest_route( + $this->namespace, + '/' . $this->rest_base, + array( + array( + 'methods' => WP_REST_Server::READABLE, + 'callback' => array( $this, 'get_items' ), + 'permission_callback' => array( $this, 'get_items_permission_check' ), + 'args' => array( + 'test_connections' => array( + 'type' => 'boolean', + 'description' => __( 'Whether to test connections.', 'jetpack-publicize-pkg' ), + ), + ), + ), + 'schema' => array( $this, 'get_public_item_schema' ), + ) + ); + } + + /** + * Schema for the endpoint. + * + * @return array + */ + public function get_item_schema() { + $deprecated_fields = array( + 'id' => array( + 'type' => 'string', + 'description' => __( 'Unique identifier for the Jetpack Social connection.', 'jetpack-publicize-pkg' ) . ' ' . sprintf( + /* translators: %s is the new field name */ + __( 'Deprecated in favor of %s.', 'jetpack-publicize-pkg' ), + 'connection_id' + ), + ), + 'username' => array( + 'type' => 'string', + 'description' => __( 'Username of the connected account.', 'jetpack-publicize-pkg' ) . ' ' . sprintf( + /* translators: %s is the new field name */ + __( 'Deprecated in favor of %s.', 'jetpack-publicize-pkg' ), + 'external_handle' + ), + ), + 'profile_display_name' => array( + 'type' => 'string', + 'description' => __( 'The name to display in the profile of the connected account.', 'jetpack-publicize-pkg' ) . ' ' . sprintf( + /* translators: %s is the new field name */ + __( 'Deprecated in favor of %s.', 'jetpack-publicize-pkg' ), + 'display_name' + ), + ), + 'global' => array( + 'type' => 'boolean', + 'description' => __( 'Is this connection available to all users?', 'jetpack-publicize-pkg' ) . ' ' . sprintf( + /* translators: %s is the new field name */ + __( 'Deprecated in favor of %s.', 'jetpack-publicize-pkg' ), + 'shared' + ), + ), + ); + + $schema = array( + '$schema' => 'http://json-schema.org/draft-04/schema#', + 'title' => 'jetpack-publicize-connection', + 'type' => 'object', + 'properties' => array_merge( + $deprecated_fields, + array( + 'connection_id' => array( + 'type' => 'string', + 'description' => __( 'Connection ID of the connected account.', 'jetpack-publicize-pkg' ), + ), + 'display_name' => array( + 'type' => 'string', + 'description' => __( 'Display name of the connected account.', 'jetpack-publicize-pkg' ), + ), + 'external_handle' => array( + 'type' => 'string', + 'description' => __( 'The external handle or username of the connected account.', 'jetpack-publicize-pkg' ), + ), + 'external_id' => array( + 'type' => 'string', + 'description' => __( 'The external ID of the connected account.', 'jetpack-publicize-pkg' ), + ), + 'profile_link' => array( + 'type' => 'string', + 'description' => __( 'Profile link of the connected account.', 'jetpack-publicize-pkg' ), + ), + 'profile_picture' => array( + 'type' => 'string', + 'description' => __( 'URL of the profile picture of the connected account.', 'jetpack-publicize-pkg' ), + ), + 'service_label' => array( + 'type' => 'string', + 'description' => __( 'Human-readable label for the Jetpack Social service.', 'jetpack-publicize-pkg' ), + ), + 'service_name' => array( + 'type' => 'string', + 'description' => __( 'Alphanumeric identifier for the Jetpack Social service.', 'jetpack-publicize-pkg' ), + ), + 'shared' => array( + 'type' => 'boolean', + 'description' => __( 'Whether the connection is shared with other users.', 'jetpack-publicize-pkg' ), + ), + 'status' => array( + 'type' => 'string', + 'description' => __( 'The connection status.', 'jetpack-publicize-pkg' ), + 'enum' => array( + 'ok', + 'broken', + ), + ), + 'user_id' => array( + 'type' => 'integer', + 'description' => __( 'ID of the user the connection belongs to.', 'jetpack-publicize-pkg' ), + ), + ) + ), + ); + + return $this->add_additional_fields_schema( $schema ); + } + + /** + * Get all connections. Meant to be called directly only on WPCOM. + * + * @param bool $run_tests Whether to run tests on the connections. + * + * @return array + */ + protected static function get_all_connections( $run_tests = false ) { + /** + * Publicize instance. + * + * @var \Automattic\Jetpack\Publicize\Publicize $publicize + */ + global $publicize; + + $items = array(); + + $test_results = $run_tests ? self::get_connections_test_status() : array(); + + foreach ( (array) $publicize->get_services( 'connected' ) as $service_name => $connections ) { + foreach ( $connections as $connection ) { + + $connection_id = Connection_Fields::get_connection_id( $connection ); + + $connection_meta = Connection_Fields::get_connection_meta( $connection ); + $connection_data = $connection_meta['connection_data']; + + $items[] = array( + 'connection_id' => $connection_id, + 'display_name' => Connection_Fields::get_display_name( $service_name, $connection ), + 'external_handle' => Connection_Fields::get_external_handle( $service_name, $connection ), + 'external_id' => Connection_Fields::get_external_id( $connection ), + 'profile_link' => Connection_Fields::get_profile_link( $service_name, $connection ), + 'profile_picture' => Connection_Fields::get_profile_picture( $connection ), + 'service_label' => Connection_Fields::get_service_label( $service_name ), + 'service_name' => $service_name, + 'shared' => Connection_Fields::is_shared( $connection ), + 'status' => $test_results[ $connection_id ] ?? 'ok', + 'user_id' => Connection_Fields::get_user_id( $connection ), + + // Deprecated fields. + 'id' => (string) $publicize->get_connection_unique_id( $connection ), + 'username' => $publicize->get_username( $service_name, $connection ), + 'profile_display_name' => ! empty( $connection_meta['profile_display_name'] ) ? $connection_meta['profile_display_name'] : '', + // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual -- We expect an integer, but do loose comparison below in case some other type is stored. + 'global' => 0 == $connection_data['user_id'], + + ); + } + } + + return $items; + } + + /** + * Get a list of publicize connections. + * + * @param bool $run_tests Whether to run tests on the connections. + * + * @return array + */ + public static function get_connections( $run_tests = false ) { + if ( self::is_wpcom() ) { + return self::get_all_connections( $run_tests ); + } + + $site_id = Manager::get_site_id( true ); + if ( ! $site_id ) { + return array(); + } + + $path = add_query_arg( + array( 'test_connections' => $run_tests ), + sprintf( '/sites/%d/publicize/connections', $site_id ) + ); + + $response = Client::wpcom_json_api_request_as_user( $path, 'v3', array( 'method' => 'GET' ) ); + + if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { + // TODO log error. + return array(); + } + + $body = wp_remote_retrieve_body( $response ); + + $items = json_decode( $body, true ); + + return $items ? $items : array(); + } + + /** + * Get list of connected Publicize connections. + * + * @param WP_REST_Request $request Full details about the request. + * + * @return WP_REST_Response suitable for 1-page collection + */ + public function get_items( $request ) { + $items = array(); + + $run_tests = $request->get_param( 'test_connections' ); + + foreach ( self::get_connections( $run_tests ) as $item ) { + $data = $this->prepare_item_for_response( $item, $request ); + + $items[] = $this->prepare_response_for_collection( $data ); + } + + $response = rest_ensure_response( $items ); + $response->header( 'X-WP-Total', (string) count( $items ) ); + $response->header( 'X-WP-TotalPages', '1' ); + + return $response; + } + + /** + * Get the connections test status. + * + * @return array + */ + protected static function get_connections_test_status() { + /** + * Publicize instance. + * + * @var \Automattic\Jetpack\Publicize\Publicize $publicize + */ + global $publicize; + + $test_results = $publicize->get_publicize_conns_test_results(); + + $test_results_map = array(); + + foreach ( $test_results as $test_result ) { + // Compare to `true` because the API returns a 'must_reauth' for LinkedIn. + $test_results_map[ $test_result['connectionID'] ] = true === $test_result['connectionTestPassed'] ? 'ok' : 'broken'; + } + + return $test_results_map; + } +} + +if ( Base_Controller::is_wpcom() ) { + wpcom_rest_api_v2_load_plugin( Connections_Controller::class ); +} diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/publicize-connections.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/publicize-connections.php index 67fa5b25ced9e..35ffcbed109a9 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/publicize-connections.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/publicize-connections.php @@ -29,32 +29,11 @@ class WPCOM_REST_API_V2_Endpoint_List_Publicize_Connections extends WP_REST_Cont */ public $wpcom_is_wpcom_only_endpoint = true; - /** - * Constructor. - */ - public function __construct() { - $this->namespace = 'wpcom/v2'; - $this->rest_base = 'publicize/connections'; - - add_action( 'rest_api_init', array( $this, 'register_routes' ) ); - } - /** * Called automatically on `rest_api_init()`. */ public function register_routes() { - register_rest_route( - $this->namespace, - '/' . $this->rest_base, - array( - array( - 'methods' => WP_REST_Server::READABLE, - 'callback' => array( $this, 'get_items' ), - 'permission_callback' => array( $this, 'get_items_permission_check' ), - ), - 'schema' => array( $this, 'get_public_item_schema' ), - ) - ); + // Endpoint moved to publicize package. } /** diff --git a/projects/plugins/jetpack/changelog/update-move-wpcom-v2-publicize-connections-to-publicize b/projects/plugins/jetpack/changelog/update-move-wpcom-v2-publicize-connections-to-publicize new file mode 100644 index 0000000000000..5cb09fcc5fe9d --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-move-wpcom-v2-publicize-connections-to-publicize @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Moved wpcom/v2/publicize/connections endpoint to publicize package From 8c7af2bb40acd1aff78d891180beefd084bbc1f1 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 13 Dec 2024 10:21:48 +0530 Subject: [PATCH 2/5] Fix Fatals in Publicize base class on WPCOM --- projects/packages/publicize/src/class-publicize-base.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/packages/publicize/src/class-publicize-base.php b/projects/packages/publicize/src/class-publicize-base.php index 726ea9e9c1cd2..8494b8e1e9280 100644 --- a/projects/packages/publicize/src/class-publicize-base.php +++ b/projects/packages/publicize/src/class-publicize-base.php @@ -497,8 +497,8 @@ public function get_profile_link( $service_name, $connection ) { return 'https://instagram.com/' . $cmeta['connection_data']['meta']['username']; } - if ( 'threads' === $service_name && isset( $connection['external_name'] ) ) { - return 'https://www.threads.net/@' . $connection['external_name']; + if ( 'threads' === $service_name && isset( $cmeta['external_name'] ) ) { + return 'https://www.threads.net/@' . $cmeta['external_name']; } if ( 'mastodon' === $service_name && isset( $cmeta['external_name'] ) ) { @@ -527,7 +527,7 @@ public function get_profile_link( $service_name, $connection ) { } $profile_url_query = wp_parse_url( $cmeta['connection_data']['meta']['profile_url'], PHP_URL_QUERY ); - $profile_url_query_args = null; + $profile_url_query_args = array(); wp_parse_str( $profile_url_query, $profile_url_query_args ); $id = null; From 645afa3003c743703fb41280fab1f6dcf23ff406 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 13 Dec 2024 10:32:35 +0530 Subject: [PATCH 3/5] Now we can use v2 for proxy requests --- .../src/rest-endpoints/class-connections-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php b/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php index 83affcaa48278..65bb3c178ffb0 100644 --- a/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php +++ b/projects/packages/publicize/src/rest-endpoints/class-connections-controller.php @@ -233,7 +233,7 @@ public static function get_connections( $run_tests = false ) { sprintf( '/sites/%d/publicize/connections', $site_id ) ); - $response = Client::wpcom_json_api_request_as_user( $path, 'v3', array( 'method' => 'GET' ) ); + $response = Client::wpcom_json_api_request_as_user( $path, 'v2', array( 'method' => 'GET' ) ); if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { // TODO log error. From d284e5842687e14a8aa16793766bba8354d85362 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 13 Dec 2024 10:35:45 +0530 Subject: [PATCH 4/5] Phan needs a fan because I am not --- projects/packages/publicize/.phan/baseline.php | 2 ++ projects/packages/publicize/.phan/config.php | 1 + 2 files changed, 3 insertions(+) diff --git a/projects/packages/publicize/.phan/baseline.php b/projects/packages/publicize/.phan/baseline.php index 276871afd3219..e6d2be7e491bc 100644 --- a/projects/packages/publicize/.phan/baseline.php +++ b/projects/packages/publicize/.phan/baseline.php @@ -32,11 +32,13 @@ 'file_suppressions' => [ 'src/class-connections-post-field.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'src/class-keyring-helper.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault'], + 'src/class-publicize-assets.php' => ['PhanNoopNew'], 'src/class-publicize-base.php' => ['PhanImpossibleCondition', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanSuspiciousMagicConstant', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchReturn'], 'src/class-publicize-setup.php' => ['PhanTypeMismatchArgument'], 'src/class-publicize-ui.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchReturnProbablyReal'], 'src/class-publicize.php' => ['PhanParamSignatureMismatch', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMissingReturn'], 'src/class-rest-controller.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], + 'src/rest-endpoints/class-connections-controller.php' => ['PhanPluginMixedKeyNoKey'], 'src/social-image-generator/class-post-settings.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'src/social-image-generator/class-rest-settings-controller.php' => ['PhanPluginMixedKeyNoKey'], 'src/social-image-generator/class-settings.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], diff --git a/projects/packages/publicize/.phan/config.php b/projects/packages/publicize/.phan/config.php index 7030e2aa8176c..075dd16643b9e 100644 --- a/projects/packages/publicize/.phan/config.php +++ b/projects/packages/publicize/.phan/config.php @@ -24,6 +24,7 @@ __DIR__ . '/../../../plugins/jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php', // class Jetpack_Admin_Page __DIR__ . '/../../../plugins/jetpack/modules/subscriptions.php', // class Jetpack_Subscriptions __DIR__ . '/../../../plugins/jetpack/functions.global.php', // function jetpack_render_tos_blurb + __DIR__ . '/../../../plugins/jetpack/_inc/lib/core-api/load-wpcom-endpoints.php', // function wpcom_rest_api_v2_load_plugin ), ) ); From b6adf611807d478ae7977a04aafb6623222a258a Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Fri, 13 Dec 2024 11:21:47 +0530 Subject: [PATCH 5/5] Update baseline.php --- projects/plugins/jetpack/.phan/baseline.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index d3614e00bc549..741c58a413969 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -81,7 +81,6 @@ // PhanTypeMismatchArgumentInternalProbablyReal : 2 occurrences // PhanUndeclaredClassInCallable : 2 occurrences // PhanUndeclaredClassMethod : 2 occurrences - // PhanCommentParamWithoutRealParam : 1 occurrence // PhanDeprecatedPartiallySupportedCallable : 1 occurrence // PhanEmptyForeach : 1 occurrence // PhanPluginDuplicateSwitchCase : 1 occurrence @@ -139,7 +138,7 @@ '_inc/lib/core-api/wpcom-endpoints/gutenberg-available-extensions.php' => ['PhanPluginMixedKeyNoKey'], '_inc/lib/core-api/wpcom-endpoints/memberships.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginUnreachableCode', 'PhanTypeArraySuspicious'], '_inc/lib/core-api/wpcom-endpoints/publicize-connection-test-results.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeMismatchArgument'], - '_inc/lib/core-api/wpcom-endpoints/publicize-connections.php' => ['PhanParamSignatureMismatch', 'PhanPluginMixedKeyNoKey', 'PhanTypeMismatchArgument'], + '_inc/lib/core-api/wpcom-endpoints/publicize-connections.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument'], '_inc/lib/core-api/wpcom-endpoints/publicize-services.php' => ['PhanParamSignatureMismatch', 'PhanPluginMixedKeyNoKey', 'PhanTypeMismatchArgument'], '_inc/lib/core-api/wpcom-endpoints/service-api-keys.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspicious', 'PhanTypeMismatchReturnProbablyReal'], '_inc/lib/core-api/wpcom-endpoints/trait-wpcom-rest-api-proxy-request-trait.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanUndeclaredProperty'],