You are here

public function LocalStream::rmdir in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/StreamWrapper/LocalStream.php \Drupal\Core\StreamWrapper\LocalStream::rmdir()

Removes a directory.

This method is called in response to rmdir().

Note, in order for the appropriate error message to be returned this method should not be defined if the wrapper does not support removing directories.

Note, the streamWrapper::$context property is updated if a valid context is passed to the caller function.

Parameters

string $path: The directory URL which should be removed.

int $options: A bitwise mask of values, such as STREAM_MKDIR_RECURSIVE.

Return value

bool Returns TRUE on success or FALSE on failure.

Overrides PhpStreamWrapperInterface::rmdir

See also

rmdir()

PhpStreamWrapperInterface::mkdir()

PhpStreamWrapperInterface::unlink()

http://php.net/manual/en/streamwrapper.rmdir.php

1 method overrides LocalStream::rmdir()
LocalReadOnlyStream::rmdir in core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
Support for rmdir().

File

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

Class

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

Namespace

Drupal\Core\StreamWrapper

Code

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 $file_system
      ->rmdir($this
      ->getLocalPath());
  }
  else {
    return @$file_system
      ->rmdir($this
      ->getLocalPath());
  }
}