← All changes
|
jetpack_vendor/automattic/jetpack-import/src/endpoints/class-page.php
+11
-13
12.0.3
→
16.3
View file →
| @@ -6,8 +6,16 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace Automattic\Jetpack\Import\Endpoints; |
| 9 | 9 | |
| 10 | +use WP_Error; | |
| 11 | +use WP_REST_Request; | |
| 12 | +use WP_REST_Response; | |
| 13 | + | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit( 0 ); | |
| 16 | +} | |
| 17 | + | |
| 10 | 18 | /** |
| 11 | 19 | * Class Page |
| 12 | 20 | */ |
| 13 | 21 | class Page extends Post { |
| @@ -19,21 +27,8 @@ | ||
| 19 | 27 | parent::__construct( 'page' ); |
| 20 | 28 | } |
| 21 | 29 | |
| 22 | 30 | /** |
| 23 | - * Adds the schema from additional fields to a schema array. | |
| 24 | - * | |
| 25 | - * The type of object is inferred from the passed schema. | |
| 26 | - * | |
| 27 | - * @param array $schema Schema array. | |
| 28 | - * @return array Modified Schema array. | |
| 29 | - */ | |
| 30 | - public function add_additional_fields_schema( $schema ) { | |
| 31 | - // Add the import unique ID to the schema. | |
| 32 | - return $this->add_unique_identifier_to_schema( $schema ); | |
| 33 | - } | |
| 34 | - | |
| 35 | - /** | |
| 36 | 31 | * Creates a single page. |
| 37 | 32 | * |
| 38 | 33 | * @param WP_REST_Request $request Full details about the request. |
| 39 | 34 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| @@ -38,8 +33,11 @@ | ||
| 38 | 33 | * @param WP_REST_Request $request Full details about the request. |
| 39 | 34 | * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
| 40 | 35 | */ |
| 41 | 36 | public function create_item( $request ) { |
| 37 | + // Set the WP_IMPORTING constant to prevent sync notifications | |
| 38 | + $this->set_importing(); | |
| 39 | + | |
| 42 | 40 | if ( ! empty( $request['parent'] ) ) { |
| 43 | 41 | $pages = \get_pages( $this->get_import_db_query( $request['parent'] ) ); |
| 44 | 42 | |
| 45 | 43 | // Overwrite the page parent page ID. |