function FileTransfer::checkPath
Same name in other branches
- 7.x includes/filetransfer/filetransfer.inc \FileTransfer::checkPath()
- 9 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::checkPath()
- 8.9.x core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::checkPath()
- 10 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::checkPath()
Checks that the path is inside the jail and throws an exception if not.
Parameters
string $path: A path to check against the jail.
Throws
\Drupal\Core\FileTransfer\FileTransferException
6 calls to FileTransfer::checkPath()
- FileTransfer::chmod in core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php - Changes the permissions of the specified $path (file or directory).
- FileTransfer::copyDirectory in core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php - Copies a directory.
- FileTransfer::copyFile in core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php - Copies a file.
- FileTransfer::createDirectory in core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php - Creates a directory.
- FileTransfer::removeDirectory in core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php - Removes a directory.
File
-
core/
lib/ Drupal/ Core/ FileTransfer/ FileTransfer.php, line 260
Class
- FileTransfer
- Defines the base FileTransfer class.
Namespace
Drupal\Core\FileTransferCode
protected final function checkPath($path) {
$full_jail = $this->chroot . $this->jail;
$full_path = \Drupal::service('file_system')->realpath(substr($this->chroot . $path, 0, strlen($full_jail)));
$full_path = $this->fixRemotePath($full_path, FALSE);
if ($full_jail !== $full_path) {
throw new FileTransferException('@directory is outside of the @jail', 0, [
'@directory' => $path,
'@jail' => $this->jail,
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.