Skip to content
Snippets Groups Projects
Commit a75c346e authored by Mohammad Jangda's avatar Mohammad Jangda
Browse files

Prevent verbosity from being triggered multiple times if we loop through a command a few times.

parent 94138e08
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
WP_CLI::add_command( 'syndication', 'Syndication_CLI_Command' ); WP_CLI::add_command( 'syndication', 'Syndication_CLI_Command' );
class Syndication_CLI_Command extends WP_CLI_Command { class Syndication_CLI_Command extends WP_CLI_Command {
var $enabled_verbosity = false;
function pull_site( $args, $assoc_args ) { function pull_site( $args, $assoc_args ) {
$assoc_args = wp_parse_args( $assoc_args, array( $assoc_args = wp_parse_args( $assoc_args, array(
...@@ -42,6 +43,11 @@ var_dump( $site_id, $site ); ...@@ -42,6 +43,11 @@ var_dump( $site_id, $site );
} }
private function _make_em_talk_pull() { private function _make_em_talk_pull() {
if ( $this->enabled_verbosity )
return;
$this->enabled_verbosity = true;
// output when a post is new or updated // output when a post is new or updated
add_filter( 'syn_pre_pull_posts', function( $posts, $site, $client ) { 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( 'Processing feed %s (%d)', $site->post_title, $site->ID ) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment