ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 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.

References $lockFileStorage.

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

Member Function Documentation

◆ getLockFilePath()

ilTestProcessLockerFile::getLockFilePath (   $processName)
private

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

References $path.

Referenced by requestLock().

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

◆ onAfterExecutingNamedOperation()

ilTestProcessLockerFile::onAfterExecutingNamedOperation ( string  $operationDescriptor)
protected

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

References releaseLock().

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

◆ onAfterExecutingRandomPassBuildOperation()

ilTestProcessLockerFile::onAfterExecutingRandomPassBuildOperation (   $withTaxonomyTables = false)
protected

{}

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

References releaseLock().

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

◆ onAfterExecutingTestFinishOperation()

ilTestProcessLockerFile::onAfterExecutingTestFinishOperation ( )
protected

{}

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

References releaseLock().

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

◆ onAfterExecutingTestStartOperation()

ilTestProcessLockerFile::onAfterExecutingTestStartOperation ( )
protected

{}

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

References releaseLock().

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

◆ onBeforeExecutingNamedOperation()

ilTestProcessLockerFile::onBeforeExecutingNamedOperation ( string  $operationDescriptor)
protected

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

References requestLock().

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

◆ onBeforeExecutingRandomPassBuildOperation()

ilTestProcessLockerFile::onBeforeExecutingRandomPassBuildOperation (   $withTaxonomyTables = false)
protected

{}

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

References requestLock().

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

◆ onBeforeExecutingTestFinishOperation()

ilTestProcessLockerFile::onBeforeExecutingTestFinishOperation ( )
protected

{}

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

References requestLock().

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

◆ onBeforeExecutingTestStartOperation()

ilTestProcessLockerFile::onBeforeExecutingTestStartOperation ( )
protected

{}

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

References requestLock().

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

◆ releaseLock()

ilTestProcessLockerFile::releaseLock (   $processName)
private

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

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

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

◆ requestLock()

ilTestProcessLockerFile::requestLock (   $processName)
private

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

References getLockFilePath().

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

117  {
118  $lockFilePath = $this->getLockFilePath($processName);
119  $this->lockFileHandles[$processName] = fopen($lockFilePath, 'w');
120  flock($this->lockFileHandles[$processName], LOCK_EX);
121  }
+ 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: