public LocalStream::stream_metadata($uri, $option, $value)
Sets metadata on the stream.
string $path: A string containing the URI to the file to set metadata on.
int $option: One of:
mixed $value: If option is:
bool Returns TRUE on success or FALSE on failure. If $option is not implemented, FALSE should be returned.
Overrides PhpStreamWrapperInterface::stream_metadata
http://php.net/manual/streamwrapper.stream-metadata.php
public function stream_metadata($uri, $option, $value) { $target = $this->getLocalPath($uri); $return = FALSE; switch ($option) { case STREAM_META_TOUCH: if (!empty($value)) { $return = touch($target, $value[0], $value[1]); } else { $return = touch($target); } break; case STREAM_META_OWNER_NAME: case STREAM_META_OWNER: $return = chown($target, $value); break; case STREAM_META_GROUP_NAME: case STREAM_META_GROUP: $return = chgrp($target, $value); break; case STREAM_META_ACCESS: $return = chmod($target, $value); break; } if ($return) { // For convenience clear the file status cache of the underlying file, // since metadata operations are often followed by file status checks. clearstatcache(TRUE, $target); } return $return; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!StreamWrapper!LocalStream.php/function/LocalStream::stream_metadata/8.1.x