‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Locking\FileLockStrategy Class Reference
Inheritance diagram for TYPO3\CMS\Core\Locking\FileLockStrategy:
TYPO3\CMS\Core\Locking\LockingStrategyInterface

Public Member Functions

 __construct ($subject)
 
 __destruct ()
 
bool acquire ($mode=self::LOCK_CAPABILITY_EXCLUSIVE)
 
bool release ()
 
bool isAcquired ()
 
 destroy ()
 

Static Public Member Functions

static int getPriority ()
 
static int getCapabilities ()
 

Public Attributes

const FILE_LOCK_FOLDER = 'lock/'
 
const DEFAULT_PRIORITY = 75
 
- ‪Public Attributes inherited from ‪TYPO3\CMS\Core\Locking\LockingStrategyInterface
const LOCK_CAPABILITY_EXCLUSIVE = 1
 
const LOCK_CAPABILITY_SHARED = 2
 
const LOCK_CAPABILITY_NOBLOCK = 4
 

Protected Attributes

resource $filePointer
 
string $filePath
 
bool $isAcquired = false
 

Detailed Description

flock() locking

Definition at line 28 of file FileLockStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Locking\FileLockStrategy::__construct (   $subject)
Parameters
string$subject‪ID to identify this lock in the system
Exceptions
LockCreateException‪if the lock could not be created

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 51 of file FileLockStrategy.php.

References $GLOBALS, TYPO3\CMS\Core\Locking\FileLockStrategy\FILE_LOCK_FOLDER, TYPO3\CMS\Core\Core\Environment\getProjectPath(), TYPO3\CMS\Core\Core\Environment\getVarPath(), and TYPO3\CMS\Core\Utility\GeneralUtility\mkdir().

◆ __destruct()

TYPO3\CMS\Core\Locking\FileLockStrategy::__destruct ( )

Destructor: Releases lock automatically when instance is destroyed and release resources

Definition at line 83 of file FileLockStrategy.php.

References TYPO3\CMS\Core\Locking\FileLockStrategy\release().

Member Function Documentation

◆ acquire()

bool TYPO3\CMS\Core\Locking\FileLockStrategy::acquire (   $mode = self::LOCK_CAPABILITY_EXCLUSIVE)

Try to acquire an exclusive lock

Parameters
int$mode‪LOCK_CAPABILITY_EXCLUSIVE or LOCK_CAPABILITY_SHARED or self::LOCK_CAPABILITY_NOBLOCK
Returns
‪bool Returns TRUE if the lock was acquired successfully
Exceptions
LockAcquireException‪if the lock could not be acquired
LockAcquireWouldBlockException‪if the acquire would have blocked and NOBLOCK was set

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 96 of file FileLockStrategy.php.

References TYPO3\CMS\Core\Locking\FileLockStrategy\$filePointer, TYPO3\CMS\Core\Locking\FileLockStrategy\$isAcquired, TYPO3\CMS\Core\Utility\GeneralUtility\fixPermissions(), and TYPO3\CMS\Core\Locking\FileLockStrategy\isAcquired().

◆ destroy()

TYPO3\CMS\Core\Locking\FileLockStrategy::destroy ( )

Destroys the resource associated with the lock

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 186 of file FileLockStrategy.php.

◆ getCapabilities()

static int TYPO3\CMS\Core\Locking\FileLockStrategy::getCapabilities ( )
static
Returns
‪int LOCK_CAPABILITY_* elements combined with bit-wise OR

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 171 of file FileLockStrategy.php.

References TYPO3\CMS\Core\Locking\LockingStrategyInterface\LOCK_CAPABILITY_NOBLOCK.

◆ getPriority()

static int TYPO3\CMS\Core\Locking\FileLockStrategy::getPriority ( )
static

◆ isAcquired()

bool TYPO3\CMS\Core\Locking\FileLockStrategy::isAcquired ( )

Get status of this lock

Returns
‪bool Returns TRUE if lock is acquired by this locker, FALSE otherwise

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 154 of file FileLockStrategy.php.

References TYPO3\CMS\Core\Locking\FileLockStrategy\$isAcquired.

Referenced by TYPO3\CMS\Core\Locking\FileLockStrategy\acquire(), and TYPO3\CMS\Core\Locking\FileLockStrategy\release().

◆ release()

bool TYPO3\CMS\Core\Locking\FileLockStrategy::release ( )

Release the lock

Returns
‪bool Returns TRUE on success or FALSE on failure

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 133 of file FileLockStrategy.php.

References TYPO3\CMS\Core\Locking\FileLockStrategy\isAcquired().

Referenced by TYPO3\CMS\Core\Locking\FileLockStrategy\__destruct().

Member Data Documentation

◆ $filePath

string TYPO3\CMS\Core\Locking\FileLockStrategy::$filePath
protected

File used for locking

Definition at line 41 of file FileLockStrategy.php.

◆ $filePointer

resource TYPO3\CMS\Core\Locking\FileLockStrategy::$filePointer
protected

File pointer if using flock method

Definition at line 37 of file FileLockStrategy.php.

Referenced by TYPO3\CMS\Core\Locking\FileLockStrategy\acquire().

◆ $isAcquired

bool TYPO3\CMS\Core\Locking\FileLockStrategy::$isAcquired = false
protected

◆ DEFAULT_PRIORITY

◆ FILE_LOCK_FOLDER