| @@ -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] ) ) { |
| @@ -185,14 +186,8 @@ | ||
| 185 | 186 | } |
| 186 | 187 | |
| 187 | 188 | \WP_CLI::success( 'Kit imported successfully' ); |
| 188 | 189 | } catch ( \Error $error ) { |
| 189 | - Plugin::$instance->logger->get_logger()->error( $error->getMessage(), [ | |
| 190 | - 'meta' => [ | |
| 191 | - 'trace' => $error->getTraceAsString(), | |
| 192 | - ], | |
| 193 | - ] ); | |
| 194 | - | |
| 195 | 190 | if ( $url ) { |
| 196 | 191 | Plugin::$instance->uploads_manager->remove_file_or_dir( dirname( $zip_path ) ); |
| 197 | 192 | } |
| 198 | 193 | |
| @@ -276,5 +271,15 @@ | ||
| 276 | 271 | Plugin::$instance->uploads_manager->set_elementor_upload_state( false ); |
| 277 | 272 | |
| 278 | 273 | return $file; |
| 279 | 274 | } |
| 275 | + | |
| 276 | + /** | |
| 277 | + * Handle the import process of plugins. | |
| 278 | + * | |
| 279 | + * Returns a string contains the successfully installed and activated plugins. | |
| 280 | + * | |
| 281 | + * @param array $plugins | |
| 282 | + * @return string | |
| 283 | + */ | |
| 284 | + | |
| 280 | 285 | } |