lock()
lock(integer $type)
Acquire a lock on this file or folder.
A shared (read) lock will prevent any exclusive (write) locks from being created but any number of shared locks
can be active at the same time.
An exclusive lock will prevent any other lock from being created (both shared and exclusive).
A locked exception will be thrown if any conflicting lock already exists
Note that this uses mandatory locking, if you acquire an exclusive lock on a file it will block all
other operations for that file, even within the same php process.
Acquiring any lock on a file will also create a shared lock on all parent folders of that file.
Note that in most cases you won't need to manually manage the locks for any files you're working with,
any filesystem operation will automatically acquire the relevant locks for that operation.
Parameters
integer |
$type |
\OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
Throws
- \OCP\Lock\LockedException