WP_Filesystem_SSH2::chown() – Changes the owner of a file or directory.

You appear to be a bot. Output may be restricted

Description

Changes the owner of a file or directory.

Usage

$bool = WP_Filesystem_SSH2::chown( $file, $owner, $recursive );

Parameters

$file
( string ) required – Path to the file or directory.
$owner
( string|int ) required – A user name or number.
$recursive
( bool ) optional – Optional. If set to true, changes file owner recursively. Default false.

Returns

bool True on success, false on failure.

Source

File name: wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
Lines:

1 to 11 of 11
  public function chown( $file, $owner, $recursive = false ) {
    if ( ! $this->WP_Filesystem_SSH2::exists( $file ) ) {
      return false;
    }

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

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

 View on GitHub View on Trac