public function LocalStream::stream_open in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::stream_open()
- 9 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::stream_open()
File
- core/
lib/ Drupal/ Core/ StreamWrapper/ LocalStream.php, line 147
Class
- LocalStream
- Defines a Drupal stream wrapper base class for local files.
Namespace
Drupal\Core\StreamWrapperCode
public function stream_open($uri, $mode, $options, &$opened_path) {
$this->uri = $uri;
$path = $this
->getLocalPath();
if ($path === FALSE) {
if ($options & STREAM_REPORT_ERRORS) {
trigger_error('stream_open() filename cannot be empty', E_USER_WARNING);
}
return FALSE;
}
$this->handle = $options & STREAM_REPORT_ERRORS ? fopen($path, $mode) : @fopen($path, $mode);
if ((bool) $this->handle && $options & STREAM_USE_PATH) {
$opened_path = $path;
}
return (bool) $this->handle;
}