WP_Filesystem_SSH2::chown( string $file, string|int $owner, bool $recursive = false )
Change the ownership of a file / folder.
Parameters
- $file
-
(string) (Required) Path to the file.
- $owner
-
(string|int) (Required) A user name or number.
- $recursive
-
(bool) (Optional) If set True changes file owner recursivly. Default False.
Default value: false
Return
(bool) True on success or false on failure.
Source
File: wp-admin/includes/class-wp-filesystem-ssh2.php
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);
}