Skip to content

Commit 1be9677

Browse files
author
Mustafa Şükrü Kapusuz
committed
refactor: forcefully setting push ability for indexes
1 parent b510b9d commit 1be9677

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

includes/indices/settings/class-algolia-primary-index-settings.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,21 @@ public function get_settings_needs_sync(): array {
4949
return $needs_sync;
5050
}
5151

52-
public function push(): bool {
53-
$settings_needs_sync = $this->get_settings_needs_sync();
54-
55-
if ( count( $settings_needs_sync ) === 0 ) {
52+
/**
53+
* Push settings to the Algolia
54+
*
55+
* @param array $overrides The settings array that will be forcefully pushed.
56+
* @return bool
57+
*/
58+
public function push( $overrides = [] ): bool {
59+
$settings = wp_parse_args( $overrides, $this->get_settings_needs_sync() );
60+
61+
if ( count( $settings ) === 0 ) {
5662
return false;
5763
}
5864

5965
try {
60-
$this->get_algolia_index()->setSettings( $settings_needs_sync );
66+
$this->get_algolia_index()->setSettings( $settings );
6167
} catch ( Exception $e ) {
6268
return false;
6369
}

0 commit comments

Comments
 (0)