/** * @{inheritDoc} */ public function chmod($filename = '', $mode = 0644) { return $this->doRun(__METHOD__, func_get_args(), ssh2_sftp_chmod($this->sftp, $filename, $mode)); }
/** * Remote chmod. * * @param string $remote_file * @param int $mode * * @return bool success */ public function chmod($remote_file, $mode) { return ssh2_sftp_chmod($this->resource, $remote_file, $mode); }
public function chmod($file, $perms) { return @ssh2_sftp_chmod($this->handle, $file, $perms); }
/** * Chmod file */ public function chmod($remoteFile, $mode) { $mode = octdec(str_pad($mode, 4, '0', STR_PAD_LEFT)); $remoteFile = $this->_getFilename($remoteFile); if (@ssh2_sftp_chmod($this->_getSftp(), $remoteFile, $mode) === true) { return true; } else { throw new \Exception("Could not chmod file '{$remoteFile}'"); } }
/** * Change the permissions of a file * * @param string $fileName The full path of the file whose permissions will change * @param integer $permissions The new permissions, e.g. 0644 (remember the leading zero in octal numbers!) * * @return boolean True on success */ public function chmod($fileName, $permissions) { $targetFile = $this->translatePath($fileName); // Prefer the SFTP way, if available if (function_exists('ssh2_sftp_chmod')) { return @ssh2_sftp_chmod($this->sftpHandle, $targetFile, $permissions); } else { $cmd = 'chmod ' . decoct($permissions) . ' ' . escapeshellarg($targetFile); return @ssh2_exec($this->connection, $cmd); } }
/** * Changes permissions for an item on the VFS. * * @param string $path The parent folder of the item. * @param string $name The name of the item. * @param string $permission The permission to set in octal notation. * * @throws Horde_Vfs_Exception */ public function changePermissions($path, $name, $permission) { $this->_connect(); $full = $this->_getPath($path, $name); if (!@ssh2_sftp_chmod($this->_sftp, $full, $permission)) { throw new Horde_Vfs_Exception(sprintf('Unable to change permission for VFS file "%s".', $full)); } }
/** * Set file permissions * * @version 1.0 * @access public * @param string the file path * @param string the permissions * @return bool */ public function chmod($path, $perm) { if (!$this->_is_conn()) { return FALSE; } // Permissions can only be set when running PHP 5 if (!function_exists('ssh2_sftp_chmod')) { if ($this->debug == TRUE) { $this->_error('ftp_unable_to_chmod'); } return FALSE; } $result = @ssh2_sftp_chmod($this->sftp, $path, $perm); if ($result === FALSE) { if ($this->debug == TRUE) { $this->_error('ftp_unable_to_chmod'); } return FALSE; } return TRUE; }
/** * @param $filename * @param $mode * @return mixed */ public function chmod($filename, $mode) { return ssh2_sftp_chmod($this->getSftpResource(), $filename, $mode); }
public function permission(string $path, int $type = 0755) : bool { if (@ssh2_sftp_chmod($this->connect, $path, $type)) { return true; } else { throw new InvalidArgumentException('Error', 'emptyVariable', '$this->connect'); } }
/** * @inheritdoc */ public function copyFileInternal($srcFile, $destFile) { $srcFullFileName = $this->composeFullFileNameByReference($srcFile); $srcSftpFileName = $this->composeSftpPath($srcFullFileName); $destFullFileName = $this->composeFullFileNameByReference($destFile); $destSftpFileName = $this->composeSftpPath($destFullFileName); $this->createDirectory(dirname($destFullFileName)); $result = copy($srcSftpFileName, $destSftpFileName); if ($result) { $this->log("file '{$srcSftpFileName}' has been copied to '{$destSftpFileName}'"); ssh2_sftp_chmod($this->getStorage()->getSftp(), $destSftpFileName, $this->getStorage()->filePermission); } else { $this->log("unable to copy file from '{$srcSftpFileName}' to '{$destSftpFileName}'!", Logger::LEVEL_ERROR); } return $result; }
/** * [chmod description] * @param [type] $path [description] * @param [type] $perm [description] * @return [type] [description] */ public function chmod($path, $permissions) { if (false === $this->validConn()) { throw new Exception('invalid connection'); } if (!($this->sftp = @ssh2_sftp($this->conn))) { throw new Exception("unable to establish sftp connection with {$host}"); } return $this->sftp; if (false === ($result = @ssh2_sftp_chmod($this->sftp, $path, $permissions))) { throw new Exception("unable to chmod {$permissions} of {$path}"); } return $result; }
/** * Refresh file permissions accordingly to container options. * * @param BucketInterface $bucket * @param string $name * @return bool */ protected function refreshPermissions(BucketInterface $bucket, $name) { if (!function_exists('ssh2_sftp_chmod')) { return true; } return ssh2_sftp_chmod($this->sftp, $this->getPath($bucket, $name), $bucket->getOption('mode', FilesInterface::RUNTIME)); }
public function chmod($filename, $mode) { return ssh2_sftp_chmod($this->_sftp, $filename, $mode); }