Utility class for process identifier (PID) locking.
More...
|
| __construct ( $module, $wikiId) |
|
| getLock ( $force=false) |
| Tries to allocate a process identifier based lock for the process, to avoid running more than one instance. More...
|
|
| removeLock () |
| Remove the process identifier lock. More...
|
|
|
| isAlive ( $pid) |
| Check the given process identifier to see if it is alive. More...
|
|
| getStateFile () |
| Generate a name and path for a file to store some kind of state in. More...
|
|
Utility class for process identifier (PID) locking.
- Copyright
- GPL-2.0-or-later
◆ __construct()
Wikibase\Repo\PidLock::__construct |
( |
|
$module, |
|
|
|
$wikiId |
|
) |
| |
- Parameters
-
string | $module | used as a basis for the file name. |
string | $wikiId | the wiki's id, used for per-wiki file names. |
◆ getLock()
Wikibase\Repo\PidLock::getLock |
( |
|
$force = false | ) |
|
Tries to allocate a process identifier based lock for the process, to avoid running more than one instance.
Note that this method creates the file if necessary.
- Parameters
-
bool | $force | make the function skip the test and always grab the lock |
- Returns
- bool true if we got the lock, i.e. if no instance is already running, or $force was set.
◆ getStateFile()
Wikibase\Repo\PidLock::getStateFile |
( |
| ) |
|
|
private |
Generate a name and path for a file to store some kind of state in.
- Returns
- string File path
◆ isAlive()
Wikibase\Repo\PidLock::isAlive |
( |
|
$pid | ) |
|
|
private |
Check the given process identifier to see if it is alive.
- Parameters
-
int | $pid | the process identifier to check |
- Returns
- bool true if the process exist
◆ removeLock()
Wikibase\Repo\PidLock::removeLock |
( |
| ) |
|
Remove the process identifier lock.
Assumes that we hold it.
- Returns
- bool Success
◆ $module
Wikibase\Repo\PidLock::$module |
|
private |
◆ $wikiId
Wikibase\Repo\PidLock::$wikiId |
|
private |
The documentation for this class was generated from the following file: