@@ 315-321 (lines=7) @@ | ||
312 | * @param \WP_Upgrader $upgrader Core class to handle installation. |
|
313 | * @return \WP_Error|string |
|
314 | */ |
|
315 | private static function download_product( $product_id, $upgrader ) { |
|
316 | $steps = self::get_state( 'steps' ); |
|
317 | if ( empty( $steps[ $product_id ]['download_url'] ) ) { |
|
318 | return new WP_Error( 'missing_download_url', __( 'Could not find download url for the product.', 'woocommerce' ) ); |
|
319 | } |
|
320 | return $upgrader->download_package( $steps[ $product_id ]['download_url'] ); |
|
321 | } |
|
322 | ||
323 | /** |
|
324 | * Unpack downloaded product. |
|
@@ 331-338 (lines=8) @@ | ||
328 | * @param \WP_Upgrader $upgrader Core class to handle installation. |
|
329 | * @return \WP_Error|string |
|
330 | */ |
|
331 | private static function unpack_product( $product_id, $upgrader ) { |
|
332 | $steps = self::get_state( 'steps' ); |
|
333 | if ( empty( $steps[ $product_id ]['download_path'] ) ) { |
|
334 | return new WP_Error( 'missing_download_path', __( 'Could not find download path.', 'woocommerce' ) ); |
|
335 | } |
|
336 | ||
337 | return $upgrader->unpack_package( $steps[ $product_id ]['download_path'], true ); |
|
338 | } |
|
339 | ||
340 | /** |
|
341 | * Move product to plugins directory. |