| @@ -932,11 +932,15 @@ | ||
| 932 | 932 | 'pubkey' => $website->pubkey, |
| 933 | 933 | 'privkey' => is_array( $en_privkey ) ? base64_encode( json_encode( $en_privkey ) ) : base64_encode( $en_privkey ), //phpcs:ignore -- NOSONAR -ok. |
| 934 | 934 | 'verify_certificate' => $website->verify_certificate, |
| 935 | 935 | 'uniqueId' => ( null !== $website->uniqueId ? $website->uniqueId : '' ), |
| 936 | - 'http_user' => $website->http_user, | |
| 937 | - 'http_pass' => $website->http_pass, | |
| 936 | + // MWP-1548: decrypt the source's credentials and let | |
| 937 | + // update_website_values re-encrypt under a fresh keyfile, | |
| 938 | + // so the cloned site doesn't share the source row's file_key. | |
| 939 | + 'http_user' => MainWP_Credential_Storage::decrypt_credential( $website->http_user ), | |
| 940 | + 'http_pass' => MainWP_Credential_Storage::decrypt_credential( $website->http_pass ), | |
| 938 | 941 | 'ssl_version' => $website->ssl_version, |
| 942 | + 'force_use_ipv4' => $website->force_use_ipv4, | |
| 939 | 943 | ) |
| 940 | 944 | ); |
| 941 | 945 | } |
| 942 | 946 | $ret['siteid'] = $clone_site->id; |
| @@ -957,17 +961,21 @@ | ||
| 957 | 961 | 'groupids' => array(), |
| 958 | 962 | 'groupnames' => array(), |
| 959 | 963 | 'verifyCertificate' => $website->verify_certificate, |
| 960 | 964 | 'addUniqueId' => ( null !== $website->uniqueId ? $website->uniqueId : '' ), |
| 961 | - 'http_user' => $website->http_user, | |
| 962 | - 'http_pass' => $website->http_pass, | |
| 965 | + // MWP-1548: same pattern as the force_update branch above -- | |
| 966 | + // decrypt the source's credentials, let add_website re-encrypt | |
| 967 | + // for the new clone with a fresh keyfile. | |
| 968 | + 'http_user' => MainWP_Credential_Storage::decrypt_credential( $website->http_user ), | |
| 969 | + 'http_pass' => MainWP_Credential_Storage::decrypt_credential( $website->http_pass ), | |
| 963 | 970 | 'sslVersion' => $website->ssl_version, |
| 971 | + 'force_use_ipv4' => $website->force_use_ipv4, | |
| 964 | 972 | 'wpe' => $website->wpe, |
| 965 | 973 | 'isStaging' => 1, |
| 966 | 974 | ); |
| 967 | 975 | |
| 968 | 976 | $de_privkey = base64_decode( $website->privkey ); //phpcs:ignore -- NOSONAR -trust - compatible. |
| 969 | - $de_privkey = MainWP_Encrypt_Data_Lib::instance()->decrypt_privkey( $de_privkey, $site_id ); | |
| 977 | + $de_privkey = MainWP_Encrypt_Data_Lib::instance()->decrypt_privkey( $de_privkey, $website->id ); | |
| 970 | 978 | |
| 971 | 979 | if ( ! empty( $de_privkey ) ) { |
| 972 | 980 | $de_privkey = base64_encode( $de_privkey ); //phpcs:ignore -- NOSONAR -ok. |
| 973 | 981 | } else { |