| @@ -2,13 +2,11 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Templately\Core\Importer; |
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | -use Templately\Core\Importer\Exception\NonRetirableErrorException; | |
| 7 | 6 | use Templately\Core\Importer\Runners\AIContent; |
| 8 | 7 | use Templately\Core\Importer\Runners\Attachments; |
| 9 | 8 | use Templately\Core\Importer\Runners\BaseRunner; |
| 10 | -use Templately\Core\Importer\Runners\CustomCSS; | |
| 11 | 9 | use Templately\Core\Importer\Runners\Customizer; |
| 12 | 10 | use Templately\Core\Importer\Runners\Dependencies; |
| 13 | 11 | use Templately\Core\Importer\Runners\ElementorContent; |
| 14 | 12 | use Templately\Core\Importer\Runners\ExtraContent; |
| @@ -53,9 +51,8 @@ | ||
| 53 | 51 | // TODO: Site Settings Import Runner |
| 54 | 52 | new Dependencies( $this->request_params ), |
| 55 | 53 | new Attachments( $this->request_params ), |
| 56 | 54 | new Customizer( $this->request_params ), |
| 57 | - new CustomCSS( $this->request_params ), | |
| 58 | 55 | new ExtraContent( $this->request_params ), |
| 59 | 56 | new Templates( $this->request_params ), |
| 60 | 57 | new GutenbergContent( $this->request_params ), |
| 61 | 58 | new ElementorContent( $this->request_params ), |
| @@ -62,10 +59,8 @@ | ||
| 62 | 59 | new WPContent( $this->request_params ), |
| 63 | 60 | // new AIContent( $this->request_params ), |
| 64 | 61 | new Finalizer( $this->request_params ) |
| 65 | 62 | ]; |
| 66 | - | |
| 67 | - $this->runners = apply_filters( 'templately_import_runners', $this->runners, $this->request_params ); | |
| 68 | 63 | } |
| 69 | 64 | |
| 70 | 65 | public function run( $callable = null ): array { |
| 71 | 66 | $data = $this->request_params; |
| @@ -80,14 +75,16 @@ | ||
| 80 | 75 | $import = []; |
| 81 | 76 | |
| 82 | 77 | try{ |
| 83 | 78 | if ( $runner->should_run( $data, $imported_data ) ) { |
| 84 | - if (!$this->is_key_processed($runner->get_name(), 'runner_start')) { | |
| 79 | + $progress = $this->get_progress(); | |
| 80 | + if(!in_array($runner->get_name(), $progress)){ | |
| 85 | 81 | $runner->log( 0 ); |
| 86 | - $this->mark_key_processed($runner->get_name(), 'runner_start'); | |
| 82 | + $progress[] = $runner->get_name(); | |
| 83 | + $this->update_progress( $progress); | |
| 87 | 84 | } |
| 88 | 85 | $import = $runner->import( $data, $imported_data ); |
| 89 | - $imported_data = array_merge( $imported_data, $import ); | |
| 86 | + $imported_data = array_merge_recursive( $imported_data, $import ); | |
| 90 | 87 | |
| 91 | 88 | if( $runner->get_name() != 'finalize' ) { |
| 92 | 89 | $runner->log( 100 ); |
| 93 | 90 | } else { |
| @@ -95,13 +92,8 @@ | ||
| 95 | 92 | } |
| 96 | 93 | } |
| 97 | 94 | }catch (Exception $e){ |
| 98 | 95 | error_log($e->getMessage()); |
| 99 | - | |
| 100 | - // Re-throw NonRetirableErrorException to stop the import process | |
| 101 | - if ($e instanceof NonRetirableErrorException) { | |
| 102 | - throw $e; | |
| 103 | - } | |
| 104 | 96 | } |
| 105 | 97 | |
| 106 | 98 | return $imported_data; |
| 107 | 99 | }, null, true); |