You are here

public function LocalStream::rmdir in Drupal 8

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

Support for rmdir().

Parameters

string $uri: A string containing the URI to the directory to delete.

int $options: A bit mask of STREAM_REPORT_ERRORS.

Return value

bool TRUE if directory was successfully removed.

Overrides PhpStreamWrapperInterface::rmdir

See also

http://php.net/manual/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 473

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());
  }
}