diff --git a/includes/class-freemius.php b/includes/class-freemius.php index ed1a71b1..b75ec36b 100755 --- a/includes/class-freemius.php +++ b/includes/class-freemius.php @@ -3701,6 +3701,64 @@ static function _load_textdomain() { #endregion + #---------------------------------------------------------------------------------- + #region Debugging + #---------------------------------------------------------------------------------- + + /** + * Moved back here from the FS_DebugManager class. + * + * @author Leo Fajardo (@leorw) + * + * @return array + * + * @since 2.5.0 + */ + static function get_all_modules_sites() { + self::get_static_logger()->entrance(); + + $sites_by_type = array( + WP_FS__MODULE_TYPE_PLUGIN => array(), + WP_FS__MODULE_TYPE_THEME => array(), + ); + + $module_types = array_keys( $sites_by_type ); + + if ( ! is_multisite() ) { + foreach ( $module_types as $type ) { + $sites_by_type[ $type ] = self::get_all_sites( $type ); + + foreach ( $sites_by_type[ $type ] as $slug => $install ) { + $sites_by_type[ $type ][ $slug ] = array( $install ); + } + } + } else { + $sites = self::get_sites(); + + foreach ( $sites as $site ) { + $blog_id = self::get_site_blog_id( $site ); + + foreach ( $module_types as $type ) { + $installs = self::get_all_sites( $type, $blog_id ); + + foreach ( $installs as $slug => $install ) { + if ( ! isset( $sites_by_type[ $type ][ $slug ] ) ) { + $sites_by_type[ $type ][ $slug ] = array(); + } + + $install->blog_id = $blog_id; + + $sites_by_type[ $type ][ $slug ][] = $install; + } + } + } + } + + return $sites_by_type; + } + + #endregion + #---------------------------------------------------------------------------------- #region Connectivity Issues #---------------------------------------------------------------------------------- @@ -22601,7 +22659,7 @@ private function complete_change_owner() { $this->_set_account( $user, $this->_site ); $remove_user = true; - $all_modules_sites = FS_DebugManager::get_all_modules_sites(); + $all_modules_sites = self::get_all_modules_sites(); foreach ( $all_modules_sites as $sites_by_module_type ) { foreach ( $sites_by_module_type as $sites_by_slug ) { diff --git a/includes/managers/class-fs-clone-manager.php b/includes/managers/class-fs-clone-manager.php index c46deb2a..01c20cf3 100644 --- a/includes/managers/class-fs-clone-manager.php +++ b/includes/managers/class-fs-clone-manager.php @@ -333,7 +333,7 @@ private function find_network_subsite_clone_install( Freemius $instance ) { } if ( ! isset( $this->all_installs ) ) { - $this->all_installs = FS_DebugManager::get_all_modules_sites(); + $this->all_installs = Freemius::get_all_modules_sites(); } // Check if there's another blog that has the same site. diff --git a/includes/managers/class-fs-debug-manager.php b/includes/managers/class-fs-debug-manager.php index 5364712d..1d287cfb 100644 --- a/includes/managers/class-fs-debug-manager.php +++ b/includes/managers/class-fs-debug-manager.php @@ -158,7 +158,7 @@ static function _debug_page_actions() { static function _debug_page_render() { Freemius::get_static_logger()->entrance(); - $all_modules_sites = self::get_all_modules_sites(); + $all_modules_sites = Freemius::get_all_modules_sites(); $licenses_by_module_type = self::get_all_licenses_by_module_type(); @@ -381,58 +381,6 @@ private static function get_all_licenses_by_module_type() { return $licenses_by_module_type; } - /** - * Moved from the Freemius class. - * - * @author Leo Fajardo (@leorw) - * - * @return array - * - * @since 2.5.0 - */ - static function get_all_modules_sites() { - Freemius::get_static_logger()->entrance(); - - $sites_by_type = array( - WP_FS__MODULE_TYPE_PLUGIN => array(), - WP_FS__MODULE_TYPE_THEME => array(), - ); - - $module_types = array_keys( $sites_by_type ); - - if ( ! is_multisite() ) { - foreach ( $module_types as $type ) { - $sites_by_type[ $type ] = Freemius::get_all_sites( $type ); - - foreach ( $sites_by_type[ $type ] as $slug => $install ) { - $sites_by_type[ $type ][ $slug ] = array( $install ); - } - } - } else { - $sites = Freemius::get_sites(); - - foreach ( $sites as $site ) { - $blog_id = Freemius::get_site_blog_id( $site ); - - foreach ( $module_types as $type ) { - $installs = Freemius::get_all_sites( $type, $blog_id ); - - foreach ( $installs as $slug => $install ) { - if ( ! isset( $sites_by_type[ $type ][ $slug ] ) ) { - $sites_by_type[ $type ][ $slug ] = array(); - } - - $install->blog_id = $blog_id; - - $sites_by_type[ $type ][ $slug ][] = $install; - } - } - } - } - - return $sites_by_type; - } - /** * Delete user. *