Stud.IP  trunk Revision
FileLock Class Reference
Collaboration diagram for FileLock:
Collaboration graph

Public Member Functions

 __construct ($id)
 
 getFilename ()
 
 lock ($data=[])
 
 isLocked (&$lock_data=null)
 
 release ()
 

Static Public Member Functions

static setDirectory ($directory)
 

Protected Attributes

 $filename
 

Static Protected Attributes

static $directory = ''
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $id)

Constructs a new lock object with the provided id.

Parameters
String$idIdentifier of the lock

Member Function Documentation

◆ getFilename()

getFilename ( )

Returns the filename of the lock.

Returns
String Filename of the lock

◆ isLocked()

isLocked ( $lock_data = null)

Tests whether the lock is in use. Returns lock information in $lock_data.

Parameters
mixed$lock_dataInformation stored in lock
Returns
bool Indicates whether the lock is active or not

◆ lock()

lock (   $data = [])

Establish or renew the current lock. Provided lock information will be stored with the lock.

Parameters
Array$dataAdditional information to bestore with the lock

◆ release()

release ( )

Releases a previously obtained lock

◆ setDirectory()

static setDirectory (   $directory)
static

Sets a new base path for the locks.

Parameters
String$directory
Exceptions
RuntimeExceptionif provided directory is either not existant or is not a directory or is not writable.

Field Documentation

◆ $directory

$directory = ''
staticprotected

◆ $filename

$filename
protected

The documentation for this class was generated from the following file: