Mercurial > hg > cmmr2012-drupal-site
comparison core/lib/Drupal/Core/FileTransfer/Local.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 |
---|---|
45 protected function removeDirectoryJailed($directory) { | 45 protected function removeDirectoryJailed($directory) { |
46 if (!is_dir($directory)) { | 46 if (!is_dir($directory)) { |
47 // Programmer error assertion, not something we expect users to see. | 47 // Programmer error assertion, not something we expect users to see. |
48 throw new FileTransferException('removeDirectoryJailed() called with a path (%directory) that is not a directory.', NULL, ['%directory' => $directory]); | 48 throw new FileTransferException('removeDirectoryJailed() called with a path (%directory) that is not a directory.', NULL, ['%directory' => $directory]); |
49 } | 49 } |
50 /** @var \Drupal\Core\File\FileSystemInterface $file_system */ | |
51 $file_system = \Drupal::service('file_system'); | |
50 foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $filename => $file) { | 52 foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST) as $filename => $file) { |
51 if ($file->isDir()) { | 53 if ($file->isDir()) { |
52 if (@!drupal_rmdir($filename)) { | 54 if (@!$file_system->rmdir($filename)) { |
53 throw new FileTransferException('Cannot remove directory %directory.', NULL, ['%directory' => $filename]); | 55 throw new FileTransferException('Cannot remove directory %directory.', NULL, ['%directory' => $filename]); |
54 } | 56 } |
55 } | 57 } |
56 elseif ($file->isFile()) { | 58 elseif ($file->isFile()) { |
57 if (@!drupal_unlink($filename)) { | 59 if (@!drupal_unlink($filename)) { |
58 throw new FileTransferException('Cannot remove file %file.', NULL, ['%file' => $filename]); | 60 throw new FileTransferException('Cannot remove file %file.', NULL, ['%file' => $filename]); |
59 } | 61 } |
60 } | 62 } |
61 } | 63 } |
62 if (@!drupal_rmdir($directory)) { | 64 if (@!$file_system->rmdir($directory)) { |
63 throw new FileTransferException('Cannot remove directory %directory.', NULL, ['%directory' => $directory]); | 65 throw new FileTransferException('Cannot remove directory %directory.', NULL, ['%directory' => $directory]); |
64 } | 66 } |
65 } | 67 } |
66 | 68 |
67 /** | 69 /** |