Making WordPress.org


Ignore:
Timestamp:
02/15/2017 02:32:16 PM (8 years ago)
Author:
iandunn
Message:

WordCamp WP-CLI: Replace success messages with progress meter

Outputting a success message for each site clutters the screen, making it hard to scan warnings. A progress meter is a better way to provide feedback to the user.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wp-cli-commands/rewrite-rules.php

    r4574 r4906  
    2121        $error           = '';
    2222        $sites           = wp_get_sites( array( 'limit' => false ) );
     23        $notify          = new \cli\progress\Bar( sprintf( 'Processing %d sites', count( $sites ) ), count( $sites ) );
    2324
    2425        WP_CLI::line();
     
    5354            }
    5455
    55             if ( $success ) {
    56                 WP_CLI::line( sprintf( '%s: Flushed', $display_url ) );
    57             } else {
     56            if ( ! $success ) {
    5857                WP_CLI::warning( sprintf( '%s: Failed with error: %s', $display_url, $error ) );
    5958            }
     59
     60            $notify->tick();
    6061        }
     62
     63        $notify->finish();
    6164
    6265        $execution_time = microtime( true ) - $start_timestamp;
Note: See TracChangeset for help on using the changeset viewer.