| @@ -703,10 +703,11 @@ | ||
| 703 | 703 | } |
| 704 | 704 | $website = MainWP_DB::instance()->get_website_by_id( $websiteId ); |
| 705 | 705 | try { |
| 706 | 706 | $info = array( |
| 707 | - 'result' => array(), | |
| 708 | - 'result_error' => array(), | |
| 707 | + 'result' => array(), | |
| 708 | + 'result_error' => array(), | |
| 709 | + 'result_started' => array(), | |
| 709 | 710 | ); |
| 710 | 711 | |
| 711 | 712 | $result = MainWP_Updates_Handler::upgrade_plugin_theme_translation( $websiteId, sanitize_text_field( wp_unslash( $_POST['type'] ) ), $slugs ); // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 712 | 713 | |
| @@ -715,8 +716,25 @@ | ||
| 715 | 716 | $info['result'] = $result['result']; |
| 716 | 717 | } |
| 717 | 718 | if ( isset( $result['result_error'] ) ) { |
| 718 | 719 | $info['result_error'] = $result['result_error']; |
| 720 | + } | |
| 721 | + // for backward compatibility. | |
| 722 | + if ( isset( $result['result_started'] ) ) { | |
| 723 | + $info['result_started'] = $result['result_started']; | |
| 724 | + } | |
| 725 | + } | |
| 726 | + | |
| 727 | + // MWP-1660: append a generic licensing hint to failures of known premium | |
| 728 | + // products; vendors only deliver update packages to licensed installs. | |
| 729 | + $item_type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification | |
| 730 | + if ( ( 'plugin' === $item_type || 'theme' === $item_type ) && ! empty( $info['result_error'] ) && is_array( $info['result_error'] ) ) { | |
| 731 | + $premium_ids = MainWP_Premium_Update_Registry::get_filter_defaults( $item_type, 'detect' ); | |
| 732 | + $premium_prefixes = MainWP_Premium_Update_Registry::get_prefixes( $item_type, 'detect' ); | |
| 733 | + foreach ( $info['result_error'] as $err_slug => $err_msg ) { | |
| 734 | + if ( is_string( $err_msg ) && MainWP_Premium_Update_Registry::slug_matches( urldecode( $err_slug ), $premium_ids, $premium_prefixes ) ) { | |
| 735 | + $info['result_error'][ $err_slug ] = $err_msg . ' ' . esc_html__( 'Premium updates usually require an active license on the child site; check that first.', 'mainwp' ); | |
| 736 | + } | |
| 719 | 737 | } |
| 720 | 738 | } |
| 721 | 739 | |
| 722 | 740 | if ( $chunk_support && ( ! empty( $chunk_slugs ) ) ) { |