| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | use Templately\Builder\Factory\TemplateFactory; |
| 7 | 7 | use Templately\Core\Importer\FullSiteImport; |
| 8 | 8 | use Templately\Core\Importer\Import; |
| 9 | 9 | use Templately\Core\Importer\LogHelper; |
| 10 | -use Templately\Core\Importer\Utils\AIUtils; | |
| 11 | 10 | use Templately\Core\Importer\Utils\ImportHelper; |
| 12 | 11 | use Templately\Core\Importer\Utils\Utils; |
| 13 | 12 | |
| 14 | 13 | abstract class BaseRunner { |
| @@ -22,19 +21,10 @@ | ||
| 22 | 21 | protected $dev_mode; |
| 23 | 22 | protected $origin; |
| 24 | 23 | protected $platform; |
| 25 | 24 | protected $manifest; |
| 26 | - protected $prv_dir; | |
| 27 | 25 | protected $dir_path; |
| 28 | 26 | protected $session_id; |
| 29 | - /** | |
| 30 | - * @var array|mixed | |
| 31 | - */ | |
| 32 | - public $ai_page_ids = []; | |
| 33 | - /** | |
| 34 | - * @var string|null | |
| 35 | - */ | |
| 36 | - public $process_id = null; | |
| 37 | 27 | |
| 38 | 28 | /** |
| 39 | 29 | * @var ImportHelper |
| 40 | 30 | */ |
| @@ -48,14 +38,13 @@ | ||
| 48 | 38 | /** |
| 49 | 39 | * @throws Exception |
| 50 | 40 | */ |
| 51 | 41 | public function __construct( $request_params ) { |
| 52 | - $this->dev_mode = defined('TEMPLATELY_DEV') && TEMPLATELY_DEV; | |
| 53 | - $this->origin = $request_params['origin']; | |
| 54 | - $this->prv_dir = $request_params['prv_dir']; | |
| 55 | - $this->dir_path = $request_params['dir_path']; | |
| 56 | - $this->manifest = &$request_params['manifest']; | |
| 57 | - $this->platform = $this->manifest['platform'] ?? ''; | |
| 42 | + $this->dev_mode = defined('TEMPLATELY_DEV') && TEMPLATELY_DEV; | |
| 43 | + $this->origin = $request_params['origin']; | |
| 44 | + $this->dir_path = $request_params['dir_path']; | |
| 45 | + $this->manifest = &$request_params['manifest']; | |
| 46 | + $this->platform = $this->manifest['platform'] ?? ''; | |
| 58 | 47 | $this->session_id = $request_params['session_id']; |
| 59 | 48 | |
| 60 | 49 | |
| 61 | 50 | $this->factory = new TemplateFactory( $this->platform ); |
| @@ -61,16 +50,8 @@ | ||
| 61 | 50 | $this->factory = new TemplateFactory( $this->platform ); |
| 62 | 51 | $this->json = Utils::get_json_helper( $this->platform ); |
| 63 | 52 | $this->json->session_id = $this->session_id; |
| 64 | 53 | |
| 65 | - // Normalize once here so every runner sees the canonical | |
| 66 | - // `type/sub_type => ['id',...]` shape. This value arrives from the import | |
| 67 | - // FormData (a JSON string), session data, or the manifest, and consumers | |
| 68 | - // index into it in ways that either throw or silently miss pages when the | |
| 69 | - // shape differs. See AIUtils::normalize_ai_page_ids(). | |
| 70 | - $this->ai_page_ids = AIUtils::normalize_ai_page_ids( $request_params['ai_page_ids'] ?? [] ); | |
| 71 | - $this->process_id = $request_params['process_id'] ?? null; | |
| 72 | - | |
| 73 | 54 | if ( empty( $this->platform ) ) { |
| 74 | 55 | throw new Exception( __( 'Platform is not specified. Please try again after specifying the platform.', 'templately' ) ); |
| 75 | 56 | } |
| 76 | 57 | } |
| @@ -116,17 +97,6 @@ | ||
| 116 | 97 | if ($this->dev_mode) { |
| 117 | 98 | error_log(print_r($message, 1)); |
| 118 | 99 | } |
| 119 | 100 | throw new Exception($message); |
| 120 | - } | |
| 121 | - | |
| 122 | - protected function is_ai_content($old_template_id ): bool { | |
| 123 | - if(empty($this->process_id) || empty($this->ai_page_ids)){ | |
| 124 | - return false; | |
| 125 | - } | |
| 126 | - | |
| 127 | - // $this->ai_page_ids is already normalized in the constructor, so this is | |
| 128 | - // a plain flatten + strict membership test. It used to array_reduce with | |
| 129 | - // 'array_merge', which throws a TypeError if any group value is a scalar. | |
| 130 | - return AIUtils::is_ai_content($old_template_id, $this->ai_page_ids); | |
| 131 | 101 | } |
| 132 | 102 | } |