Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve readability of sync output #3990

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions includes/classes/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,11 @@ public function index_output( $message, $args, $index_meta, $context ) {
$time_elapsed = Utility::timer_stop( 2 );
WP_CLI::log( WP_CLI::colorize( '%Y' . esc_html__( 'Time elapsed: ', 'elasticpress' ) . '%N' . Utility::timer_format( $time_elapsed ) . $time_elapsed_diff ) );

$current_memory = round( memory_get_usage() / 1024 / 1024, 2 ) . 'mb';
$peak_memory = ' (Peak: ' . round( memory_get_peak_usage() / 1024 / 1024, 2 ) . 'mb)';
WP_CLI::log( WP_CLI::colorize( '%Y' . esc_html__( 'Memory Usage: ', 'elasticpress' ) . '%N' . $current_memory . $peak_memory ) );
$current_memory = memory_get_usage() / 1024 / 1024;
$current_memory = ( $current_memory > 1000 ) ? round( $current_memory / 1024, 2 ) . 'gb' : round( $current_memory, 2 ) . 'mb';
$peak_memory = memory_get_peak_usage() / 1024 / 1024;
$peak_memory = ( $peak_memory > 1000 ) ? round( $peak_memory / 1024, 2 ) . 'gb' : round( $peak_memory, 2 ) . 'mb';
WP_CLI::log( WP_CLI::colorize( '%Y' . esc_html__( 'Memory Usage: ', 'elasticpress' ) . '%N' . $current_memory . ' (Peak: ' . $peak_memory . ')' ) );
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions includes/classes/IndexHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,11 @@ function( $item ) {

$summary = sprintf(
/* translators: 1. Indexable type 2. Offset start, 3. Offset end, 4. Found items 5. Last object ID */
esc_html__( 'Processed %1$s %2$d - %3$d of %4$d. Last Object ID: %5$d', 'elasticpress' ),
esc_html__( 'Processed %1$s %2$s - %3$s of %4$s. Last Object ID: %5$d', 'elasticpress' ),
esc_html( strtolower( $indexable->labels['plural'] ) ),
$this->index_meta['from'],
$this->index_meta['offset'],
$this->index_meta['found_items'],
number_format( $this->index_meta['from'] ),
number_format( $this->index_meta['offset'] ),
number_format( $this->index_meta['found_items'] ),
$this->index_meta['current_sync_item']['last_processed_object_id']
);

Expand Down
8 changes: 4 additions & 4 deletions includes/classes/REST/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ public function get_sync_status( \WP_REST_Request $request ) {
[
'message' => sprintf(
/* translators: 1. Number of objects indexed, 2. Total number of objects, 3. Last object ID. */
esc_html__( 'Processed %1$d/%2$d. Last Object ID: %3$d', 'elasticpress' ),
$index_meta['offset'],
$index_meta['found_items'],
$index_meta['current_sync_item']['last_processed_object_id']
esc_html__( 'Processed %1$s/%2$s. Last Object ID: %3$s', 'elasticpress' ),
number_format( $index_meta['offset'] ),
number_format( $index_meta['found_items'] ),
number_format( $index_meta['current_sync_item']['last_processed_object_id'] )
),
'index_meta' => $index_meta,
]
Expand Down
2 changes: 1 addition & 1 deletion includes/partials/stats-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<div class="ep-flex-container">
<div class="ep-totals-column inside">
<p class="ep-totals-title"><?php esc_html_e( 'Total Documents', 'elasticpress' ); ?></p>
<p class="ep-totals-data"><?php echo esc_html( $totals['docs'] ); ?></p>
<p class="ep-totals-data"><?php echo esc_html( number_format( $totals['docs'] ) ); ?></p>
</div>
<div class="ep-totals-column inside">
<p class="ep-totals-title"><?php esc_html_e( 'Total Size', 'elasticpress' ); ?></p>
Expand Down
Loading