GC_Filesystem_SSH2::owner()

最后更新于:2021-11-27 20:40:31

GC_Filesystem_SSH2::owner( string$file)

Gets the file owner.

参数

$file

(string) (Required) Path to the file.

响应

(string|false) Username of the owner on success, false on failure.

源文件

文件: gc-admin/includes/class-gc-filesystem-ssh2.php

	public function owner( $file ) {
		$owneruid = @fileowner( $this->sftp_path( $file ) );

		if ( ! $owneruid ) {
			return false;
		}

		if ( ! function_exists( 'posix_getpwuid' ) ) {
			return $owneruid;
		}

		$ownerarray = posix_getpwuid( $owneruid );

		if ( ! $ownerarray ) {
			return false;
		}

		return $ownerarray['name'];
	}