| @@ -7,11 +7,10 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | namespace ElasticPress\Indexable\Term; |
| 10 | 10 | |
| 11 | -use ElasticPress\Indexables as Indexables; | |
| 12 | -use ElasticPress\Elasticsearch as Elasticsearch; | |
| 13 | -use ElasticPress\SyncManager as SyncManagerAbstract; | |
| 11 | +use ElasticPress\Elasticsearch; | |
| 12 | +use ElasticPress\Indexables; | |
| 14 | 13 | |
| 15 | 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | 15 | exit; // Exit if accessed directly. |
| 17 | 16 | } |
| @@ -18,9 +17,9 @@ | ||
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * Sync manager class |
| 21 | 20 | */ |
| 22 | -class SyncManager extends SyncManagerAbstract { | |
| 21 | +class SyncManager extends \ElasticPress\SyncManager { | |
| 23 | 22 | /** |
| 24 | 23 | * Indexable slug |
| 25 | 24 | * |
| 26 | 25 | * @since 4.7.0 |
| @@ -98,9 +97,9 @@ | ||
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | do_action( 'ep_sync_term_on_transition', $term_id ); |
| 101 | 100 | |
| 102 | - $this->sync_queue[ $term_id ] = true; | |
| 101 | + $this->add_to_queue( $term_id ); | |
| 103 | 102 | |
| 104 | 103 | // Find all terms in the hierarchy so we resync those as well |
| 105 | 104 | $term = get_term( $term_id ); |
| 106 | 105 | $children = get_term_children( $term_id, $term->taxonomy ); |
| @@ -117,9 +116,9 @@ | ||
| 117 | 116 | } |
| 118 | 117 | |
| 119 | 118 | do_action( 'ep_sync_term_on_transition', $hierarchy_term_id ); |
| 120 | 119 | |
| 121 | - $this->sync_queue[ $hierarchy_term_id ] = true; | |
| 120 | + $this->add_to_queue( $hierarchy_term_id ); | |
| 122 | 121 | } |
| 123 | 122 | } |
| 124 | 123 | |
| 125 | 124 | /** |
| @@ -156,9 +155,9 @@ | ||
| 156 | 155 | } |
| 157 | 156 | |
| 158 | 157 | do_action( 'ep_sync_term_on_transition', $term->term_id ); |
| 159 | 158 | |
| 160 | - $this->sync_queue[ $term->term_id ] = true; | |
| 159 | + $this->add_to_queue( $term->term_id ); | |
| 161 | 160 | |
| 162 | 161 | // Find all terms in the hierarchy so we resync those as well |
| 163 | 162 | $children = get_term_children( $term->term_id, $term->taxonomy ); |
| 164 | 163 | $ancestors = get_ancestors( $term->term_id, $term->taxonomy, 'taxonomy' ); |
| @@ -174,9 +173,9 @@ | ||
| 174 | 173 | } |
| 175 | 174 | |
| 176 | 175 | do_action( 'ep_sync_term_on_transition', $hierarchy_term_id ); |
| 177 | 176 | |
| 178 | - $this->sync_queue[ $hierarchy_term_id ] = true; | |
| 177 | + $this->add_to_queue( $hierarchy_term_id ); | |
| 179 | 178 | } |
| 180 | 179 | } |
| 181 | 180 | } |
| 182 | 181 | |
| @@ -191,9 +190,9 @@ | ||
| 191 | 190 | if ( $this->kill_sync() ) { |
| 192 | 191 | return; |
| 193 | 192 | } |
| 194 | 193 | |
| 195 | - $this->sync_queue[ $term_id ] = true; | |
| 194 | + $this->add_to_queue( $term_id ); | |
| 196 | 195 | } |
| 197 | 196 | |
| 198 | 197 | /** |
| 199 | 198 | * Delete term from ES when deleted in WP |
| @@ -213,9 +212,9 @@ | ||
| 213 | 212 | Indexables::factory()->get( 'term' )->delete( $term_id, false ); |
| 214 | 213 | } |
| 215 | 214 | |
| 216 | 215 | /** |
| 217 | - * Enqueue sync of children terms in hierchy when deleting parent. Children terms will be reasigned to | |
| 216 | + * Enqueue sync of children terms in hierarchy when deleting parent. Children terms will be reasigned to | |
| 218 | 217 | * a different parent and we want to reflect that change in ElasticSearch |
| 219 | 218 | * |
| 220 | 219 | * @param int $term_id Term ID. |
| 221 | 220 | * @since 3.6.3 |
| @@ -241,9 +240,8 @@ | ||
| 241 | 240 | } |
| 242 | 241 | |
| 243 | 242 | do_action( 'ep_sync_term_on_transition', $hierarchy_term_id ); |
| 244 | 243 | |
| 245 | - $this->sync_queue[ $hierarchy_term_id ] = true; | |
| 244 | + $this->add_to_queue( $hierarchy_term_id ); | |
| 246 | 245 | } |
| 247 | 246 | } |
| 248 | - | |
| 249 | 247 | } |