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

Fix: put-mapping --network-wide when plugin is not network activated #3041

Merged
merged 2 commits into from
Oct 11, 2022
Merged
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
2 changes: 1 addition & 1 deletion includes/classes/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private function put_mapping_helper( $args, $assoc_args ) {
$non_global_indexable_objects = Indexables::factory()->get_all( false );
$global_indexable_objects = Indexables::factory()->get_all( true );

if ( isset( $assoc_args['network-wide'] ) && is_multisite() ) {
if ( isset( $assoc_args['network-wide'] ) && defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
if ( ! is_numeric( $assoc_args['network-wide'] ) ) {
$assoc_args['network-wide'] = 0;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/cypress/integration/wp-cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ describe('WP-CLI Commands', () => {
.its('stdout')
.should('contain', 'Adding post mapping')
.should('contain', 'Mapping sent');

cy.wpCli('wp elasticpress put-mapping --network-wide')
.its('stdout')
.should('contain', 'Adding post mapping')
.should('contain', 'Mapping sent');
});

it('Can recreate the alias index which points to every index in the network if user runs wp elasticpress recreate-network-alias command', () => {});
Expand Down