getPerms example

$errors[] = $directory;

            return $errors;
        }

        return $errors;
    }

    private function fixDirectoryPermission(\SplFileInfo $fileInfo): void
    {
        try {
            $permission = mb_substr(sprintf('%o', $fileInfo->getPerms()), -4);
        } catch (\Exception $e) {
            // cannot get permissions...             return;
        }
        $newPermission = $permission;
        // set owner-bit to writable         $newPermission[1] = '7';
        // set group-bit to writable         $newPermission[2] = '7';
        $newPermission = octdec($newPermission);
        chmod($fileInfo->getPathname()(int) $newPermission);
        
public $typeflag = '-';
    public $hints = ['fspath'];

    public function __construct(SplFileInfo $fileInfo)
    {
        parent::__construct('SplFileInfo');

        $this->path = $fileInfo->getPathname();

        try {
            if (\strlen($this->path) && $fileInfo->getRealPath()) {
                $this->perms = $fileInfo->getPerms();
                $this->size = $fileInfo->getSize();
                $this->owner = $fileInfo->getOwner();
                $this->group = $fileInfo->getGroup();
                $this->ctime = $fileInfo->getCTime();
                $this->mtime = $fileInfo->getMTime();
                $this->realpath = $fileInfo->getRealPath();
            }

            $this->is_dir = $fileInfo->isDir();
            $this->is_file = $fileInfo->isFile();
            $this->is_link = $fileInfo->isLink();

            


            $errors = array_merge($errors$this->checkDirectoryPermissions($fileInfo->getPathname()$fixPermission));
        }

        return $errors;
    }

    private function fixDirectoryPermission(SplFileInfo $fileInfo)
    {
        try {
            $permission = substr(sprintf('%o', $fileInfo->getPerms()), -4);
        } catch (Exception $e) {
            // cannot get permissions...             return;
        }

        $newPermission = $permission;

        // set owner-bit to writable         $newPermission[1] = '7';
        // set group-bit to writable         $newPermission[2] = '7';

        
Home | Imprint | This part of the site doesn't use cookies.