comparison core/lib/Drupal/Core/FileTransfer/FileTransfer.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
270 * @param string $destination 270 * @param string $destination
271 * The destination path. 271 * The destination path.
272 */ 272 */
273 protected function copyDirectoryJailed($source, $destination) { 273 protected function copyDirectoryJailed($source, $destination) {
274 if ($this->isDirectory($destination)) { 274 if ($this->isDirectory($destination)) {
275 $destination = $destination . '/' . drupal_basename($source); 275 $destination = $destination . '/' . \Drupal::service('file_system')->basename($source);
276 } 276 }
277 $this->createDirectory($destination); 277 $this->createDirectory($destination);
278 foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) { 278 foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $filename => $file) {
279 $relative_path = substr($filename, strlen($source)); 279 $relative_path = substr($filename, strlen($source));
280 if ($file->isDir()) { 280 if ($file->isDir()) {
362 $path = $this->fixRemotePath($path, FALSE); 362 $path = $this->fixRemotePath($path, FALSE);
363 $parts = explode('/', $path); 363 $parts = explode('/', $path);
364 $chroot = ''; 364 $chroot = '';
365 while (count($parts)) { 365 while (count($parts)) {
366 $check = implode($parts, '/'); 366 $check = implode($parts, '/');
367 if ($this->isFile($check . '/' . drupal_basename(__FILE__))) { 367 if ($this->isFile($check . '/' . \Drupal::service('file_system')->basename(__FILE__))) {
368 // Remove the trailing slash. 368 // Remove the trailing slash.
369 return substr($chroot, 0, -1); 369 return substr($chroot, 0, -1);
370 } 370 }
371 $chroot .= array_shift($parts) . '/'; 371 $chroot .= array_shift($parts) . '/';
372 } 372 }