WordPress at Your Fingertips
function is not described

WP_Filesystem_SSH2::chown() public WP 2.7.0

Changes the owner of a file or directory.

{} It's a method of the class: WP_Filesystem_SSH2{}

No Hooks.

Return

true|false. True on success, false on failure.

Usage

$WP_Filesystem_SSH2 = new WP_Filesystem_SSH2();
$WP_Filesystem_SSH2->chown( $file, $owner, $recursive );
$file(string) (required)
Path to the file or directory.
$owner(string|int) (required)
A user name or number.
$recursive(true|false)
If set to true, changes file owner recursively.
Default: false

Changelog

Since 2.7.0 Introduced.

Code of WP_Filesystem_SSH2::chown() WP 5.8.2

public function chown( $file, $owner, $recursive = false ) {
	if ( ! $this->exists( $file ) ) {
		return false;
	}

	if ( ! $recursive || ! $this->is_dir( $file ) ) {
		return $this->run_command( sprintf( 'chown %s %s', escapeshellarg( $owner ), escapeshellarg( $file ) ), true );
	}

	return $this->run_command( sprintf( 'chown -R %s %s', escapeshellarg( $owner ), escapeshellarg( $file ) ), true );
}