1 stream_wrappers.inc protected BackdropPublicStreamWrapper::getLocalPath($uri = NULL)

Returns the canonical absolute path of the URI, if possible.

Parameters

string $uri: (optional) The stream wrapper URI to be converted to a canonical absolute path. This may point to a directory or another type of file.

Return value

string|false: If $uri is not set, returns the canonical absolute path of the URI previously set by the BackdropStreamWrapperInterface::setUri() function. If $uri is set and valid for this class, returns its canonical absolute path, as determined by the realpath() function. If $uri is set but not valid, returns FALSE.

Overrides BackdropLocalStreamWrapper::getLocalPath

File

core/includes/stream_wrappers.inc, line 939
Backdrop stream wrapper interface.

Class

BackdropPublicStreamWrapper
Backdrop public (public://) stream wrapper class.

Code

protected function getLocalPath($uri = NULL) {
  $path = parent::getLocalPath($uri);

  $private_path = config_get('system.core', 'file_private_path');
  if ($private_path) {
    $private_path = realpath($private_path);
    if ($private_path && strpos($path, $private_path) === 0) {
      return FALSE;
    }
  }

  return $path;
}