ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestProcessLockerFile Class Reference
+ Inheritance diagram for ilTestProcessLockerFile:
+ Collaboration diagram for ilTestProcessLockerFile:

Public Member Functions

 __construct (ilTestProcessLockFileStorage $lockFileStorage)
 ilTestProcessLockerFile constructor. More...
 
- Public Member Functions inherited from ilTestProcessLocker
 executeTestStartLockOperation (callable $operation)
 
 executeRandomPassBuildOperation (callable $operation, $withTaxonomyTables=false)
 
 executeTestFinishOperation (callable $operation)
 
 executeNamedOperation (string $operationDescriptor, callable $operation)
 

Data Fields

const PROCESS_NAME_TEST_START_LOCK_CHECK = 'testStartLockCheck'
 
const PROCESS_NAME_RANDOM_PASS_BUILD = 'randomPassBuild'
 
const PROCESS_NAME_TEST_FINISH = 'testFinish'
 

Protected Member Functions

 onBeforeExecutingTestStartOperation ()
 {} More...
 
 onAfterExecutingTestStartOperation ()
 {} More...
 
 onBeforeExecutingRandomPassBuildOperation ($withTaxonomyTables=false)
 {
Parameters
bool$withTaxonomyTables
} More...
 
 onAfterExecutingRandomPassBuildOperation ($withTaxonomyTables=false)
 {
Parameters
bool$withTaxonomyTables
} More...
 
 onBeforeExecutingTestFinishOperation ()
 {} More...
 
 onAfterExecutingTestFinishOperation ()
 {} More...
 
 onBeforeExecutingNamedOperation (string $operationDescriptor)
 
 onAfterExecutingNamedOperation (string $operationDescriptor)
 
- Protected Member Functions inherited from ilTestProcessLocker
 executeOperation (callable $operation)
 
 onBeforeExecutingTestStartOperation ()
 
 onAfterExecutingTestStartOperation ()
 
 onBeforeExecutingRandomPassBuildOperation ($withTaxonomyTables=false)
 
 onAfterExecutingRandomPassBuildOperation ($withTaxonomyTables=false)
 
 onBeforeExecutingTestFinishOperation ()
 
 onAfterExecutingTestFinishOperation ()
 
 onBeforeExecutingNamedOperation (string $operationDescriptor)
 
 onAfterExecutingNamedOperation (string $operationDescriptor)
 

Protected Attributes

ilTestProcessLockFileStorage $lockFileStorage
 
 $lockFileHandles
 

Private Member Functions

 requestLock ($processName)
 
 getLockFilePath ($processName)
 
 releaseLock ($processName)
 

Detailed Description

Definition at line 27 of file class.ilTestProcessLockerFile.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestProcessLockerFile::__construct ( ilTestProcessLockFileStorage  $lockFileStorage)

ilTestProcessLockerFile constructor.

Parameters
ilTestProcessLockFileStorage$lockFileStorage

Definition at line 44 of file class.ilTestProcessLockerFile.php.

45 {
46 $this->lockFileStorage = $lockFileStorage;
47 $this->lockFileHandles = [];
48 }
ilTestProcessLockFileStorage $lockFileStorage

References $lockFileStorage.

Member Function Documentation

◆ getLockFilePath()

ilTestProcessLockerFile::getLockFilePath (   $processName)
private

Definition at line 123 of file class.ilTestProcessLockerFile.php.

123 : string
124 {
125 $path = $this->lockFileStorage->getAbsolutePath();
126 return $path . '/' . $processName . '.lock';
127 }
$path
Definition: ltiservices.php:30

References $path.

Referenced by requestLock().

+ Here is the caller graph for this function:

◆ onAfterExecutingNamedOperation()

ilTestProcessLockerFile::onAfterExecutingNamedOperation ( string  $operationDescriptor)
protected

Reimplemented from ilTestProcessLocker.

Definition at line 110 of file class.ilTestProcessLockerFile.php.

110 : void
111 {
112 $this->releaseLock($operationDescriptor);
113 parent::onAfterExecutingNamedOperation($operationDescriptor);
114 }

References releaseLock().

+ Here is the call graph for this function:

◆ onAfterExecutingRandomPassBuildOperation()

ilTestProcessLockerFile::onAfterExecutingRandomPassBuildOperation (   $withTaxonomyTables = false)
protected

{

Parameters
bool$withTaxonomyTables
}

Reimplemented from ilTestProcessLocker.

Definition at line 80 of file class.ilTestProcessLockerFile.php.

81 {
82 $this->releaseLock(self::PROCESS_NAME_RANDOM_PASS_BUILD);
83 parent::onAfterExecutingRandomPassBuildOperation($withTaxonomyTables);
84 }

References releaseLock().

+ Here is the call graph for this function:

◆ onAfterExecutingTestFinishOperation()

ilTestProcessLockerFile::onAfterExecutingTestFinishOperation ( )
protected

{}

Reimplemented from ilTestProcessLocker.

Definition at line 98 of file class.ilTestProcessLockerFile.php.

99 {
100 $this->releaseLock(self::PROCESS_NAME_TEST_FINISH);
101 parent::onAfterExecutingTestStartOperation();
102 }

References releaseLock().

+ Here is the call graph for this function:

◆ onAfterExecutingTestStartOperation()

ilTestProcessLockerFile::onAfterExecutingTestStartOperation ( )
protected

{}

Reimplemented from ilTestProcessLocker.

Definition at line 62 of file class.ilTestProcessLockerFile.php.

63 {
64 $this->releaseLock(self::PROCESS_NAME_TEST_START_LOCK_CHECK);
65 parent::onAfterExecutingTestStartOperation();
66 }

References releaseLock().

+ Here is the call graph for this function:

◆ onBeforeExecutingNamedOperation()

ilTestProcessLockerFile::onBeforeExecutingNamedOperation ( string  $operationDescriptor)
protected

Reimplemented from ilTestProcessLocker.

Definition at line 104 of file class.ilTestProcessLockerFile.php.

104 : void
105 {
106 $this->requestLock($operationDescriptor);
107 parent::onBeforeExecutingNamedOperation($operationDescriptor);
108 }

References requestLock().

+ Here is the call graph for this function:

◆ onBeforeExecutingRandomPassBuildOperation()

ilTestProcessLockerFile::onBeforeExecutingRandomPassBuildOperation (   $withTaxonomyTables = false)
protected

{

Parameters
bool$withTaxonomyTables
}

Reimplemented from ilTestProcessLocker.

Definition at line 71 of file class.ilTestProcessLockerFile.php.

72 {
73 parent::onBeforeExecutingRandomPassBuildOperation($withTaxonomyTables);
74 $this->requestLock(self::PROCESS_NAME_RANDOM_PASS_BUILD);
75 }

References requestLock().

+ Here is the call graph for this function:

◆ onBeforeExecutingTestFinishOperation()

ilTestProcessLockerFile::onBeforeExecutingTestFinishOperation ( )
protected

{}

Reimplemented from ilTestProcessLocker.

Definition at line 89 of file class.ilTestProcessLockerFile.php.

90 {
91 parent::onBeforeExecutingTestStartOperation();
92 $this->requestLock(self::PROCESS_NAME_TEST_FINISH);
93 }

References requestLock().

+ Here is the call graph for this function:

◆ onBeforeExecutingTestStartOperation()

ilTestProcessLockerFile::onBeforeExecutingTestStartOperation ( )
protected

{}

Reimplemented from ilTestProcessLocker.

Definition at line 53 of file class.ilTestProcessLockerFile.php.

54 {
55 parent::onBeforeExecutingTestStartOperation();
56 $this->requestLock(self::PROCESS_NAME_TEST_START_LOCK_CHECK);
57 }

References requestLock().

+ Here is the call graph for this function:

◆ releaseLock()

ilTestProcessLockerFile::releaseLock (   $processName)
private

Definition at line 129 of file class.ilTestProcessLockerFile.php.

130 {
131 flock($this->lockFileHandles[$processName], LOCK_UN);
132 fclose($this->lockFileHandles[$processName]);
133 }

Referenced by onAfterExecutingNamedOperation(), onAfterExecutingRandomPassBuildOperation(), onAfterExecutingTestFinishOperation(), and onAfterExecutingTestStartOperation().

+ Here is the caller graph for this function:

◆ requestLock()

ilTestProcessLockerFile::requestLock (   $processName)
private

Definition at line 116 of file class.ilTestProcessLockerFile.php.

117 {
118 $lockFilePath = $this->getLockFilePath($processName);
119 $this->lockFileHandles[$processName] = fopen($lockFilePath, 'w');
120 flock($this->lockFileHandles[$processName], LOCK_EX);
121 }

References getLockFilePath().

Referenced by onBeforeExecutingNamedOperation(), onBeforeExecutingRandomPassBuildOperation(), onBeforeExecutingTestFinishOperation(), and onBeforeExecutingTestStartOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lockFileHandles

ilTestProcessLockerFile::$lockFileHandles
protected

Definition at line 38 of file class.ilTestProcessLockerFile.php.

◆ $lockFileStorage

ilTestProcessLockFileStorage ilTestProcessLockerFile::$lockFileStorage
protected

Definition at line 33 of file class.ilTestProcessLockerFile.php.

Referenced by __construct().

◆ PROCESS_NAME_RANDOM_PASS_BUILD

const ilTestProcessLockerFile::PROCESS_NAME_RANDOM_PASS_BUILD = 'randomPassBuild'

Definition at line 30 of file class.ilTestProcessLockerFile.php.

◆ PROCESS_NAME_TEST_FINISH

const ilTestProcessLockerFile::PROCESS_NAME_TEST_FINISH = 'testFinish'

Definition at line 31 of file class.ilTestProcessLockerFile.php.

◆ PROCESS_NAME_TEST_START_LOCK_CHECK

const ilTestProcessLockerFile::PROCESS_NAME_TEST_START_LOCK_CHECK = 'testStartLockCheck'

Definition at line 29 of file class.ilTestProcessLockerFile.php.


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