Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #120 from xwp/improve/migration
Browse files Browse the repository at this point in the history
Improve verbosity
  • Loading branch information
valendesigns committed Feb 24, 2017
2 parents dbee0d5 + 7ee1335 commit ef46389
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions php/class-customize-snapshot-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ public function migrate( $arg, $assoc_args ) {
if ( ! $dry_mode ) {
wp_suspend_cache_addition( true );
$post_count = $migrate_obj->changeset_migrate();
\WP_CLI::success( $post_count . ' ' . __( 'posts migrated.', 'customize-snapshots' ) );
} else {
$ids = $migrate_obj->changeset_migrate( -1, true );
\WP_CLI::success( __( 'Posts migrated:', 'customize-snapshots' ) . ' ' . implode( ',', $ids ) );
\WP_CLI::success( 'Total ' . count( $ids ) . ' ' . __( 'posts migrated.', 'customize-snapshots' ) );
$post_count = count( $ids );
}
/* translators: %s: post count.*/
\WP_CLI::success( sprintf( __( 'Total posts migrated: %s', 'customize-snapshots' ), $post_count ) );
}
}

Expand Down
9 changes: 6 additions & 3 deletions php/class-migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public function changeset_migrate( $limit = -1, $dry_run = false ) {
}

if ( $is_doing_cli ) {
\WP_CLI::log( __( 'Migrating', 'customize-snapshots' ) . ' ' . count( $query->posts ) . __( ' snapshots into changeset', 'customize-snapshots' ) );
/* translators: %s: post count.*/
\WP_CLI::log( sprintf( __( 'Migrating %s Snapshots into Changeset', 'customize-snapshots' ), count( $query->posts ) ) );
}

if ( ! empty( $query->posts ) ) {
Expand All @@ -139,9 +140,11 @@ public function changeset_migrate( $limit = -1, $dry_run = false ) {
$success = $this->migrate_post( $id );
if ( $is_doing_cli ) {
if ( $success ) {
\WP_CLI::success( __( 'Migrated post', 'customize-snapshots' ) . ' ' . $id . '.' );
/* translators: %s: post id.*/
\WP_CLI::success( sprintf( __( 'Migrated post %s.', 'customize-snapshots' ), $id ) );
} else {
\WP_CLI::error( __( ' Failed to migrate', 'customize-snapshots' ) . ' ' . $id . '.' );
/* translators: %s: post id.*/
\WP_CLI::error( sprintf( __( 'Failed to migrate %s.', 'customize-snapshots' ), $id ) );
}
}
}
Expand Down

0 comments on commit ef46389

Please sign in to comment.