← All changes
|
src/actions/importing/aioseo/aioseo-posts-importing-action.php
+12
-12
19.0
→
trunk
View file →
| @@ -19,10 +19,8 @@ | ||
| 19 | 19 | use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Social_Images_Provider_Service; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Importing action for AIOSEO post data. |
| 23 | - * | |
| 24 | - * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded | |
| 25 | 23 | */ |
| 26 | 24 | class Aioseo_Posts_Importing_Action extends Abstract_Aioseo_Importing_Action { |
| 27 | 25 | |
| 28 | 26 | /** |
| @@ -27,19 +25,19 @@ | ||
| 27 | 25 | |
| 28 | 26 | /** |
| 29 | 27 | * The plugin of the action. |
| 30 | 28 | */ |
| 31 | - const PLUGIN = 'aioseo'; | |
| 29 | + public const PLUGIN = 'aioseo'; | |
| 32 | 30 | |
| 33 | 31 | /** |
| 34 | 32 | * The type of the action. |
| 35 | 33 | */ |
| 36 | - const TYPE = 'posts'; | |
| 34 | + public const TYPE = 'posts'; | |
| 37 | 35 | |
| 38 | 36 | /** |
| 39 | 37 | * The map of aioseo to yoast meta. |
| 40 | 38 | * |
| 41 | - * @var array | |
| 39 | + * @var array<string, array<string, string|bool|array<string, string|bool>>> | |
| 42 | 40 | */ |
| 43 | 41 | protected $aioseo_to_yoast_map = [ |
| 44 | 42 | 'title' => [ |
| 45 | 43 | 'yoast_name' => 'title', |
| @@ -189,9 +187,10 @@ | ||
| 189 | 187 | Sanitization_Helper $sanitization, |
| 190 | 188 | Aioseo_Replacevar_Service $replacevar_handler, |
| 191 | 189 | Aioseo_Robots_Provider_Service $robots_provider, |
| 192 | 190 | Aioseo_Robots_Transformer_Service $robots_transformer, |
| 193 | - Aioseo_Social_Images_Provider_Service $social_images_provider ) { | |
| 191 | + Aioseo_Social_Images_Provider_Service $social_images_provider | |
| 192 | + ) { | |
| 194 | 193 | parent::__construct( $import_cursor, $options, $sanitization, $replacevar_handler, $robots_provider, $robots_transformer ); |
| 195 | 194 | |
| 196 | 195 | $this->indexable_repository = $indexable_repository; |
| 197 | 196 | $this->wpdb = $wpdb; |
| @@ -284,9 +283,9 @@ | ||
| 284 | 283 | } |
| 285 | 284 | |
| 286 | 285 | if ( $this->indexable_helper->check_if_default_indexable( $indexable, $check_defaults_fields ) ) { |
| 287 | 286 | $indexable = $this->map( $indexable, $aioseo_indexable ); |
| 288 | - $indexable->save(); | |
| 287 | + $this->indexable_helper->save_indexable( $indexable ); | |
| 289 | 288 | |
| 290 | 289 | // To ensure that indexables can be rebuild after a reset, we have to store the data in the postmeta table too. |
| 291 | 290 | $this->indexable_to_postmeta->map_to_postmeta( $indexable ); |
| 292 | 291 | } |
| @@ -380,9 +379,9 @@ | ||
| 380 | 379 | public function get_limit() { |
| 381 | 380 | /** |
| 382 | 381 | * Filter 'wpseo_aioseo_post_indexation_limit' - Allow filtering the number of posts indexed during each indexing pass. |
| 383 | 382 | * |
| 384 | - * @api int The maximum number of posts indexed. | |
| 383 | + * @param int $max_posts The maximum number of posts indexed. | |
| 385 | 384 | */ |
| 386 | 385 | $limit = \apply_filters( 'wpseo_aioseo_post_indexation_limit', 25 ); |
| 387 | 386 | |
| 388 | 387 | if ( ! \is_int( $limit ) || $limit < 1 ) { |
| @@ -423,10 +422,11 @@ | ||
| 423 | 422 | |
| 424 | 423 | /** |
| 425 | 424 | * Creates a query for gathering AiOSEO data from the database. |
| 426 | 425 | * |
| 427 | - * @param int $limit The maximum number of unimported objects to be returned. | |
| 428 | - * @param bool $just_detect Whether we want to just detect if there are unimported objects. If false, we want to actually import them too. | |
| 426 | + * @param int|false $limit The maximum number of unimported objects to be returned. | |
| 427 | + * False for "no limit". | |
| 428 | + * @param bool $just_detect Whether we want to just detect if there are unimported objects. If false, we want to actually import them too. | |
| 429 | 429 | * |
| 430 | 430 | * @return string The query to use for importing or counting the number of items to import. |
| 431 | 431 | */ |
| 432 | 432 | public function query( $limit = false, $just_detect = false ) { |
| @@ -445,9 +445,9 @@ | ||
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | 447 | * Filter 'wpseo_aioseo_post_cursor' - Allow filtering the value of the aioseo post import cursor. |
| 448 | 448 | * |
| 449 | - * @api int The value of the aioseo post import cursor. | |
| 449 | + * @param int $import_cursor The value of the aioseo post import cursor. | |
| 450 | 450 | */ |
| 451 | 451 | $cursor = \apply_filters( 'wpseo_aioseo_post_import_cursor', $cursor ); |
| 452 | 452 | |
| 453 | 453 | $replacements = [ $cursor ]; |
| @@ -460,9 +460,9 @@ | ||
| 460 | 460 | |
| 461 | 461 | // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: There is no unescaped user input. |
| 462 | 462 | return $this->wpdb->prepare( |
| 463 | 463 | "SELECT {$select_statement} FROM {$table} WHERE id > %d ORDER BY id{$limit_statement}", |
| 464 | - $replacements | |
| 464 | + $replacements, | |
| 465 | 465 | ); |
| 466 | 466 | // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
| 467 | 467 | } |
| 468 | 468 | |