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