| | |
| | | exit; |
| | | } |
| | | |
| | | use JVBase\managers\queue\Queue; |
| | | use JVBase\registrar\Registrar; |
| | | use WP_Error; |
| | | use Exception; |
| | |
| | | |
| | | public function processOperation(WP_Error $result, object $operation, array $data):WP_Error|array |
| | | { |
| | | switch ($operation->type) { |
| | | case 'sync_content_taxonomy_tables': |
| | | return $this->processContentTaxonomyTableSync($operation, $data); |
| | | default: |
| | | return $result; |
| | | } |
| | | return match ($operation->type) { |
| | | 'sync_content_taxonomy_tables' => $this->processContentTaxonomyTableSync($operation, $data), |
| | | default => $result, |
| | | }; |
| | | } |
| | | |
| | | public function processContentTaxonomyTableSync(object $operation, array $data):array |
| | | { |
| | | //TODO: This won't work currently |
| | | $taxonomy = $data['taxonomy']; |
| | | $registrar = new TaxonomyRegistrar($taxonomy, JVB_TAXONOMY[$taxonomy]); |
| | | $registrar = Registrar::getInstance($taxonomy); |
| | | $results = ['errors' => 0, 'success' => 0]; |
| | | foreach ($data['terms'] as $term) { |
| | | try { |