You are here

public function SessionStreamWrapper::stream_metadata in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::stream_metadata()

Sets metadata on the stream.

Parameters

string $path: A string containing the URI to the file to set metadata on.

int $option: One of:

  • STREAM_META_TOUCH: The method was called in response to touch().
  • STREAM_META_OWNER_NAME: The method was called in response to chown() with string parameter.
  • STREAM_META_OWNER: The method was called in response to chown().
  • STREAM_META_GROUP_NAME: The method was called in response to chgrp().
  • STREAM_META_GROUP: The method was called in response to chgrp().
  • STREAM_META_ACCESS: The method was called in response to chmod().

mixed $value: If option is:

  • STREAM_META_TOUCH: Array consisting of two arguments of the touch() function.
  • STREAM_META_OWNER_NAME or STREAM_META_GROUP_NAME: The name of the owner user/group as string.
  • STREAM_META_OWNER or STREAM_META_GROUP: The value of the owner user/group as integer.
  • STREAM_META_ACCESS: The argument of the chmod() as integer.

Return value

bool Returns TRUE on success or FALSE on failure. If $option is not implemented, FALSE should be returned.

Overrides PhpStreamWrapperInterface::stream_metadata

See also

http://php.net/manual/streamwrapper.stream-metadata.php

File

stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php, line 350

Class

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

Namespace

Drupal\stream_wrapper_example\StreamWrapper

Code

public function stream_metadata($path, $option, $value) {

  // @codingStandardsIgnoreEnd
  // We don't really do any of these, but we want to reassure the calling code
  // that there is no problem with chown or chgrp, even though we do not
  // actually support these.
  return TRUE;
}