| @@ -644,8 +644,24 @@ | ||
| 644 | 644 | MainWP_DB::instance()->update_website_option( $pWebsite, 'password_policy_options', wp_json_encode( $information['password_policy_options'] ) ); |
| 645 | 645 | $done = true; |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | + if ( isset( $information['premium_updates_results'] ) && is_array( $information['premium_updates_results'] ) ) { | |
| 649 | + foreach ( array( 'plugin', 'theme' ) as $type ) { | |
| 650 | + if ( isset( $information['premium_updates_results'][ $type ] ) ) { | |
| 651 | + $update_results = $information['premium_updates_results'][ $type ]; | |
| 652 | + if ( is_array( $update_results ) ) { | |
| 653 | + foreach ( $update_results as $info ) { | |
| 654 | + if ( is_array( $info ) && isset( $info['other_data'] ) ) { | |
| 655 | + $output_array = $info['other_data']; | |
| 656 | + mainwp_get_actions_handler_instance()->do_action_mainwp_install_actions( $pWebsite, 'updated', $output_array, $type ); | |
| 657 | + } | |
| 658 | + } | |
| 659 | + } | |
| 660 | + } | |
| 661 | + } | |
| 662 | + } | |
| 663 | + | |
| 648 | 664 | if ( isset( $information['primaryLasttimeBackup'] ) ) { |
| 649 | 665 | MainWP_DB::instance()->update_website_option( $pWebsite, 'primary_lasttime_backup', $information['primaryLasttimeBackup'] ); |
| 650 | 666 | $done = true; |
| 651 | 667 | } |
| @@ -664,8 +680,18 @@ | ||
| 664 | 680 | \MainWP\Dashboard\Module\Log\Log_Changes_Logs_Helper::instance()->sync_changes_logs( $pWebsite->id, $information['changes_logs_data'], $pWebsite ); |
| 665 | 681 | $done = true; |
| 666 | 682 | } |
| 667 | 683 | |
| 684 | + $monitor_data = array(); | |
| 685 | + if ( isset( $information['child_monitor_data'] ) && is_array( $information['child_monitor_data'] ) ) { | |
| 686 | + $monitor_data = $information['child_monitor_data']; | |
| 687 | + $done = true; | |
| 688 | + } | |
| 689 | + | |
| 690 | + if ( $done ) { | |
| 691 | + MainWP_DB::instance()->update_website_option( $pWebsite, 'child_monitor_data', wp_json_encode( $monitor_data ) ); | |
| 692 | + } | |
| 693 | + | |
| 668 | 694 | if ( ! $done ) { |
| 669 | 695 | if ( isset( $information['wpversion'] ) ) { |
| 670 | 696 | $done = true; |
| 671 | 697 | } elseif ( isset( $information['error'] ) ) { |
| @@ -800,8 +826,38 @@ | ||
| 800 | 826 | */ |
| 801 | 827 | do_action( 'mainwp_site_sync', $pWebsite, $information, $sync_success, $_error, $post_data ); |
| 802 | 828 | |
| 803 | 829 | return ! $error; |
| 830 | + } | |
| 831 | + | |
| 832 | + /** | |
| 833 | + * Method sync_partial_information() | |
| 834 | + * | |
| 835 | + * @param object $pWebsite The website object. | |
| 836 | + * @param array $information Array contaning information returned from child site. | |
| 837 | + */ | |
| 838 | + public static function sync_partial_information( &$pWebsite, &$information ) { | |
| 839 | + $websiteValues = array(); | |
| 840 | + | |
| 841 | + /** | |
| 842 | + * Filter: mainwp_before_save_partial_sync_result | |
| 843 | + * | |
| 844 | + * Filters partial sync data returned from the child site before saving it to the database. | |
| 845 | + * | |
| 846 | + * @param array $information Partial sync data returned from the child site. | |
| 847 | + * @param object $pWebsite Object containing child site data. | |
| 848 | + * | |
| 849 | + * @since 6.2.1 | |
| 850 | + */ | |
| 851 | + $information = apply_filters( 'mainwp_before_save_partial_sync_result', $information, $pWebsite ); | |
| 852 | + | |
| 853 | + if ( isset( $information['plugins'] ) ) { | |
| 854 | + $plugins_info = $information['plugins']; | |
| 855 | + $websiteValues['plugins'] = wp_json_encode( $plugins_info ); | |
| 856 | + } | |
| 857 | + if ( ! empty( $websiteValues ) ) { | |
| 858 | + MainWP_DB::instance()->update_website_values( $pWebsite->id, $websiteValues ); | |
| 859 | + } | |
| 804 | 860 | } |
| 805 | 861 | |
| 806 | 862 | |
| 807 | 863 | /** |