public function SessionStreamWrapper::stream_lock in Examples for Developers 3.x
Same name and namespace in other branches
- 8 stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php \Drupal\stream_wrapper_example\StreamWrapper\SessionStreamWrapper::stream_lock()
Advisory file locking.
This method is called in response to flock(), when file_put_contents() (when flags contains LOCK_EX), stream_set_blocking() and when closing the stream (LOCK_UN).
Parameters
int $operation: One of:
- LOCK_SH: To acquire a shared lock (reader).
- LOCK_EX: To acquire an exclusive lock (writer).
- LOCK_UN: To release a lock (shared or exclusive).
- LOCK_NB: If you don't want flock() to block while locking. This operation is not supported on Windows.
Return value
bool Returns TRUE on success or FALSE on failure.
Overrides PhpStreamWrapperInterface::stream_lock
See also
flock()
http://php.net/manual/en/streamwrapper.stream-lock.php
File
- modules/
stream_wrapper_example/ src/ StreamWrapper/ SessionStreamWrapper.php, line 435
Class
- SessionStreamWrapper
- Example stream wrapper class to handle session:// streams.
Namespace
Drupal\stream_wrapper_example\StreamWrapperCode
public function stream_lock($operation) {
// @codingStandardsIgnoreEnd
return TRUE;
}