ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 {} More...
 
 onAfterExecutingRandomPassBuildOperation ($withTaxonomyTables=false)
 {} 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 25 of file class.ilTestProcessLockerFile.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestProcessLockerFile::__construct ( ilTestProcessLockFileStorage  $lockFileStorage)

ilTestProcessLockerFile constructor.

Parameters
ilTestProcessLockFileStorage$lockFileStorage

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

References $lockFileStorage.

43  {
44  $this->lockFileStorage = $lockFileStorage;
45  $this->lockFileHandles = array();
46  }
ilTestProcessLockFileStorage $lockFileStorage

Member Function Documentation

◆ getLockFilePath()

ilTestProcessLockerFile::getLockFilePath (   $processName)
private

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

References $path.

Referenced by requestLock().

121  : string
122  {
123  $path = $this->lockFileStorage->getAbsolutePath();
124  return $path . '/' . $processName . '.lock';
125  }
$path
Definition: ltiservices.php:32
+ Here is the caller graph for this function:

◆ onAfterExecutingNamedOperation()

ilTestProcessLockerFile::onAfterExecutingNamedOperation ( string  $operationDescriptor)
protected

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

References releaseLock().

108  : void
109  {
110  $this->releaseLock($operationDescriptor);
111  parent::onAfterExecutingNamedOperation($operationDescriptor);
112  }
+ Here is the call graph for this function:

◆ onAfterExecutingRandomPassBuildOperation()

ilTestProcessLockerFile::onAfterExecutingRandomPassBuildOperation (   $withTaxonomyTables = false)
protected

{}

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

References releaseLock().

79  {
80  $this->releaseLock(self::PROCESS_NAME_RANDOM_PASS_BUILD);
81  parent::onAfterExecutingRandomPassBuildOperation($withTaxonomyTables);
82  }
+ Here is the call graph for this function:

◆ onAfterExecutingTestFinishOperation()

ilTestProcessLockerFile::onAfterExecutingTestFinishOperation ( )
protected

{}

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

References releaseLock().

97  {
98  $this->releaseLock(self::PROCESS_NAME_TEST_FINISH);
99  parent::onAfterExecutingTestStartOperation();
100  }
+ Here is the call graph for this function:

◆ onAfterExecutingTestStartOperation()

ilTestProcessLockerFile::onAfterExecutingTestStartOperation ( )
protected

{}

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

References releaseLock().

61  {
62  $this->releaseLock(self::PROCESS_NAME_TEST_START_LOCK_CHECK);
63  parent::onAfterExecutingTestStartOperation();
64  }
+ Here is the call graph for this function:

◆ onBeforeExecutingNamedOperation()

ilTestProcessLockerFile::onBeforeExecutingNamedOperation ( string  $operationDescriptor)
protected

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

References requestLock().

102  : void
103  {
104  $this->requestLock($operationDescriptor);
105  parent::onBeforeExecutingNamedOperation($operationDescriptor);
106  }
+ Here is the call graph for this function:

◆ onBeforeExecutingRandomPassBuildOperation()

ilTestProcessLockerFile::onBeforeExecutingRandomPassBuildOperation (   $withTaxonomyTables = false)
protected

{}

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

References requestLock().

70  {
71  parent::onBeforeExecutingRandomPassBuildOperation($withTaxonomyTables);
72  $this->requestLock(self::PROCESS_NAME_RANDOM_PASS_BUILD);
73  }
+ Here is the call graph for this function:

◆ onBeforeExecutingTestFinishOperation()

ilTestProcessLockerFile::onBeforeExecutingTestFinishOperation ( )
protected

{}

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

References requestLock().

88  {
89  parent::onBeforeExecutingTestStartOperation();
90  $this->requestLock(self::PROCESS_NAME_TEST_FINISH);
91  }
+ Here is the call graph for this function:

◆ onBeforeExecutingTestStartOperation()

ilTestProcessLockerFile::onBeforeExecutingTestStartOperation ( )
protected

{}

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

References requestLock().

52  {
53  parent::onBeforeExecutingTestStartOperation();
54  $this->requestLock(self::PROCESS_NAME_TEST_START_LOCK_CHECK);
55  }
+ Here is the call graph for this function:

◆ releaseLock()

ilTestProcessLockerFile::releaseLock (   $processName)
private

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

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

128  {
129  flock($this->lockFileHandles[$processName], LOCK_UN);
130  fclose($this->lockFileHandles[$processName]);
131  }
+ Here is the caller graph for this function:

◆ requestLock()

ilTestProcessLockerFile::requestLock (   $processName)
private

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

References getLockFilePath().

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

115  {
116  $lockFilePath = $this->getLockFilePath($processName);
117  $this->lockFileHandles[$processName] = fopen($lockFilePath, 'w');
118  flock($this->lockFileHandles[$processName], LOCK_EX);
119  }
+ 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 36 of file class.ilTestProcessLockerFile.php.

◆ $lockFileStorage

ilTestProcessLockFileStorage ilTestProcessLockerFile::$lockFileStorage
protected

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

Referenced by __construct().

◆ PROCESS_NAME_RANDOM_PASS_BUILD

const ilTestProcessLockerFile::PROCESS_NAME_RANDOM_PASS_BUILD = 'randomPassBuild'

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

◆ PROCESS_NAME_TEST_FINISH

const ilTestProcessLockerFile::PROCESS_NAME_TEST_FINISH = 'testFinish'

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

◆ PROCESS_NAME_TEST_START_LOCK_CHECK

const ilTestProcessLockerFile::PROCESS_NAME_TEST_START_LOCK_CHECK = 'testStartLockCheck'

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


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