gcdb::set_blog_id()

最后更新于:2021-11-26 09:04:26

gcdb::set_blog_id( int$blog_id, int$network_id)

Sets blog ID.

参数

$blog_id

(int) (Required)

$network_id

(int) (Optional)

响应

(int) Previous blog ID.

源文件

文件: gc-includes/gc-db.php

	public function set_blog_id( $blog_id, $network_id = 0 ) {
		if ( ! empty( $network_id ) ) {
			$this->siteid = $network_id;
		}

		$old_blog_id  = $this->blogid;
		$this->blogid = $blog_id;

		$this->prefix = $this->get_blog_prefix();

		foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) {
			$this->$table = $prefixed_table;
		}

		foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) {
			$this->$table = $prefixed_table;
		}

		return $old_blog_id;
	}