Mercurial > hg > cmmr2012-drupal-site
diff core/lib/Drupal/Core/StreamWrapper/LocalStream.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 |
line wrap: on
line diff
--- a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php Thu Feb 28 13:11:55 2019 +0000 +++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php Thu May 09 15:34:47 2019 +0100 @@ -134,7 +134,7 @@ $realpath = realpath($path); if (!$realpath) { // This file does not yet exist. - $realpath = realpath(dirname($path)) . '/' . drupal_basename($path); + $realpath = realpath(dirname($path)) . '/' . \Drupal::service('file_system')->basename($path); } $directory = realpath($this->getDirectoryPath()); if (!$realpath || !$directory || strpos($realpath, $directory) !== 0) { @@ -397,9 +397,9 @@ /** * Gets the name of the directory from a given path. * - * This method is usually accessed through drupal_dirname(), which wraps - * around the PHP dirname() function because it does not support stream - * wrappers. + * This method is usually accessed through + * \Drupal\Core\File\FileSystemInterface::dirname(), which wraps around the + * PHP dirname() function because it does not support stream wrappers. * * @param string $uri * A URI or path. @@ -407,7 +407,7 @@ * @return string * A string containing the directory name. * - * @see drupal_dirname() + * @see \Drupal\Core\File\FileSystemInterface::dirname() */ public function dirname($uri = NULL) { list($scheme) = explode('://', $uri, 2); @@ -447,11 +447,13 @@ else { $localpath = $this->getLocalPath($uri); } + /** @var \Drupal\Core\File\FileSystemInterface $file_system */ + $file_system = \Drupal::service('file_system'); if ($options & STREAM_REPORT_ERRORS) { - return drupal_mkdir($localpath, $mode, $recursive); + return $file_system->mkdir($localpath, $mode, $recursive); } else { - return @drupal_mkdir($localpath, $mode, $recursive); + return @$file_system->mkdir($localpath, $mode, $recursive); } } @@ -470,11 +472,13 @@ */ public function rmdir($uri, $options) { $this->uri = $uri; + /** @var \Drupal\Core\File\FileSystemInterface $file_system */ + $file_system = \Drupal::service('file_system'); if ($options & STREAM_REPORT_ERRORS) { - return drupal_rmdir($this->getLocalPath()); + return $file_system->rmdir($this->getLocalPath()); } else { - return @drupal_rmdir($this->getLocalPath()); + return @$file_system->rmdir($this->getLocalPath()); } }