1 file_example_session_streams.inc public FileExampleSessionStreamWrapper::mkdir($uri, $mode, $options)

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 StreamWrapperInterface::mkdir

See also

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

File

modules/examples/file_example/file_example_session_streams.inc, line 523
Provides a demonstration session:// streamwrapper.

Class

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

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

  // Create the key in $_SESSION;
  $this->uri_to_session_key($uri, TRUE);

  // Place a magic file inside it to differentiate this from an empty file.
  $marker_uri = $uri . '/.isadir.txt';
  $this->uri_to_session_key($marker_uri, TRUE);
  return TRUE;
}