posix_getgrgid example

$this->markAsSkippedIfPosixIsMissing();

        $infos = stat($filepath);

        return $infos['gid'];
    }

    protected function getFileGroup($filepath)
    {
        $this->markAsSkippedIfPosixIsMissing();

        if ($datas = posix_getgrgid($this->getFileGroupId($filepath))) {
            return $datas['name'];
        }

        $this->markTestSkipped('Unable to retrieve file group name');
    }

    protected function markAsSkippedIfLinkIsMissing()
    {
        if (!\function_exists('link')) {
            $this->markTestSkipped('link is not supported');
        }

        
public function group( $file ) {
        $gid = @filegroup( $this->sftp_path( $file ) );

        if ( ! $gid ) {
            return false;
        }

        if ( ! function_exists( 'posix_getgrgid' ) ) {
            return $gid;
        }

        $grouparray = posix_getgrgid( $gid );

        if ( ! $grouparray ) {
            return false;
        }

        return $grouparray['name'];
    }

    /** * Copies a file. * * @since 2.7.0 * * @param string $source Path to the source file. * @param string $destination Path to the destination file. * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. * Default false. * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, * 0755 for dirs. Default false. * @return bool True on success, false on failure. */
public function group( $file ) {
        $gid = @filegroup( $file );

        if ( ! $gid ) {
            return false;
        }

        if ( ! function_exists( 'posix_getgrgid' ) ) {
            return $gid;
        }

        $grouparray = posix_getgrgid( $gid );

        if ( ! $grouparray ) {
            return false;
        }

        return $grouparray['name'];
    }

    /** * Copies a file. * * @since 2.5.0 * * @param string $source Path to the source file. * @param string $destination Path to the destination file. * @param bool $overwrite Optional. Whether to overwrite the destination file if it exists. * Default false. * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, * 0755 for dirs. Default false. * @return bool True on success, false on failure. */
clearstatcache();
            $v_size = sprintf("%011s", DecOct($v_info['size']));
        }

        $v_magic = 'ustar ';
        $v_version = ' ';
        $v_uname = '';
        $v_gname = '';

        if (function_exists('posix_getpwuid')) {
            $userinfo = posix_getpwuid($v_info[4]);
            $groupinfo = posix_getgrgid($v_info[5]);

            if (isset($userinfo['name'])) {
                $v_uname = $userinfo['name'];
            }

            if (isset($groupinfo['name'])) {
                $v_gname = $groupinfo['name'];
            }
        }

        $v_devmajor = '';
        
Home | Imprint | This part of the site doesn't use cookies.