You are here

public function LocalStream::url_stat in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::url_stat()
  2. 10 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::url_stat()

Support for stat().

Parameters

string $uri: A string containing the URI to get information about.

int $flags: A bit mask of STREAM_URL_STAT_LINK and STREAM_URL_STAT_QUIET.

Return value

array An array with file status, or FALSE in case of an error - see fstat() for a description of this array.

Overrides PhpStreamWrapperInterface::url_stat

See also

http://php.net/manual/streamwrapper.url-stat.php

File

core/lib/Drupal/Core/StreamWrapper/LocalStream.php, line 499

Class

LocalStream
Defines a Drupal stream wrapper base class for local files.

Namespace

Drupal\Core\StreamWrapper

Code

public function url_stat($uri, $flags) {
  $this->uri = $uri;
  $path = $this
    ->getLocalPath();

  // Suppress warnings if requested or if the file or directory does not
  // exist. This is consistent with PHP's plain filesystem stream wrapper.
  if ($flags & STREAM_URL_STAT_QUIET || !file_exists($path)) {
    return @stat($path);
  }
  else {
    return stat($path);
  }
}