src/Codeception/Module/WPLoader.php
protected function setupCurrentSite()
    {
        /** @var wpdb $wpdb */
        global $current_site, $wpdb;

        $current_site = new \stdClass;

        if (!empty($wpdb->get_results("SHOW TABLES LIKE '{$wpdb->prefix}blogs'"))) {
            $query = "SELECT domain, path  FROM {$wpdb->prefix}blogs WHERE blog_id = 1 AND site_id = 1";
            $data                    = $wpdb->get_row($query);
            $current_site->domain    = $data->domain;
            $current_site->path      = $data->path;
            $current_site->site_name = ucfirst($data->domain);
        } else {
            $site_url = $wpdb->get_var("SELECT option_value FROM {$wpdb->options} WHERE option_name = 'siteurl'");
            if (!empty($site_url)) {
                $current_site->domain = parse_url($site_url, PHP_URL_HOST);
                if ($port = parse_url($site_url, PHP_URL_PORT)) {
                    $current_site->domain .= ":{$port}";
                }
            } else {
                $current_site->domain = $this->config['domain'];
            }
            $current_site->path = '/';
        }
        $current_site->site_name = ucfirst($current_site->domain);
        $current_site->id        = 1;
    }
protected function setupCurrentSite()
    {
        /** @var wpdb $wpdb */
        global $current_site, $wpdb;

        $current_site = new \stdClass;

        if (!empty($wpdb->get_results("SHOW TABLES LIKE '{$wpdb->prefix}blogs'"))) {
            $query = "SELECT domain, path  FROM {$wpdb->prefix}blogs WHERE blog_id = 1 AND site_id = 1";
            $data                    = $wpdb->get_row($query);
            $current_site->domain    = $data->domain;
            $current_site->path      = $data->path;
            $current_site->site_name = ucfirst($data->domain);
        } else {
            $site_url = $wpdb->get_var("SELECT option_value FROM {$wpdb->options} WHERE option_name = 'siteurl'");
            if (!empty($site_url)) {
                $current_site->domain = parse_url($site_url, PHP_URL_HOST);
                if ($port = parse_url($site_url, PHP_URL_PORT)) {
                    $current_site->domain .= ":{$port}";
                }
            } else {
                $current_site->domain = $this->config['domain'];
            }
            $current_site->path = '/';
        }
        $current_site->site_name = ucfirst($current_site->domain);
        $current_site->id        = 1;
    }
protected function setupCurrentSite ( ) { /** @var wpdb $wpdb */ global $ current_site , $ wpdb ; $ current_site = new \ stdClass ; if ( ! empty ( $ wpdb -> get_results ( "SHOW TABLES LIKE '{$wpdb->prefix}blogs'" ) ) ) { $ query = "SELECT domain, path  FROM {$wpdb->prefix}blogs WHERE blog_id = 1 AND site_id = 1" ; $ data = $ wpdb -> get_row ( $ query ) ; $ current_site -> domain = $ data -> domain ; $ current_site -> path = $ data -> path ; $ current_site -> site_name = ucfirst ( $ data -> domain ) ; } else { $ site_url = $ wpdb -> get_var ( "SELECT option_value FROM {$wpdb->options} WHERE option_name = 'siteurl'" ) ; if ( ! empty ( $ site_url ) ) { $ current_site -> domain = parse_url ( $ site_url , PHP_URL_HOST ) ; if ( $ port = parse_url ( $ site_url , PHP_URL_PORT ) ) { $ current_site -> domain .= ":{$port}" ; } } else { $ current_site -> domain = $ this -> config [ 'domain' ] ; } $ current_site -> path = '/' ; } $ current_site -> site_name = ucfirst ( $ current_site -> domain ) ; $ current_site -> id = 1 ; }
Sets up the `current_site` global handling multisite and single site
installation cases.
Sets up the current_site global handling multisite and single site installation cases .