mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
N°6043 - Booking: Add prerequisites in iTop core - CRUD extensibility (#520)
This commit is contained in:
111
sources/Service/TemporaryObjects/TemporaryObjectConfig.php
Normal file
111
sources/Service/TemporaryObjects/TemporaryObjectConfig.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Service\TemporaryObjects;
|
||||
|
||||
use MetaModel;
|
||||
|
||||
class TemporaryObjectConfig
|
||||
{
|
||||
|
||||
private int $iGarbageInterval;
|
||||
private int $iConfigTemporaryLifetime;
|
||||
private bool $bConfigTemporaryForce;
|
||||
private int $iWatchdogInterval;
|
||||
private static ?TemporaryObjectConfig $oSingletonInstance = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
// Retrieve service configuration
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
$this->iGarbageInterval = $oConfig->Get(TemporaryObjectHelper::CONFIG_GARBAGE_INTERVAL);
|
||||
$this->iConfigTemporaryLifetime = $oConfig->Get(TemporaryObjectHelper::CONFIG_TEMP_LIFETIME);
|
||||
$this->bConfigTemporaryForce = $oConfig->Get(TemporaryObjectHelper::CONFIG_FORCE);
|
||||
$this->iWatchdogInterval = $oConfig->Get(TemporaryObjectHelper::CONFIG_GARBAGE_INTERVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetInstance.
|
||||
*
|
||||
* @return TemporaryObjectConfig
|
||||
*/
|
||||
public static function GetInstance(): TemporaryObjectConfig
|
||||
{
|
||||
if (is_null(self::$oSingletonInstance)) {
|
||||
self::$oSingletonInstance = new TemporaryObjectConfig();
|
||||
}
|
||||
|
||||
return self::$oSingletonInstance;
|
||||
}
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetGarbageInterval(): int
|
||||
{
|
||||
return $this->iGarbageInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iGarbageInterval
|
||||
*/
|
||||
public function SetGarbageInterval(int $iGarbageInterval): void
|
||||
{
|
||||
$this->iGarbageInterval = $iGarbageInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetConfigTemporaryLifetime(): int
|
||||
{
|
||||
return $this->iConfigTemporaryLifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iConfigTemporaryLifetime
|
||||
*/
|
||||
public function SetConfigTemporaryLifetime(int $iConfigTemporaryLifetime): void
|
||||
{
|
||||
$this->iConfigTemporaryLifetime = $iConfigTemporaryLifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function GetConfigTemporaryForce(): bool
|
||||
{
|
||||
return $this->bConfigTemporaryForce;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bConfigTemporaryForce
|
||||
*/
|
||||
public function SetConfigTemporaryForce(bool $bConfigTemporaryForce): void
|
||||
{
|
||||
$this->bConfigTemporaryForce = $bConfigTemporaryForce;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function GetWatchdogInterval(): int
|
||||
{
|
||||
return $this->iWatchdogInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iWatchdogInterval
|
||||
*/
|
||||
public function SetWatchdogInterval(int $iWatchdogInterval): void
|
||||
{
|
||||
$this->iWatchdogInterval = $iWatchdogInterval;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user