PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 4.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v4.2
6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 5.2.2 5.3 All 153 releases
← All changes | class/class-mainwp-wp-cli-command.php +20 -46 5.04.2 View file →
@@ -139,49 +139,26 @@
139 139 public function site( $args, $assoc_args ) {
140 140 MainWP_WP_CLI_Handle::handle_cli_callback( 'site', $args, $assoc_args );
141 141 }
142 142
143 -
144 143 /**
145 144 * Updates commands.
146 145 *
147 146 * ## OPTIONS
148 147 *
149 - * [--available-updates <websiteid>]
148 + * [--available-updates]
150 149 * : Get available updates
151 150 *
152 - * [--ignored-plugins-updates <websiteid>]
151 + * [--ignored-plugins-updates]
153 152 * : If set, get ignored plugins updates.
154 153 *
155 - * [--site-ignored-plugins-updates <websiteid>]
156 - * : If set, get ignored plugins updates of site.
157 154 *
158 - * [--ignored-themes-updates <websiteid>]
159 - * : If set, get ignored themes updates.
160 - *
161 - * [--site-ignored-themes-updates <websiteid>]
162 - * : If set, get ignored themes updates of site.
163 - *
164 - * [--ignore-updates --type=[type] --slug=[slug]]
165 - * : If set, ignored updates.
166 - *
167 - * [--ignore-update <websiteid> --type=[type] --slug=[slug]]
168 - * : If set, ignored update.
169 - *
170 - * [--unignore-updates --type=[type] --slug=[slug]]
171 - * : If set, unignore updates.
172 - *
173 - * [--unignore-update <websiteid> --type=[type] --slug=[slug]]
174 - * : If set, unignore update.
175 - *
176 - *
177 155 * ## EXAMPLES
178 156 *
179 157 * wp mainwp updates --available-updates
180 158 * wp mainwp updates --ignored-plugins-updates
181 - * wp mainwp updates --site-ignored-plugins-updates 3
182 159 *
183 - * ## Synopsis [--available-updates] [--ignored-plugins-updates] [--site-ignored-plugins-updates] [...]
160 + * ## Synopsis [--available-updates] [--ignored-plugins-updates] [...]
184 161 *
185 162 * @param array $args Function arguments.
186 163 * @param array $assoc_args Function associate arguments.
187 164 */
@@ -229,13 +206,9 @@
229 206 $sites[] = trim( $arg );
230 207 }
231 208 }
232 209
233 - if ( is_array( $assoc_args ) && isset( $assoc_args['all'] ) ) {
234 - update_option( 'mainwp_last_synced_all_sites', time() );
235 - }
236 -
237 - if ( 0 === count( $sites ) && ( ! isset( $assoc_args['all'] ) ) ) {
210 + if ( ( count( $sites ) == 0 ) && ( ! isset( $assoc_args['all'] ) ) ) {
238 211 \WP_CLI::error( 'Please specify one or more child sites, or use --all.' );
239 212 }
240 213 MainWP_WP_CLI_Handle::handle_sync_sites( $args, $assoc_args );
241 214 }
@@ -276,9 +249,9 @@
276 249 $sites[] = trim( $arg );
277 250 }
278 251 }
279 252
280 - if ( 0 === count( $sites ) ) {
253 + if ( count( $sites ) == 0 ) {
281 254 \WP_CLI::error( 'Please specify one or more child sites.' );
282 255 }
283 256
284 257 $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, true ) );
@@ -294,13 +267,13 @@
294 267 if ( MainWP_Manage_Sites_View::m_reconnect_site( $website ) ) {
295 268 \WP_CLI::success( ' Reconnected successfully' );
296 269 } else {
297 270 \WP_CLI::warning( ' Reconnect failed' );
298 - ++$warnings;
271 + $warnings++;
299 272 }
300 273 } catch ( \Exception $e ) {
301 274 \WP_CLI::error( ' Reconnect failed: ' . MainWP_Error_Helper::get_console_error_message( $e ) );
302 - ++$errors;
275 + $errors++;
303 276 }
304 277 }
305 278 MainWP_DB::free_result( $websites );
306 279 if ( 0 < $errors ) {
@@ -444,14 +417,14 @@
444 417 }
445 418
446 419 $i = 0;
447 420 foreach ( $website_to_upgrade['plugins'] as $plugin_to_upgrade ) {
448 - if ( 0 === $i ) {
421 + if ( 0 == $i ) {
449 422 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $pluginLength . 's | %-' . $oldVersionLength . 's | %-' . $newVersionLength . 's |', $website_to_upgrade['id'], $website_to_upgrade['name'], $plugin_to_upgrade['name'], $plugin_to_upgrade['version'], $plugin_to_upgrade['new_version'] ) );
450 423 } else {
451 424 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $pluginLength . 's | %-' . $oldVersionLength . 's | %-' . $newVersionLength . 's |', '', '', $plugin_to_upgrade['name'], $plugin_to_upgrade['version'], $plugin_to_upgrade['new_version'] ) );
452 425 }
453 - ++$i;
426 + $i++;
454 427 }
455 428 }
456 429
457 430 \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $pluginLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . "s+%'--" . ( $newVersionLength + 2 ) . 's+', '', '', '', '', '' ) );
@@ -516,14 +489,14 @@
516 489 }
517 490
518 491 $i = 0;
519 492 foreach ( $website_item['plugins'] as $plugin_item ) {
520 - if ( 0 === $i ) {
493 + if ( 0 == $i ) {
521 494 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $pluginLength . 's | %-' . $oldVersionLength . 's |', $website_item['id'], $website_item['name'], $plugin_item['name'], $plugin_item['version'] ) );
522 495 } else {
523 496 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $pluginLength . 's | %-' . $oldVersionLength . 's |', '', '', $plugin_item['name'], $plugin_item['version'] ) );
524 497 }
525 - ++$i;
498 + $i++;
526 499 }
527 500 }
528 501
529 502 \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $pluginLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . 's+', '', '', '', '' ) );
@@ -562,9 +535,9 @@
562 535
563 536 $tmp[] = $key;
564 537 }
565 538
566 - if ( 0 === count( $tmp ) ) {
539 + if ( count( $tmp ) == 0 ) {
567 540 \WP_CLI::line( 'No available plugin updates for ' . $website->name );
568 541
569 542 continue;
570 543 }
@@ -575,9 +548,9 @@
575 548 MainWP_Updates_Handler::upgrade_plugin_theme_translation( $website->id, 'plugin', implode( ',', $tmp ) );
576 549 \WP_CLI::success( 'Updates completed' );
577 550 } catch ( \Exception $e ) {
578 551 \WP_CLI::error( 'Updates failed: ' . MainWP_Error_Helper::get_console_error_message( $e ) );
579 - if ( $e->getMesage() === 'WPERROR' ) {
552 + if ( $e->getMesage() == 'WPERROR' ) {
580 553 \WP_CLI::debug( 'Error: ' . MainWP_Utility::value_to_string( $e->get_message_extra(), 1 ) );
581 554 }
582 555 }
583 556 }
@@ -715,14 +688,14 @@
715 688 }
716 689
717 690 $i = 0;
718 691 foreach ( $website_to_upgrade['themes'] as $theme_to_upgrade ) {
719 - if ( 0 === $i ) {
692 + if ( 0 == $i ) {
720 693 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $themeLength . 's | %-' . $oldVersionLength . 's | %-' . $newVersionLength . 's |', $website_to_upgrade['id'], $website_to_upgrade['name'], $theme_to_upgrade['name'], $theme_to_upgrade['version'], $theme_to_upgrade['new_version'] ) );
721 694 } else {
722 695 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $themeLength . 's | %-' . $oldVersionLength . 's | %-' . $newVersionLength . 's |', '', '', $theme_to_upgrade['name'], $theme_to_upgrade['version'], $theme_to_upgrade['new_version'] ) );
723 696 }
724 - ++$i;
697 + $i++;
725 698 }
726 699 }
727 700
728 701 \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $themeLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . "s+%'--" . ( $newVersionLength + 2 ) . 's+', '', '', '', '', '' ) );
@@ -788,14 +761,14 @@
788 761 }
789 762
790 763 $i = 0;
791 764 foreach ( $website_item['themes'] as $theme_item ) {
792 - if ( 0 === $i ) {
765 + if ( 0 == $i ) {
793 766 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $themeLength . 's | %-' . $activeLength . 's | %-' . $oldVersionLength . 's |', $website_item['id'], $website_item['name'], $theme_item['name'], $theme_item['active'], $theme_item['version'] ) );
794 767 } else {
795 768 \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $themeLength . 's | %-' . $activeLength . 's | %-' . $oldVersionLength . 's |', '', '', $theme_item['name'], $theme_item['active'], $theme_item['version'] ) );
796 769 }
797 - ++$i;
770 + $i++;
798 771 }
799 772 }
800 773
801 774 \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $themeLength + 2 ) . "s+%'--" . ( $activeLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . 's+', '', '', '', '', '' ) );
@@ -834,9 +807,9 @@
834 807
835 808 $tmp[] = $key;
836 809 }
837 810
838 - if ( 0 === count( $tmp ) ) {
811 + if ( count( $tmp ) == 0 ) {
839 812 \WP_CLI::line( 'No available theme updates for ' . $website->name );
840 813
841 814 continue;
842 815 }
@@ -847,9 +820,9 @@
847 820 MainWP_Updates_Handler::upgrade_plugin_theme_translation( $website->id, 'theme', implode( ',', $tmp ) );
848 821 \WP_CLI::success( 'Updates completed' );
849 822 } catch ( \Exception $e ) {
850 823 \WP_CLI::error( 'Updates failed: ' . MainWP_Error_Helper::get_console_error_message( $e ) );
851 - if ( $e->getMesage() === 'WPERROR' ) {
824 + if ( $e->getMesage() == 'WPERROR' ) {
852 825 \WP_CLI::debug( 'Error: ' . MainWP_Utility::value_to_string( $e->get_message_extra(), 1 ) );
853 826 }
854 827 }
855 828 }
@@ -855,5 +828,6 @@
855 828 }
856 829 }
857 830 }
858 831 }
832 +
859 833 }