You are here

protected function PublicStream::getLocalPath in Drupal 10

File

core/lib/Drupal/Core/StreamWrapper/PublicStream.php, line 121

Class

PublicStream
Defines a Drupal public (public://) stream wrapper class.

Namespace

Drupal\Core\StreamWrapper

Code

protected function getLocalPath($uri = NULL) {
  $path = parent::getLocalPath($uri);
  if (!$path || strpos($path, 'vfs://') === 0) {
    return $path;
  }
  if (Settings::get('sa_core_2022_012_override') === TRUE) {
    return $path;
  }
  $private_path = Settings::get('file_private_path');
  if ($private_path) {
    $private_path = realpath($private_path);
    if ($private_path && strpos($path, $private_path) === 0) {
      return FALSE;
    }
  }
  return $path;
}