You are here

final protected function FileTransfer::fixRemotePath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/FileTransfer/FileTransfer.php \Drupal\Core\FileTransfer\FileTransfer::fixRemotePath()

Returns a modified path suitable for passing to the server.

If a path is a windows path, makes it POSIX compliant by removing the drive letter. If $this->chroot has a value and $strip_chroot is TRUE, it is stripped from the path to allow for chroot'd filetransfer systems.

Parameters

string $path: The path to modify.

bool $strip_chroot: Whether to remove the path in $this->chroot.

Return value

string The modified path.

9 calls to FileTransfer::fixRemotePath()
FileTransfer::checkPath in core/lib/Drupal/Core/FileTransfer/FileTransfer.php
Checks that the path is inside the jail and throws an exception if not.
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.

... See full list

File

core/lib/Drupal/Core/FileTransfer/FileTransfer.php, line 237
Contains \Drupal\Core\FileTransfer\FileTransfer.

Class

FileTransfer
Defines the base FileTransfer class.

Namespace

Drupal\Core\FileTransfer

Code

protected final function fixRemotePath($path, $strip_chroot = TRUE) {
  $path = $this
    ->sanitizePath($path);
  $path = preg_replace('|^([a-z]{1}):|i', '', $path);

  // Strip out windows driveletter if its there.
  if ($strip_chroot) {
    if ($this->chroot && strpos($path, $this->chroot) === 0) {
      $path = $path == $this->chroot ? '' : substr($path, strlen($this->chroot));
    }
  }
  return $path;
}