1 filetransfer.inc | FileTransfer::findChroot() |
Returns the chroot property for this connection.
It does this by moving up the tree until it finds itself. If successful, it will return the chroot, otherwise FALSE.
Return value
The chroot path for this connection or FALSE.:
File
- core/
includes/ filetransfer/ filetransfer.inc, line 421 - Base FileTransfer class.
Class
- FileTransfer
- @file Base FileTransfer class.
Code
function findChroot() {
// If the file exists as is, there is no chroot.
$path = __FILE__;
$path = $this->fixRemotePath($path, FALSE);
if ($this->isFile($path)) {
return FALSE;
}
$path = __DIR__;
$path = $this->fixRemotePath($path, FALSE);
$parts = explode('/', $path);
$chroot = '';
while (count($parts)) {
$check = implode('/', $parts);
if ($this->isFile($check . '/' . backdrop_basename(__FILE__))) {
// Remove the trailing slash.
return substr($chroot, 0, -1);
}
$chroot .= array_shift($parts) . '/';
}
return FALSE;
}