function PhpStreamWrapperInterface::stream_lock
Same name in other branches
- 8.9.x core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php \Drupal\Core\StreamWrapper\PhpStreamWrapperInterface::stream_lock()
- 10 core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php \Drupal\Core\StreamWrapper\PhpStreamWrapperInterface::stream_lock()
- 11.x core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php \Drupal\Core\StreamWrapper\PhpStreamWrapperInterface::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.
See also
flock()
http://php.net/manual/en/streamwrapper.stream-lock.php
2 methods override PhpStreamWrapperInterface::stream_lock()
- LocalStream::stream_lock in core/
lib/ Drupal/ Core/ StreamWrapper/ LocalStream.php - Advisory file locking.
- ReadOnlyStream::stream_lock in core/
lib/ Drupal/ Core/ StreamWrapper/ ReadOnlyStream.php - Support for flock().
File
-
core/
lib/ Drupal/ Core/ StreamWrapper/ PhpStreamWrapperInterface.php, line 247
Class
- PhpStreamWrapperInterface
- Defines a generic PHP stream wrapper interface.
Namespace
Drupal\Core\StreamWrapperCode
public function stream_lock($operation);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.