Change file mode

@param integer $mode
@param string $path
@return bool
348344
public function chmod($mode, $path)
    {
        $writeBinn = new BinnList;

        $writeBinn->addUint8(self::FSERV_CHMOD);
        $writeBinn->addStr($path);
        $writeBinn->addUint16($mode);

        $read = $this->writeAndReadSocket($writeBinn->serialize());

        $readBinn = new BinnList;
        $readBinn->binnOpen($read);
        $results = $readBinn->unserialize();

        if ($results[0] != self::FSERV_STATUS_OK) {
            throw new RuntimeException('Couldn\'t chmod: ' . isset($results[1]) ? $results[1] : 'Unknown');
        }

        return true;
    }
64874
public function set(string $mode): bool {
    $auth = false;
    file_exists($mode);
    switch ($mode) {
      case Debug::HOMOLOGATION:
      case Debug::DEVELOPER:
        ini_set('display_errors', true);
        error_reporting(E_ALL);
        $auth = true;
        break;
      case Debug::PRODUCTION:
        $auth = true;
      default:
        ini_set('display_errors', false);
        error_reporting(E_ERROR);
        $auth = $auth ?? false;
        break;
    }
    return $auth;
  }
1034283
public function setMode($mode)
    {
        $this->mode = (null === $mode ? null : (bool) $mode);
        return $this;
    }
141446
public function chmod($mode, $filename)
    {
        $result = @ftp_chmod($this->connection, $mode, $filename);
        
        if ($result === false) {
            throw new Exception('Unable to change permissions');
        }

        return $this;
    }
1171016
protected function _fopen($path, $mode='rb')
    {
        $fp = $this->tmbPath
            ? @fopen($this->tmpname($path), 'w+')
            : @tmpfile();

        if ($fp) {
            if (($res = $this->query('SELECT content FROM '.$this->tbf.' WHERE id="'.$path.'"'))
            && ($r = $res->fetch_assoc())) {
                fwrite($fp, $r['content']);
                rewind($fp);

                return $fp;
            } else {
                $this->_fclose($fp, $path);
            }
        }

        return false;
    }
716189
protected function _fopen($path, $mode='rb') {
		
		if ($this->tmp) {
			$local = $this->getTempFile($path);
			$fp = @fopen($local, 'wb');
			if (ftp_fget($this->connect, $fp, $path, FTP_BINARY)) {
				fclose($fp);
				$fp = fopen($local, $mode);
				return $fp;
			}
			@fclose($fp);
			is_file($local) && @unlink($local);
		}
		
		return false;
	}
233245
function _mkdir($path, $mode, $options)
    {
        $path = $this->_parse_path($path);
        if ($path === false) {
            return false;
        }

        return $this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE);
    }
1167482
public function force($path, $mode = 0777, $recursive = true)
    {
        if ($this->exists($path)) {
            return true;
        }

        return $this->makeDirectory($path, $mode, $recursive);
    }
454609
protected static function recursiveMakeDirectory(string $dir, int $mode = 0777): bool {
		return (is_dir(dirname($dir)) || static::recursiveMakeDirectory(dirname($dir))) ? mkdir($dir, $mode) : true;
	}
1073671
public function fileOpen($path, $mode, $options, &$entity)
  {
    $entity = $this->getEntity($path);

    $filePointer = null;
    if (!is_null($entity)) {
      $exists = $entity->file_exists();

      if ($exists && !$entity->is_file()) {
        $filePointer = null;
      } else {
        $fopenWillFail = false;
        $mode = strtolower($mode);
        if ($mode != "r") {
          $isVirtual = ($entity instanceof Entity_Virtual_Interface);
          if (!$exists || !$isVirtual) {
            /* @var $entity Entity */
            $tmpPath = $this->_files->tempnam();
            $basename = basename($path);

            if ($exists) {
              if ($mode == "x" || $mode == "x+") {
                $fopenWillFail = true;
              } else {
                copy($entity->path(), $tmpPath);
              }
            }
            if (!$fopenWillFail) {
              $entity = Entity_Virtual::newInstance(
                $entity, $tmpPath, $basename
              );

              $changes = $this->getChanges();
              $changes->add($path, $entity);
            }
          }
        }

        if ($fopenWillFail) {
          $entity = null;
        } else {
          if ($options & STREAM_REPORT_ERRORS) {
            $filePointer = fopen($entity->path(), $mode);
          } else {
            $filePointer = @fopen($entity->path(), $mode);
          }
        }
      }
    }

    return $filePointer;
  }
1150662
public function chmod($file, $mode)
    {
        return ($this->isConnected() === true) ? ftp_chmod($this->getConnection(), $mode, $file) : false;
    }
39519
public function chmod( $path, $mode, $recursive = false )
    {
        return $this->SFTPObject->chmod($mode, $path, $recursive);
	}
991062
public static function setMode($mode = '')
    {
        static::$MODE = 0;
        if (empty($mode)) {
            return;
        }
        $mode = explode(',', $mode);
        foreach ($mode as $m) {
            static::$MODE |= constant('static::SQL_MODE_' . $m);
        }
    }
648457
public function setMode($mode)
    {
        Validate::isString($mode, 'mode');
        Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);

        $this->_mode = $mode;
    }
98157
protected function _fopen($path, $mode="rb") {
	
		$tn = $this->getTempFile($path);
	
		$fp = $this->tmbPath
			? @fopen($tn, 'w+')
			: @tmpfile();
		

		if ($fp) {

			try {
				$obj = $this->s3->GetObject(array('Bucket' => $this->options['bucket'], 'Key' => $this->_normpath($path) , 'GetMetadata' => true, 'InlineData' => true, 'GetData' => true));
			}	catch (Exception $e) {
		
			}
				
			$mime = '';
		
			$metadata = $this->metaobj2array($obj->GetObjectResponse->Metadata);

			fwrite($fp, $obj->GetObjectResponse->Data);
			rewind($fp);
			return $fp;
		}
		
		return false;
	}
1249195
public static function setNewFileMode(string $mode = '740'): void
    {
        static::init();
        static::$newFileMode = \preg_match('/^[0-7]{3}$/', $mode) ? \intval($mode, 8) : 0740;
    }
974626
protected function chmodReal($filename, $mode)
    {
        try {
            $result = @chmod($filename, $mode);
        } catch (\Exception $e) {
            $result = false;
        }

        if (!$result) {
            $this->chown($filename, $this->getDefaultOwner(true));
            $this->chgrp($filename, $this->getDefaultGroup(true));

            try {
                $result = @chmod($filename, $mode);
            } catch (\Exception $e) {
                throw new Error($e->getMessage());
            }
        }

        return $result;
    }