WP_CLI\Fetchers

Site::get_site()privateWP-CLI 1.0

Get site (blog) data for a given id.

Method of the class: Site{}

No Hooks.

Return

Array|false. The item if found; false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->get_site( $arg );
$arg(string) (required)
The raw CLI argument.

Site::get_site() code WP-CLI 2.8.0-alpha

private function get_site( $arg ) {
	global $wpdb;

	// Load site data
	$site = $wpdb->get_row(
		$wpdb->prepare(
			"SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d",
			$arg
		)
	);

	if ( ! empty( $site ) ) {
		// Only care about domain and path which are set here
		return $site;
	}

	return false;
}