PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/integrations/watchers/option-titles-watcher.php +13 -11 18.4 → trunk View file →
@@ -27,9 +27,9 @@
27 27
28 28 /**
29 29 * Returns the conditionals based on which this loadable should be active.
30 30 *
31 - * @return array
31 + * @return array<Migrations_Conditional>
32 32 */
33 33 public static function get_conditionals() {
34 34 return [ Migrations_Conditional::class ];
35 35 }
@@ -36,10 +36,10 @@
36 36
37 37 /**
38 38 * Checks if one of the relevant options has been changed.
39 39 *
40 - * @param array $old_value The old value of the option.
41 - * @param array $new_value The new value of the option.
40 + * @param array<string|int|bool> $old_value The old value of the option.
41 + * @param array<string|int|bool> $new_value The new value of the option.
42 42 *
43 43 * @return bool Whether or not the ancestors are removed.
44 44 */
45 45 public function check_option( $old_value, $new_value ) {
@@ -75,9 +75,9 @@
75 75
76 76 /**
77 77 * Retrieves the relevant keys.
78 78 *
79 - * @return array Array with the relevant keys.
79 + * @return array<string> Array with the relevant keys.
80 80 */
81 81 protected function get_relevant_keys() {
82 82 $post_types = \get_post_types( [ 'public' => true ], 'names' );
83 83 if ( ! \is_array( $post_types ) || $post_types === [] ) {
@@ -94,9 +94,9 @@
94 94
95 95 /**
96 96 * Removes the ancestors for given post types.
97 97 *
98 - * @param array $post_types The post types to remove hierarchy for.
98 + * @param array<string> $post_types The post types to remove hierarchy for.
99 99 *
100 100 * @return bool True when delete query was successful.
101 101 */
102 102 protected function delete_ancestors( $post_types ) {
@@ -104,24 +104,26 @@
104 104 return false;
105 105 }
106 106
107 107 $wpdb = Wrapper::get_wpdb();
108 - $total = \count( $post_types );
109 108 $hierarchy_table = Model::get_table_name( 'Indexable_Hierarchy' );
110 109 $indexable_table = Model::get_table_name( 'Indexable' );
111 110
111 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Delete query.
112 112 $result = $wpdb->query(
113 113 $wpdb->prepare(
114 114 "
115 - DELETE FROM `$hierarchy_table`
115 + DELETE FROM %i
116 116 WHERE indexable_id IN(
117 117 SELECT id
118 - FROM `$indexable_table`
118 + FROM %i
119 119 WHERE object_type = 'post'
120 - AND object_sub_type IN( " . \implode( ', ', \array_fill( 0, $total, '%s' ) ) . ' )
120 + AND object_sub_type IN( " . \implode( ', ', \array_fill( 0, \count( $post_types ), '%s' ) ) . ' )
121 121 )',
122 - $post_types
123 - )
122 + $hierarchy_table,
123 + $indexable_table,
124 + ...$post_types,
125 + ),
124 126 );
125 127
126 128 return $result !== false;
127 129 }