private function get_installs_data_for_api(
            array $override,
            $only_diff = false,
            $include_plugins = true,
            $include_themes = true
        ) {
            /**
             * @since 1.1.8 Also send plugin updates.
             */
//            if ( $include_plugins && ! isset( $override['plugins'] ) ) {
//                $plugins = $this->get_plugins_data_for_api();
//                if ( ! empty( $plugins ) ) {
//                    $override['plugins'] = $plugins;
//                }
//            }
            /**
             * @since 1.1.8 Also send themes updates.
             */
//            if ( $include_themes && ! isset( $override['themes'] ) ) {
//                $themes = $this->get_themes_data_for_api();
//                if ( ! empty( $themes ) ) {
//                    $override['themes'] = $themes;
//                }
//            }

            // Common properties.
            $versions = $this->get_versions();
            $common   = array_merge( $versions, array(
                'version'    => $this->get_plugin_version(),
                'is_premium' => $this->is_premium(),
            ), $override );


            $is_common_diff_for_any_site = false;
            $common_diff_union           = array();

            $installs_data = array();

            $sites = self::get_sites();

            foreach ( $sites as $site ) {
                $blog_id = self::get_site_blog_id( $site );

                $install = $this->get_install_by_blog_id( $blog_id );

                if ( is_object( $install ) ) {
                    if ( $install->user_id != $this->_user->id ) {
                        // Install belongs to a different owner.
                        continue;
                    }

                    if ( ! $this->is_premium() && $install->is_tracking_prohibited() ) {
                        // Don't send updates regarding opted-out installs.
                        continue;
                    }

                    $install_data = $this->get_site_info( $site );

                    $uid = $install_data['uid'];

                    unset( $install_data['blog_id'] );
                    unset( $install_data['uid'] );

                    $install_data['is_disconnected'] = $install->is_disconnected;
                    $install_data['is_active']       = $this->is_active_for_site( $blog_id );
                    $install_data['is_uninstalled']  = $install->is_uninstalled;

                    $common_diff    = null;
                    $is_common_diff = false;
                    if ( $only_diff ) {
                        $install_data = $this->get_install_diff_for_api( $install_data, $install, $override );
                        $common_diff  = $this->get_install_diff_for_api( $common, $install, $override );

                        $is_common_diff = ! empty( $common_diff );

                        if ( $is_common_diff ) {
                            foreach ( $common_diff as $k => $v ) {
                                if ( ! isset( $common_diff_union[ $k ] ) ) {
                                    $common_diff_union[ $k ] = $v;
                                }
                            }
                        }

                        $is_common_diff_for_any_site = $is_common_diff_for_any_site || $is_common_diff;
                    }

                    if ( ! empty( $install_data ) || $is_common_diff ) {
                        // Add install ID and site unique ID.
                        $install_data['id']  = $install->id;
                        $install_data['uid'] = $uid;

                        $installs_data[] = $install_data;
                    }
                }
            }

            restore_current_blog();

            if ( 0 < count( $installs_data ) && ( $is_common_diff_for_any_site || ! $only_diff ) ) {
                if ( ! $only_diff ) {
                    $installs_data[] = $common;
                } else if ( ! empty( $common_diff_union ) ) {
                    $installs_data[] = $common_diff_union;
                }
            }

            foreach ( $installs_data as &$data ) {
                $data = (object) $data;
            }

            return $installs_data;
        }