PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.4
Elementor Website Builder – more than just a page builder v3.2.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | modules/wp-cli/command.php +14 -26 4.2.23.2.4 View file →
@@ -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,36 +34,30 @@
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 - $blog_ids = get_sites( [
48 - 'fields' => 'ids',
49 - 'number' => 0,
50 - ] );
40 + /** @var \WP_Site[] $blogs */
41 + $blogs = get_sites();
51 42
52 - foreach ( $blog_ids as $blog_id ) {
43 + foreach ( $blogs as $keys => $blog ) {
44 + // Cast $blog as an array instead of object
45 + $blog_id = $blog->blog_id;
46 +
53 47 switch_to_blog( $blog_id );
54 48
55 - $this->handle_flush( $should_regenerate, 'Flushed the Elementor CSS Cache for site - ' . get_option( 'home' ) );
49 + Plugin::$instance->files_manager->clear_cache();
56 50
51 + \WP_CLI::success( 'Flushed the Elementor CSS Cache for site - ' . get_option( 'home' ) );
52 +
57 53 restore_current_blog();
58 54 }
59 55 } else {
60 - $this->handle_flush( $should_regenerate, 'Flushed the Elementor CSS Cache' );
61 - }
62 - }
56 + Plugin::$instance->files_manager->clear_cache();
63 57
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();
58 + \WP_CLI::success( 'Flushed the Elementor CSS Cache' );
69 59 }
70 -
71 - \WP_CLI::success( $success_message );
72 60 }
73 61
74 62 /**
75 63 * Print system info powered by Elementor
@@ -90,9 +78,9 @@
90 78 /**
91 79 * Replace old URLs with new URLs in all Elementor pages.
92 80 *
93 81 * [--force]
94 - * Suppress error messages. instead, return "0 database rows affected.".
82 + * Suppress error messages. instead, return "0 affected rows.".
95 83 *
96 84 * ## EXAMPLES
97 85 *
98 86 * 1. wp elementor replace-urls <old> <new>
@@ -117,9 +105,9 @@
117 105 $results = Utils::replace_urls( $args[0], $args[1] );
118 106 \WP_CLI::success( $results );
119 107 } catch ( \Exception $e ) {
120 108 if ( isset( $assoc_args['force'] ) ) {
121 - \WP_CLI::success( '0 database rows affected.' );
109 + \WP_CLI::success( '0 rows affected.' );
122 110 } else {
123 111 \WP_CLI::error( $e->getMessage() );
124 112 }
125 113 }