| @@ -229,13 +229,9 @@ | ||
| 229 | 229 | $sites[] = trim( $arg ); |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
| 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'] ) ) ) { | |
| 233 | + if ( ( count( $sites ) == 0 ) && ( ! isset( $assoc_args['all'] ) ) ) { | |
| 238 | 234 | \WP_CLI::error( 'Please specify one or more child sites, or use --all.' ); |
| 239 | 235 | } |
| 240 | 236 | MainWP_WP_CLI_Handle::handle_sync_sites( $args, $assoc_args ); |
| 241 | 237 | } |
| @@ -276,9 +272,9 @@ | ||
| 276 | 272 | $sites[] = trim( $arg ); |
| 277 | 273 | } |
| 278 | 274 | } |
| 279 | 275 | |
| 280 | - if ( 0 === count( $sites ) ) { | |
| 276 | + if ( count( $sites ) == 0 ) { | |
| 281 | 277 | \WP_CLI::error( 'Please specify one or more child sites.' ); |
| 282 | 278 | } |
| 283 | 279 | |
| 284 | 280 | $websites = MainWP_DB::instance()->query( MainWP_DB::instance()->get_sql_websites_for_current_user( false, null, 'wp.url', false, false, null, true ) ); |
| @@ -294,13 +290,13 @@ | ||
| 294 | 290 | if ( MainWP_Manage_Sites_View::m_reconnect_site( $website ) ) { |
| 295 | 291 | \WP_CLI::success( ' Reconnected successfully' ); |
| 296 | 292 | } else { |
| 297 | 293 | \WP_CLI::warning( ' Reconnect failed' ); |
| 298 | - ++$warnings; | |
| 294 | + $warnings++; | |
| 299 | 295 | } |
| 300 | 296 | } catch ( \Exception $e ) { |
| 301 | 297 | \WP_CLI::error( ' Reconnect failed: ' . MainWP_Error_Helper::get_console_error_message( $e ) ); |
| 302 | - ++$errors; | |
| 298 | + $errors++; | |
| 303 | 299 | } |
| 304 | 300 | } |
| 305 | 301 | MainWP_DB::free_result( $websites ); |
| 306 | 302 | if ( 0 < $errors ) { |
| @@ -444,14 +440,14 @@ | ||
| 444 | 440 | } |
| 445 | 441 | |
| 446 | 442 | $i = 0; |
| 447 | 443 | foreach ( $website_to_upgrade['plugins'] as $plugin_to_upgrade ) { |
| 448 | - if ( 0 === $i ) { | |
| 444 | + if ( 0 == $i ) { | |
| 449 | 445 | \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 | 446 | } else { |
| 451 | 447 | \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 | 448 | } |
| 453 | - ++$i; | |
| 449 | + $i++; | |
| 454 | 450 | } |
| 455 | 451 | } |
| 456 | 452 | |
| 457 | 453 | \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $pluginLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . "s+%'--" . ( $newVersionLength + 2 ) . 's+', '', '', '', '', '' ) ); |
| @@ -516,14 +512,14 @@ | ||
| 516 | 512 | } |
| 517 | 513 | |
| 518 | 514 | $i = 0; |
| 519 | 515 | foreach ( $website_item['plugins'] as $plugin_item ) { |
| 520 | - if ( 0 === $i ) { | |
| 516 | + if ( 0 == $i ) { | |
| 521 | 517 | \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 | 518 | } else { |
| 523 | 519 | \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $pluginLength . 's | %-' . $oldVersionLength . 's |', '', '', $plugin_item['name'], $plugin_item['version'] ) ); |
| 524 | 520 | } |
| 525 | - ++$i; | |
| 521 | + $i++; | |
| 526 | 522 | } |
| 527 | 523 | } |
| 528 | 524 | |
| 529 | 525 | \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $pluginLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . 's+', '', '', '', '' ) ); |
| @@ -562,9 +558,9 @@ | ||
| 562 | 558 | |
| 563 | 559 | $tmp[] = $key; |
| 564 | 560 | } |
| 565 | 561 | |
| 566 | - if ( 0 === count( $tmp ) ) { | |
| 562 | + if ( count( $tmp ) == 0 ) { | |
| 567 | 563 | \WP_CLI::line( 'No available plugin updates for ' . $website->name ); |
| 568 | 564 | |
| 569 | 565 | continue; |
| 570 | 566 | } |
| @@ -575,9 +571,9 @@ | ||
| 575 | 571 | MainWP_Updates_Handler::upgrade_plugin_theme_translation( $website->id, 'plugin', implode( ',', $tmp ) ); |
| 576 | 572 | \WP_CLI::success( 'Updates completed' ); |
| 577 | 573 | } catch ( \Exception $e ) { |
| 578 | 574 | \WP_CLI::error( 'Updates failed: ' . MainWP_Error_Helper::get_console_error_message( $e ) ); |
| 579 | - if ( $e->getMesage() === 'WPERROR' ) { | |
| 575 | + if ( $e->getMesage() == 'WPERROR' ) { | |
| 580 | 576 | \WP_CLI::debug( 'Error: ' . MainWP_Utility::value_to_string( $e->get_message_extra(), 1 ) ); |
| 581 | 577 | } |
| 582 | 578 | } |
| 583 | 579 | } |
| @@ -715,14 +711,14 @@ | ||
| 715 | 711 | } |
| 716 | 712 | |
| 717 | 713 | $i = 0; |
| 718 | 714 | foreach ( $website_to_upgrade['themes'] as $theme_to_upgrade ) { |
| 719 | - if ( 0 === $i ) { | |
| 715 | + if ( 0 == $i ) { | |
| 720 | 716 | \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 | 717 | } else { |
| 722 | 718 | \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 | 719 | } |
| 724 | - ++$i; | |
| 720 | + $i++; | |
| 725 | 721 | } |
| 726 | 722 | } |
| 727 | 723 | |
| 728 | 724 | \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $themeLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . "s+%'--" . ( $newVersionLength + 2 ) . 's+', '', '', '', '', '' ) ); |
| @@ -788,14 +784,14 @@ | ||
| 788 | 784 | } |
| 789 | 785 | |
| 790 | 786 | $i = 0; |
| 791 | 787 | foreach ( $website_item['themes'] as $theme_item ) { |
| 792 | - if ( 0 === $i ) { | |
| 788 | + if ( 0 == $i ) { | |
| 793 | 789 | \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 | 790 | } else { |
| 795 | 791 | \WP_CLI::line( sprintf( '| %-' . $idLength . 's | %-' . $nameLength . 's | %-' . $themeLength . 's | %-' . $activeLength . 's | %-' . $oldVersionLength . 's |', '', '', $theme_item['name'], $theme_item['active'], $theme_item['version'] ) ); |
| 796 | 792 | } |
| 797 | - ++$i; | |
| 793 | + $i++; | |
| 798 | 794 | } |
| 799 | 795 | } |
| 800 | 796 | |
| 801 | 797 | \WP_CLI::line( sprintf( "+%'--" . ( $idLength + 2 ) . "s+%'--" . ( $nameLength + 2 ) . "s+%'--" . ( $themeLength + 2 ) . "s+%'--" . ( $activeLength + 2 ) . "s+%'--" . ( $oldVersionLength + 2 ) . 's+', '', '', '', '', '' ) ); |
| @@ -834,9 +830,9 @@ | ||
| 834 | 830 | |
| 835 | 831 | $tmp[] = $key; |
| 836 | 832 | } |
| 837 | 833 | |
| 838 | - if ( 0 === count( $tmp ) ) { | |
| 834 | + if ( count( $tmp ) == 0 ) { | |
| 839 | 835 | \WP_CLI::line( 'No available theme updates for ' . $website->name ); |
| 840 | 836 | |
| 841 | 837 | continue; |
| 842 | 838 | } |
| @@ -847,9 +843,9 @@ | ||
| 847 | 843 | MainWP_Updates_Handler::upgrade_plugin_theme_translation( $website->id, 'theme', implode( ',', $tmp ) ); |
| 848 | 844 | \WP_CLI::success( 'Updates completed' ); |
| 849 | 845 | } catch ( \Exception $e ) { |
| 850 | 846 | \WP_CLI::error( 'Updates failed: ' . MainWP_Error_Helper::get_console_error_message( $e ) ); |
| 851 | - if ( $e->getMesage() === 'WPERROR' ) { | |
| 847 | + if ( $e->getMesage() == 'WPERROR' ) { | |
| 852 | 848 | \WP_CLI::debug( 'Error: ' . MainWP_Utility::value_to_string( $e->get_message_extra(), 1 ) ); |
| 853 | 849 | } |
| 854 | 850 | } |
| 855 | 851 | } |
| @@ -855,5 +851,6 @@ | ||
| 855 | 851 | } |
| 856 | 852 | } |
| 857 | 853 | } |
| 858 | 854 | } |
| 855 | + | |
| 859 | 856 | } |