public function source_selection( $source, $remote_source, $install, $hook_extra ) {
		if ( ! isset( $hook_extra['theme'] ) || $this->theme_name !== $hook_extra['theme'] ) {
			return $source;
		}

		global $wp_filesystem;

		$slash_count = substr_count( $this->theme_name, '/' );
		if ( $slash_count ) {
			add_action( 'switch_theme', [ $this, '_re_activate' ], 10, 3 );
		}

		$source_theme_dir = untrailingslashit( WP_CONTENT_DIR ) . '/upgrade';
		if ( $wp_filesystem->is_writable( $source_theme_dir ) && $wp_filesystem->is_writable( $source ) ) {
			$newsource = trailingslashit( $source_theme_dir ) . trailingslashit( $this->theme_name );
			if ( $wp_filesystem->move( $source, $newsource, true ) ) {
				return $newsource;
			}
		}

		return new \WP_Error();
	}
public function source_selection( $source, $remote_source, $install, $hook_extra ) {
		if ( ! isset( $hook_extra['theme'] ) || $this->theme_name !== $hook_extra['theme'] ) {
			return $source;
		}

		global $wp_filesystem;

		$slash_count = substr_count( $this->theme_name, '/' );
		if ( $slash_count ) {
			add_action( 'switch_theme', [ $this, '_re_activate' ], 10, 3 );
		}

		$source_theme_dir = untrailingslashit( WP_CONTENT_DIR ) . '/upgrade';
		if ( $wp_filesystem->is_writable( $source_theme_dir ) && $wp_filesystem->is_writable( $source ) ) {
			$newsource = trailingslashit( $source_theme_dir ) . trailingslashit( $this->theme_name );
			if ( $wp_filesystem->move( $source, $newsource, true ) ) {
				return $newsource;
			}
		}

		return new \WP_Error();
	}
public function source_selection ( $ source , $ remote_source , $ install , $ hook_extra ) { if ( ! isset ( $ hook_extra [ 'theme' ] ) || $ this -> theme_name !== $ hook_extra [ 'theme' ] ) { return $ source ; } global $ wp_filesystem ; $ slash_count = substr_count ( $ this -> theme_name , '/' ) ; if ( $ slash_count ) { add_action ( 'switch_theme' , [ $ this , '_re_activate' ] , 10 , 3 ) ; } $ source_theme_dir = untrailingslashit ( WP_CONTENT_DIR ) . '/upgrade' ; if ( $ wp_filesystem -> is_writable ( $ source_theme_dir ) && $ wp_filesystem -> is_writable ( $ source ) ) { $ newsource = trailingslashit ( $ source_theme_dir ) . trailingslashit ( $ this -> theme_name ) ; if ( $ wp_filesystem -> move ( $ source , $ newsource , true ) ) { return $ newsource ; } } return new \ WP_Error ( ) ; }
Expand the theme

@param string $source
@param string $remote_source
@param WP_Upgrader $install
@param array $args['hook_extra']
@return $source|WP_Error.
Expand the theme