| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | use Elementor\TemplateLibrary\Source_Local; |
| 7 | 7 | use Elementor\Utils; |
| 8 | 8 | |
| 9 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | - exit; // Exit if accessed directly. | |
| 10 | + exit; // Exit if accessed directly | |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Elementor Page Builder cli tools. |
| @@ -20,11 +20,8 @@ | ||
| 20 | 20 | * |
| 21 | 21 | * [--network] |
| 22 | 22 | * Flush CSS Cache for all the sites in the network. |
| 23 | 23 | * |
| 24 | - * [--regenerate] | |
| 25 | - * Re-create the CSS files. Otherwise they will be created by a page visit. | |
| 26 | - * | |
| 27 | 24 | * ## EXAMPLES |
| 28 | 25 | * |
| 29 | 26 | * 1. wp elementor flush-css |
| 30 | 27 | * - This will flush the CSS files for elementor page builder. |
| @@ -31,11 +28,8 @@ | ||
| 31 | 28 | * |
| 32 | 29 | * 2. wp elementor flush-css --network |
| 33 | 30 | * - This will flush the CSS files for elementor page builder for all the sites in the network. |
| 34 | 31 | * |
| 35 | - * 3. wp elementor flush-css --regenerate | |
| 36 | - * - This will flush the CSS files for elementor page builder and re-create the new CSS files. | |
| 37 | - * | |
| 38 | 32 | * @since 2.1.0 |
| 39 | 33 | * @access public |
| 40 | 34 | * @alias flush-css |
| 41 | 35 | */ |
| @@ -40,9 +34,8 @@ | ||
| 40 | 34 | * @alias flush-css |
| 41 | 35 | */ |
| 42 | 36 | public function flush_css( $args, $assoc_args ) { |
| 43 | 37 | $network = ! empty( $assoc_args['network'] ) && is_multisite(); |
| 44 | - $should_regenerate = ! empty( $assoc_args['regenerate'] ); | |
| 45 | 38 | |
| 46 | 39 | if ( $network ) { |
| 47 | 40 | $blog_ids = get_sites( [ |
| 48 | 41 | 'fields' => 'ids', |
| @@ -51,25 +44,19 @@ | ||
| 51 | 44 | |
| 52 | 45 | foreach ( $blog_ids as $blog_id ) { |
| 53 | 46 | switch_to_blog( $blog_id ); |
| 54 | 47 | |
| 55 | - $this->handle_flush( $should_regenerate, 'Flushed the Elementor CSS Cache for site - ' . get_option( 'home' ) ); | |
| 48 | + Plugin::$instance->files_manager->clear_cache(); | |
| 56 | 49 | |
| 50 | + \WP_CLI::success( 'Flushed the Elementor CSS Cache for site - ' . get_option( 'home' ) ); | |
| 51 | + | |
| 57 | 52 | restore_current_blog(); |
| 58 | 53 | } |
| 59 | 54 | } else { |
| 60 | - $this->handle_flush( $should_regenerate, 'Flushed the Elementor CSS Cache' ); | |
| 61 | - } | |
| 62 | - } | |
| 55 | + Plugin::$instance->files_manager->clear_cache(); | |
| 63 | 56 | |
| 64 | - private function handle_flush( bool $should_regenerate, string $success_message ): void { | |
| 65 | - Plugin::$instance->files_manager->clear_cache(); | |
| 66 | - | |
| 67 | - if ( $should_regenerate ) { | |
| 68 | - Plugin::$instance->files_manager->generate_css(); | |
| 57 | + \WP_CLI::success( 'Flushed the Elementor CSS Cache' ); | |
| 69 | 58 | } |
| 70 | - | |
| 71 | - \WP_CLI::success( $success_message ); | |
| 72 | 59 | } |
| 73 | 60 | |
| 74 | 61 | /** |
| 75 | 62 | * Print system info powered by Elementor |
| @@ -90,9 +77,9 @@ | ||
| 90 | 77 | /** |
| 91 | 78 | * Replace old URLs with new URLs in all Elementor pages. |
| 92 | 79 | * |
| 93 | 80 | * [--force] |
| 94 | - * Suppress error messages. instead, return "0 database rows affected.". | |
| 81 | + * Suppress error messages. instead, return "0 affected rows.". | |
| 95 | 82 | * |
| 96 | 83 | * ## EXAMPLES |
| 97 | 84 | * |
| 98 | 85 | * 1. wp elementor replace-urls <old> <new> |
| @@ -117,9 +104,9 @@ | ||
| 117 | 104 | $results = Utils::replace_urls( $args[0], $args[1] ); |
| 118 | 105 | \WP_CLI::success( $results ); |
| 119 | 106 | } catch ( \Exception $e ) { |
| 120 | 107 | if ( isset( $assoc_args['force'] ) ) { |
| 121 | - \WP_CLI::success( '0 database rows affected.' ); | |
| 108 | + \WP_CLI::success( '0 rows affected.' ); | |
| 122 | 109 | } else { |
| 123 | 110 | \WP_CLI::error( $e->getMessage() ); |
| 124 | 111 | } |
| 125 | 112 | } |