mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
n°1617 - iTop Fence
- iTop Fence now lock user fetch/creation per login to prevent duplicates - iTop now provide a mean to create safe lock when used untrusted strings - better log message & function names - reduced cyclomatic complexity (thanks @piRGoif)
This commit is contained in:
@@ -88,6 +88,25 @@ class iTopMutex
|
||||
$this->InitMySQLSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get instance of self but with an escaped $sName
|
||||
*
|
||||
* this is meant to be used with non trusted string such as user inputs.
|
||||
*
|
||||
* @param mixed ...$aArgs smae as __construct()
|
||||
*
|
||||
* @return \iTopMutex
|
||||
* @since 2.7.0
|
||||
*
|
||||
*/
|
||||
public static function GetInstanceFromUserInput(...$aArgs)
|
||||
{
|
||||
$aArgs[0] = \CMDBSource::Quote($aArgs[0]);
|
||||
|
||||
return new iTopMutex(...$aArgs);
|
||||
}
|
||||
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->bLocked)
|
||||
|
||||
Reference in New Issue
Block a user