-
Notifications
You must be signed in to change notification settings - Fork 312
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
Single sync option if index is deleted #3011
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach you have here almost works @MARQAS but if you delete only one index, you get a false positive.
Steps to reproduce:
- Enable "Post Search" and "Users" features
- Run a sync and see 2 indices in the Health screen
- Delete only one index (
wp elasticpress delete-index --index-name=elasticpresstest-post-1 --yes
) - See 2 boxes in the Sync page (it should have only the Full Sync one)
includes/classes/Screen/Sync.php
Outdated
// Get the stats of the current index | ||
$index_stats = Stats::factory()->get_totals(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_totals()
are not the best way to check what we need @MARQAS. What we will need to do is to compare the results of Command::get_cluster_indexes()
and Command::get_index_names()
. As we won't be calling methods from the Command class outside the WP_CLI context, we can create similar methods in the Elasticsearch class and start calling those from the Command class and here, in the Sync class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MARQAS, In addition to my comments. as you've moved the get_index_names and get_cluster_indices methods to the Elasticsearch class, shouldn't that generate a change in Command.php? Thanks!
Description of the Change
This PR will address the issue where the Sync screen was showing 2 sync options along with the Last sync info. This will only show the Sync option which is visible during the initial syn.
Closes #2962
How to test the Change
Changelog Entry
Credits
Props @MARQAS
Checklist: