| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | namespace Elementor\App\Modules\ImportExport; |
| 3 | 4 | |
| 4 | 5 | use Elementor\Core\Utils\Collection; |
| 5 | 6 | use Elementor\Core\Utils\Plugins_Manager; |
| @@ -6,9 +7,9 @@ | ||
| 6 | 7 | use Elementor\Plugin; |
| 7 | 8 | use Elementor\App\Modules\KitLibrary\Connect\Kit_Library; |
| 8 | 9 | |
| 9 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; // Exit if accessed directly. | |
| 11 | + exit; // Exit if accessed directly | |
| 11 | 12 | } |
| 12 | 13 | |
| 13 | 14 | class Wp_Cli extends \WP_CLI_Command { |
| 14 | 15 | |
| @@ -96,9 +97,9 @@ | ||
| 96 | 97 | * @param array $args |
| 97 | 98 | * @param array $assoc_args |
| 98 | 99 | */ |
| 99 | 100 | public function import( array $args, array $assoc_args ) { |
| 100 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 101 | + if ( ! current_user_can( 'administrator' ) ) { | |
| 101 | 102 | \WP_CLI::error( 'You must run this command as an admin user' ); |
| 102 | 103 | } |
| 103 | 104 | |
| 104 | 105 | if ( empty( $args[0] ) ) { |
| @@ -180,9 +181,9 @@ | ||
| 180 | 181 | \WP_CLI::line( 'Removing temp files...' ); |
| 181 | 182 | |
| 182 | 183 | // The file was created from remote or library request, it also should be removed. |
| 183 | 184 | if ( $url ) { |
| 184 | - Plugin::$instance->uploads_manager->remove_file_or_dir( dirname( $zip_path ) ); | |
| 185 | + Plugin::$instance->uploads_manager->remove_temp_file_or_dir( dirname( $zip_path ) ); | |
| 185 | 186 | } |
| 186 | 187 | |
| 187 | 188 | \WP_CLI::success( 'Kit imported successfully' ); |
| 188 | 189 | } catch ( \Error $error ) { |
| @@ -192,9 +193,9 @@ | ||
| 192 | 193 | ], |
| 193 | 194 | ] ); |
| 194 | 195 | |
| 195 | 196 | if ( $url ) { |
| 196 | - Plugin::$instance->uploads_manager->remove_file_or_dir( dirname( $zip_path ) ); | |
| 197 | + Plugin::$instance->uploads_manager->remove_temp_file_or_dir( dirname( $zip_path ) ); | |
| 197 | 198 | } |
| 198 | 199 | |
| 199 | 200 | \WP_CLI::error( $error->getMessage() ); |
| 200 | 201 | } |