function FileTransfer::chmod

Same name in other branches
  1. 7.x includes/filetransfer/filetransfer.inc \FileTransfer::chmod()
  2. 9 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::chmod()
  3. 8.9.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::chmod()
  4. 11.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::chmod()

Changes the permissions of the specified $path (file or directory).

Parameters

string $path: The file / directory to change the permissions of.

int $mode: The new file permission mode to be passed to chmod().

bool $recursive: Pass TRUE to recursively chmod the entire directory specified in $path.

Throws

\Drupal\Core\FileTransfer\FileTransferException

See also

http://php.net/chmod

File

core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 191

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

public final function chmod($path, $mode, $recursive = FALSE) {
    if (!$this instanceof ChmodInterface) {
        throw new FileTransferException('Unable to change file permissions');
    }
    $path = $this->sanitizePath($path);
    $path = $this->fixRemotePath($path);
    $this->checkPath($path);
    $this->chmodJailed($path, $mode, $recursive);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.