| @@ -100,8 +100,12 @@ | ||
| 100 | 100 | return $data; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | private function migrate_data( array &$data, string $meta_key ): void { |
| 104 | + if ( ! Migrations_Orchestrator::is_active() ) { | |
| 105 | + return; | |
| 106 | + } | |
| 107 | + | |
| 104 | 108 | $post_id = $this->post->ID; |
| 105 | 109 | |
| 106 | 110 | Migrations_Orchestrator::make()->migrate( |
| 107 | 111 | $data, |
| @@ -269,13 +273,9 @@ | ||
| 269 | 273 | |
| 270 | 274 | return false !== $result; |
| 271 | 275 | } |
| 272 | 276 | |
| 273 | - public function clone( Kit $target_kit ): ?self { | |
| 274 | - return self::clone_to_kit( $this->get_class_id(), $this, $target_kit ); | |
| 275 | - } | |
| 276 | - | |
| 277 | - public static function clone_to_other_kit( string $style_id, Kit $source_kit, Kit $target_kit ): ?self { | |
| 277 | + public static function clone_to_other_kit( string $style_id, Kit $source_kit, Kit $target_kit ): ?Global_Class_Post { | |
| 278 | 278 | $source_post = self::find_by_class_id( $style_id, false, $source_kit ); |
| 279 | 279 | |
| 280 | 280 | if ( ! $source_post ) { |
| 281 | 281 | return null; |
| @@ -280,12 +280,8 @@ | ||
| 280 | 280 | if ( ! $source_post ) { |
| 281 | 281 | return null; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - return self::clone_to_kit( $style_id, $source_post, $target_kit ); | |
| 285 | - } | |
| 286 | - | |
| 287 | - private static function clone_to_kit( string $style_id, self $source_post, Kit $target_kit ): ?self { | |
| 288 | 284 | $new_post_id = wp_insert_post( [ |
| 289 | 285 | 'post_type' => Global_Class_Post_Type::CPT, |
| 290 | 286 | 'post_title' => $source_post->get_label(), |
| 291 | 287 | 'post_status' => 'publish', |