. * * ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗ * ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝ * ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝ * ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗ * ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗ * ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ */ if ( ! defined( 'ABSPATH' ) ) { die( 'Kangaroos cannot jump here' ); } class Ai1wm_Import_Check_Encryption { public static function execute( $params ) { // Read package.json file $handle = ai1wm_open( ai1wm_package_path( $params ), 'r' ); // Parse package.json file $package = ai1wm_read( $handle, filesize( ai1wm_package_path( $params ) ) ); $package = json_decode( $package, true ); // Close handle ai1wm_close( $handle ); if ( empty( $package['Encrypted'] ) || empty( $package['EncryptedSignature'] ) || ! empty( $params['is_decryption_password_valid'] ) ) { return $params; } if ( ! ai1wm_can_decrypt() ) { $message = __( 'Importing an encrypted backup is not supported on this server. Technical details', AI1WM_PLUGIN_NAME ); if ( defined( 'WP_CLI' ) ) { WP_CLI::error( $message ); } else { Ai1wm_Status::server_cannot_decrypt( $message ); exit; } } if ( defined( 'WP_CLI' ) ) { $message = __( 'Backup is encrypted. Please provide decryption password: ', AI1WM_PLUGIN_NAME ); $params['decryption_password'] = readline( $message ); return $params; } Ai1wm_Status::backup_is_encrypted( null ); exit; } }