Skip to content

Commit cd17715

Browse files
authored
Merge pull request #87 from wp-cli/fix/phpcs
Fix PHPCS errors
2 parents 7aafa54 + 85f88fe commit cd17715

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

features/import.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: Import content.
99
Error: WordPress Importer needs to be installed. Try 'wp plugin install wordpress-importer --activate'.
1010
"""
1111

12-
@require-wp-5.2
12+
@require-wp-5.2 @require-mysql
1313
Scenario: Basic export then import
1414
Given a WP install
1515
And I run `wp site empty --yes`
@@ -51,7 +51,7 @@ Feature: Import content.
5151
When I run `wp import {EXPORT_FILE} --authors=skip --skip=image_resize`
5252
Then STDOUT should not be empty
5353

54-
@require-wp-5.2
54+
@require-wp-5.2 @require-mysql
5555
Scenario: Export and import a directory of files
5656
Given a WP install
5757
And I run `mkdir export-posts`
@@ -101,7 +101,7 @@ Feature: Import content.
101101
100
102102
"""
103103

104-
@require-wp-5.2
104+
@require-wp-5.2 @require-mysql
105105
Scenario: Export and import a directory of files with .wxr and .xml extensions.
106106
Given a WP install
107107
And I run `mkdir export`
@@ -148,7 +148,7 @@ Feature: Import content.
148148
2
149149
"""
150150

151-
@require-wp-5.2
151+
@require-wp-5.2 @require-mysql
152152
Scenario: Export and import page and referencing menu item
153153
Given a WP install
154154
And I run `wp site empty --yes`
@@ -225,7 +225,7 @@ Feature: Import content.
225225
2
226226
"""
227227

228-
@require-wp-5.2
228+
@require-wp-5.2 @require-mysql
229229
Scenario: Export and import page and referencing menu item in separate files
230230
Given a WP install
231231
And I run `wp site empty --yes`
@@ -303,7 +303,7 @@ Feature: Import content.
303303
2
304304
"""
305305

306-
@require-wp-5.2
306+
@require-wp-5.2 @require-mysql
307307
Scenario: Indicate current file when importing
308308
Given a WP install
309309
And I run `wp plugin install --activate wordpress-importer`

src/Import_Command.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,12 @@ function ( $posts ) {
221221

222222
add_filter(
223223
'wp_import_post_comments',
224-
function ( $comments, $post_id, $post ) {
224+
function ( $comments ) {
225225
global $wpcli_import_counts;
226226
$wpcli_import_counts['current_comment'] = 0;
227227
$wpcli_import_counts['total_comments'] = count( $comments );
228228
return $comments;
229-
},
230-
10,
231-
3
229+
}
232230
);
233231

234232
add_filter(
@@ -249,7 +247,7 @@ function ( $post ) {
249247

250248
add_action(
251249
'wp_import_insert_post',
252-
function ( $post_id, $original_post_id, $post, $postdata ) {
250+
function ( $post_id ) {
253251
global $wpcli_import_counts;
254252
if ( is_wp_error( $post_id ) ) {
255253
WP_CLI::warning( '-- Error importing post: ' . $post_id->get_error_code() );
@@ -261,47 +259,43 @@ function ( $post_id, $original_post_id, $post, $postdata ) {
261259
WP_CLI\Utils\wp_clear_object_cache();
262260
WP_CLI::log( '-- Cleared object cache.' );
263261
}
264-
},
265-
10,
266-
4
262+
}
267263
);
268264

269265
add_action(
270266
'wp_import_insert_term',
271-
function ( $t, $import_term, $post_id, $post ) {
267+
function ( $t, $import_term ) {
272268
WP_CLI::log( "-- Created term \"{$import_term['name']}\"" );
273269
},
274270
10,
275-
4
271+
2
276272
);
277273

278274
add_action(
279275
'wp_import_set_post_terms',
280-
function ( $tt_ids, $term_ids, $taxonomy, $post_id, $post ) {
276+
function ( $tt_ids, $term_ids, $taxonomy ) {
281277
WP_CLI::log( '-- Added terms (' . implode( ',', $term_ids ) . ") for taxonomy \"{$taxonomy}\"" );
282278
},
283279
10,
284-
5
280+
3
285281
);
286282

287283
add_action(
288284
'wp_import_insert_comment',
289-
function ( $comment_id, $comment, $comment_post_id, $post ) {
285+
function ( $comment_id ) {
290286
global $wpcli_import_counts;
291287
$wpcli_import_counts['current_comment']++;
292288
WP_CLI::log( sprintf( '-- Added comment #%d (%s of %s)', $comment_id, number_format( $wpcli_import_counts['current_comment'] ), number_format( $wpcli_import_counts['total_comments'] ) ) );
293-
},
294-
10,
295-
4
289+
}
296290
);
297291

298292
add_action(
299293
'import_post_meta',
300-
function ( $post_id, $key, $value ) {
294+
function ( $post_id, $key ) {
301295
WP_CLI::log( "-- Added post_meta $key" );
302296
},
303297
10,
304-
3
298+
2
305299
);
306300
}
307301

0 commit comments

Comments
 (0)