← All changes
|
admin/import/plugins/class-abstract-plugin-importer.php
+17
-13
18.8
→
28.6
View file →
| @@ -110,10 +110,10 @@ | ||
| 110 | 110 | } |
| 111 | 111 | $wpdb->query( |
| 112 | 112 | $wpdb->prepare( |
| 113 | 113 | "DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE %s", |
| 114 | - $this->meta_key | |
| 115 | - ) | |
| 114 | + $this->meta_key, | |
| 115 | + ), | |
| 116 | 116 | ); |
| 117 | 117 | $result = $wpdb->__get( 'result' ); |
| 118 | 118 | if ( ! $result ) { |
| 119 | 119 | $this->cleanup_error_msg(); |
| @@ -160,10 +160,10 @@ | ||
| 160 | 160 | $wpdb->prepare( |
| 161 | 161 | "SELECT COUNT(*) AS `count` |
| 162 | 162 | FROM {$wpdb->postmeta} |
| 163 | 163 | WHERE meta_key IN ( " . implode( ', ', array_fill( 0, count( $meta_keys ), '%s' ) ) . ' )', |
| 164 | - $meta_keys | |
| 165 | - ) | |
| 164 | + $meta_keys, | |
| 165 | + ), | |
| 166 | 166 | ); |
| 167 | 167 | |
| 168 | 168 | if ( $result === '0' ) { |
| 169 | 169 | return false; |
| @@ -188,10 +188,10 @@ | ||
| 188 | 188 | $result = $wpdb->query( |
| 189 | 189 | $wpdb->prepare( |
| 190 | 190 | // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- This is intentional + temporary. |
| 191 | 191 | "CREATE TEMPORARY TABLE tmp_meta_table SELECT * FROM {$wpdb->postmeta} WHERE meta_key = %s", |
| 192 | - $old_key | |
| 193 | - ) | |
| 192 | + $old_key, | |
| 193 | + ), | |
| 194 | 194 | ); |
| 195 | 195 | if ( $result === false ) { |
| 196 | 196 | $this->set_missing_db_rights_status(); |
| 197 | 197 | return false; |
| @@ -200,10 +200,10 @@ | ||
| 200 | 200 | // Delete all the values in our temp table for posts that already have data for $new_key. |
| 201 | 201 | $wpdb->query( |
| 202 | 202 | $wpdb->prepare( |
| 203 | 203 | "DELETE FROM tmp_meta_table WHERE post_id IN ( SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s )", |
| 204 | - WPSEO_Meta::$meta_prefix . $new_key | |
| 205 | - ) | |
| 204 | + WPSEO_Meta::$meta_prefix . $new_key, | |
| 205 | + ), | |
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | 208 | /* |
| 209 | 209 | * We set meta_id to NULL so on re-insert into the postmeta table, MYSQL can set |
| @@ -214,10 +214,10 @@ | ||
| 214 | 214 | // Now we rename the meta_key. |
| 215 | 215 | $wpdb->query( |
| 216 | 216 | $wpdb->prepare( |
| 217 | 217 | 'UPDATE tmp_meta_table SET meta_key = %s', |
| 218 | - WPSEO_Meta::$meta_prefix . $new_key | |
| 219 | - ) | |
| 218 | + WPSEO_Meta::$meta_prefix . $new_key, | |
| 219 | + ), | |
| 220 | 220 | ); |
| 221 | 221 | |
| 222 | 222 | $this->meta_key_clone_replace( $replace_values ); |
| 223 | 223 | |
| @@ -239,9 +239,9 @@ | ||
| 239 | 239 | * @return bool Success status. |
| 240 | 240 | */ |
| 241 | 241 | protected function meta_keys_clone( $clone_keys ) { |
| 242 | 242 | foreach ( $clone_keys as $clone_key ) { |
| 243 | - $result = $this->meta_key_clone( $clone_key['old_key'], $clone_key['new_key'], isset( $clone_key['convert'] ) ? $clone_key['convert'] : [] ); | |
| 243 | + $result = $this->meta_key_clone( $clone_key['old_key'], $clone_key['new_key'], ( $clone_key['convert'] ?? [] ) ); | |
| 244 | 244 | if ( ! $result ) { |
| 245 | 245 | return false; |
| 246 | 246 | } |
| 247 | 247 | } |
| @@ -249,8 +249,10 @@ | ||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Sets the import status to false and returns a message about why it failed. |
| 253 | + * | |
| 254 | + * @return void | |
| 253 | 255 | */ |
| 254 | 256 | protected function set_missing_db_rights_status() { |
| 255 | 257 | $this->status->set_status( false ); |
| 256 | 258 | /* translators: %s is replaced with Yoast SEO. */ |
| @@ -278,8 +280,10 @@ | ||
| 278 | 280 | * |
| 279 | 281 | * @param string $new_key The key to save. |
| 280 | 282 | * @param mixed $value The value to set the key to. |
| 281 | 283 | * @param int $post_id The Post to save the meta for. |
| 284 | + * | |
| 285 | + * @return void | |
| 282 | 286 | */ |
| 283 | 287 | protected function maybe_save_post_meta( $new_key, $value, $post_id ) { |
| 284 | 288 | // Big. Fat. Sigh. Mostly used for _yst_is_cornerstone, but might be useful for other hidden meta's. |
| 285 | 289 | $key = WPSEO_Meta::$meta_prefix . $new_key; |
| @@ -315,10 +319,10 @@ | ||
| 315 | 319 | $wpdb->query( |
| 316 | 320 | $wpdb->prepare( |
| 317 | 321 | 'UPDATE tmp_meta_table SET meta_value = %s WHERE meta_value = %s', |
| 318 | 322 | $new_value, |
| 319 | - $old_value | |
| 320 | - ) | |
| 323 | + $old_value, | |
| 324 | + ), | |
| 321 | 325 | ); |
| 322 | 326 | } |
| 323 | 327 | } |
| 324 | 328 | } |