function SessionStreamWrapper::mkdir

Same name in other branches
  1. 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::mkdir()
  2. 8.x-1.x stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::mkdir()

Support for mkdir().

Parameters

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

int $mode: Permission flags - see mkdir().

int $options: A bit mask of STREAM_REPORT_ERRORS and STREAM_MKDIR_RECURSIVE.

Return value

bool TRUE if directory was successfully created.

Overrides PhpStreamWrapperInterface::mkdir

See also

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

File

modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php, line 685

Class

SessionStreamWrapper
Example stream wrapper class to handle session:// streams.

Namespace

Drupal\stream_wrapper_example\StreamWrapper

Code

public function mkdir($uri, $mode, $options) {
    // If this already exists, then we can't mkdir.
    if (is_dir($uri) || is_file($uri)) {
        return FALSE;
    }
    $path = $this->getLocalPath($uri);
    $new_dir = [
        'is_a_dir.txt' => TRUE,
    ];
    $this->sessionHelper
        ->setPath($path, $new_dir);
    return TRUE;
}