You are here

public function PhpStreamWrapperInterface::stream_lock in Drupal 9

Same name and namespace in other branches
  1. 8 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()

stream_set_blocking()

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\StreamWrapper

Code

public function stream_lock($operation);