Skip to content

Commit

Permalink
Merge pull request #166 from Automattic/update/wp-cli-line
Browse files Browse the repository at this point in the history
Update WP_CLI::line() to WP_CLI::log()
  • Loading branch information
raamdev authored Dec 18, 2024
2 parents 8c0d90d + aaab369 commit 1e8b859
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions includes/class-wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ function push_all_posts( $args, $assoc_args ) {
$query = new WP_Query( $query_args );

while( $query->post_count ) {
WP_CLI::line( sprintf( 'Processing page %d', $query_args[ 'paged' ] ) );
WP_CLI::log( sprintf( 'Processing page %d', $query_args[ 'paged' ] ) );

foreach( $query->posts as $post ) {
WP_CLI::line( sprintf( 'Processing post %d (%s)', $post->ID, $post->post_title ) );
WP_CLI::log( sprintf( 'Processing post %d (%s)', $post->ID, $post->post_title ) );

$this->push_post( array(), array( 'post_id' => $post->ID ) );
}
Expand Down Expand Up @@ -112,18 +112,18 @@ private function _make_em_talk_pull() {

// output when a post is new or updated
add_filter( 'syn_pre_pull_posts', function( $posts, $site, $client ) {
WP_CLI::line( sprintf( 'Processing feed %s (%d)', $site->post_title, $site->ID ) );
WP_CLI::line( sprintf( '-- found %s posts', count( $posts ) ) );
WP_CLI::log( sprintf( 'Processing feed %s (%d)', $site->post_title, $site->ID ) );
WP_CLI::log( sprintf( '-- found %s posts', count( $posts ) ) );

return $posts;
}, 10, 3 );

add_action( 'syn_post_pull_new_post', function( $result, $post, $site, $transport_type, $client ) {
WP_CLI::line( sprintf( '-- New post #%d (%s)', $result, $post['post_guid'] ) );
WP_CLI::log( sprintf( '-- New post #%d (%s)', $result, $post['post_guid'] ) );
}, 10, 5 );

add_action( 'syn_post_pull_edit_post', function( $result, $post, $site, $transport_type, $client ) {
WP_CLI::line( sprintf( '-- Updated post #%d (%s)', $result, $post['post_guid'] ) );
WP_CLI::log( sprintf( '-- Updated post #%d (%s)', $result, $post['post_guid'] ) );
}, 10, 5 );
}

Expand All @@ -134,18 +134,18 @@ private function _make_em_talk_push() {
$this->enabled_verbosity = true;

add_filter( 'syn_pre_push_post_sites', function( $sites, $post_id, $slave_states ) {
WP_CLI::line( sprintf( "Processing post_id #%d (%s)", $post_id, get_the_title( $post_id ) ) );
WP_CLI::line( sprintf( "-- pushing to %s sites and deleting from %s sites", number_format( count( $sites['selected_sites'] ) ), number_format( count( $sites['removed_sites'] ) ) ) );
WP_CLI::log( sprintf( "Processing post_id #%d (%s)", $post_id, get_the_title( $post_id ) ) );
WP_CLI::log( sprintf( "-- pushing to %s sites and deleting from %s sites", number_format( count( $sites['selected_sites'] ) ), number_format( count( $sites['removed_sites'] ) ) ) );

return $sites;
}, 10, 3 );

add_action( 'syn_post_push_new_post', function( $result, $post_ID, $site, $transport_type, $client, $info ) {
WP_CLI::line( sprintf( '-- Added remote post #%d (%s)', $post_ID, $site->post_title ) );
WP_CLI::log( sprintf( '-- Added remote post #%d (%s)', $post_ID, $site->post_title ) );
}, 10, 6 );

add_action( 'syn_post_push_edit_post', function( $result, $post_ID, $site, $transport_type, $client, $info ) {
WP_CLI::line( sprintf( '-- Updated remote post #%d (%s)', $post_ID, $site->post_title ) );
WP_CLI::log( sprintf( '-- Updated remote post #%d (%s)', $post_ID, $site->post_title ) );
}, 10, 6 );

}
Expand Down

0 comments on commit 1e8b859

Please sign in to comment.