includes/class-freemius.php
private function update_multisite_data_after_site_deactivation( $context_blog_id = 0 ) {
            $this->_logger->entrance();

            if ( $this->_is_network_active ) {
                if ( $context_blog_id == $this->_storage->network_install_blog_id ) {
                    $installs_map = $this->get_blog_install_map();

                    foreach ( $installs_map as $blog_id => $install ) {
                        /**
                         * @var FS_Site $install
                         */
                        if ( $context_blog_id == $blog_id ) {
                            continue;
                        }

                        if ( $install->user_id != $this->_storage->network_user_id ) {
                            continue;
                        }

                        // Switch reference to a blog that is opted-in and belong to the same super-admin.
                        $this->_storage->network_install_blog_id = $blog_id;
                        break;
                    }
                }
            }

            if ( $this->is_sync_cron_scheduled() &&
                 $context_blog_id == $this->get_sync_cron_blog_id()
            ) {
                $this->schedule_sync_cron( WP_FS__SCRIPT_START_TIME, true, $context_blog_id );
            }

            if ( $this->is_install_sync_scheduled() &&
                 $context_blog_id == $this->get_install_sync_cron_blog_id()
            ) {
                $this->schedule_install_sync( $context_blog_id );
            }
        }
private function update_multisite_data_after_site_deactivation( $context_blog_id = 0 ) {
            $this->_logger->entrance();

            if ( $this->_is_network_active ) {
                if ( $context_blog_id == $this->_storage->network_install_blog_id ) {
                    $installs_map = $this->get_blog_install_map();

                    foreach ( $installs_map as $blog_id => $install ) {
                        /**
                         * @var FS_Site $install
                         */
                        if ( $context_blog_id == $blog_id ) {
                            continue;
                        }

                        if ( $install->user_id != $this->_storage->network_user_id ) {
                            continue;
                        }

                        // Switch reference to a blog that is opted-in and belong to the same super-admin.
                        $this->_storage->network_install_blog_id = $blog_id;
                        break;
                    }
                }
            }

            if ( $this->is_sync_cron_scheduled() &&
                 $context_blog_id == $this->get_sync_cron_blog_id()
            ) {
                $this->schedule_sync_cron( WP_FS__SCRIPT_START_TIME, true, $context_blog_id );
            }

            if ( $this->is_install_sync_scheduled() &&
                 $context_blog_id == $this->get_install_sync_cron_blog_id()
            ) {
                $this->schedule_install_sync( $context_blog_id );
            }
        }
private function update_multisite_data_after_site_deactivation ( $ context_blog_id = 0 ) { $ this -> _logger -> entrance ( ) ; if ( $ this -> _is_network_active ) { if ( $ context_blog_id == $ this -> _storage -> network_install_blog_id ) { $ installs_map = $ this -> get_blog_install_map ( ) ; foreach ( $ installs_map as $ blog_id => $ install ) { /**
                         * @var FS_Site $install
                         */ if ( $ context_blog_id == $ blog_id ) { continue ; } if ( $ install -> user_id != $ this -> _storage -> network_user_id ) { continue ; } // Switch reference to a blog that is opted-in and belong to the same super-admin.
 $ this -> _storage -> network_install_blog_id = $ blog_id ; break ; } } } if ( $ this -> is_sync_cron_scheduled ( ) && $ context_blog_id == $ this -> get_sync_cron_blog_id ( ) ) { $ this -> schedule_sync_cron ( WP_FS__SCRIPT_START_TIME , true , $ context_blog_id ) ; } if ( $ this -> is_install_sync_scheduled ( ) && $ context_blog_id == $ this -> get_install_sync_cron_blog_id ( ) ) { $ this -> schedule_install_sync ( $ context_blog_id ) ; } }
Needs to be executed after site deactivation, archive, deletion, or flag as spam.
The logic updates the network level user and blog, and reschedule the crons if the cron executing site matching the site that is no longer publicly active.

@author Vova Feldman (@svovaf)
@since  2.0.0

@param int $context_blog_id
Needs to be executed after site deactivation archive deletion or flag as spam . The logic updates the network level user and blog and reschedule the crons if the cron executing site matching the site that is no longer publicly active .