Skip to content

Commit

Permalink
Merge pull request #3041 from 10up/burhan/fix-3040
Browse files Browse the repository at this point in the history
Fix: put-mapping --network-wide when plugin is not network activated
  • Loading branch information
felipeelia authored Oct 11, 2022
2 parents 0daae8e + 9e0da3d commit ab6f068
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit ab6f068

Please sign in to comment.