mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-12 12:34:12 +01:00
Compare commits
2 Commits
issue/jeff
...
feature/63
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a3519c907 | ||
|
|
05deaf33bb |
@@ -284,7 +284,8 @@ class UIExtKeyWidget
|
||||
if ($bAddingValue) {
|
||||
$aArguments = [];
|
||||
foreach ($aAdditionalField as $sAdditionalField) {
|
||||
array_push($aArguments, $oObj->Get($sAdditionalField));
|
||||
//getAsCSV to have user friendly value in text format
|
||||
array_push($aArguments, $oObj->GetAsCSV($sAdditionalField, ' ', ''));
|
||||
}
|
||||
$aOption['additional_field'] = utils::HtmlEntities(utils::VSprintf($sFormatAdditionalField, $aArguments));
|
||||
}
|
||||
|
||||
@@ -537,12 +537,6 @@ class CMDBSource
|
||||
*/
|
||||
public static function Query($sSQLQuery)
|
||||
{
|
||||
if (self::$sRaisesExceptionMsgWhenSqlQuery) {
|
||||
$e = new \Exception(self::$sRaisesExceptionMsgWhenSqlQuery);
|
||||
\IssueLog::Error(__METHOD__, null, [$e->getTraceAsString()]);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (preg_match('/^START TRANSACTION;?$/i', $sSQLQuery)) {
|
||||
self::StartTransaction();
|
||||
|
||||
@@ -562,13 +556,6 @@ class CMDBSource
|
||||
return self::DBQuery($sSQLQuery);
|
||||
}
|
||||
|
||||
public static ?string $sRaisesExceptionMsgWhenSqlQuery = null;
|
||||
|
||||
public static function TriggerExceptionWhenSqlQuery(?string $sMsg)
|
||||
{
|
||||
self::$sRaisesExceptionMsgWhenSqlQuery = $sMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the query directly to the DB. **Be extra cautious with this !**
|
||||
*
|
||||
|
||||
@@ -211,14 +211,6 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
],
|
||||
'allowed_login_types' => [
|
||||
'type' => 'string',
|
||||
'description' => 'List of login types allowed (separated by | ): form, external, basic, token',
|
||||
'default' => DEFAULT_ALLOWED_LOGIN_TYPES,
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
],
|
||||
'app_icon_url' => [
|
||||
'type' => 'string',
|
||||
'description' => 'Hyperlink to redirect the user when clicking on the application icon (in the main window, or login/logoff pages)',
|
||||
@@ -2418,7 +2410,6 @@ class Config
|
||||
public function SetAllowedLoginTypes($aAllowedLoginTypes)
|
||||
{
|
||||
$this->m_sAllowedLoginTypes = implode('|', $aAllowedLoginTypes);
|
||||
$this->Set('allowed_login_types', implode('|', $aAllowedLoginTypes));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,9 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->Free();
|
||||
if (is_object($this->m_oSQLResult)) {
|
||||
$this->m_oSQLResult->free();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -709,8 +711,11 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
|
||||
$sSQL = $this->_makeSelectQuery($this->m_aAttToLoad);
|
||||
|
||||
// Free previous resultset if any
|
||||
$this->Free();
|
||||
if (is_object($this->m_oSQLResult)) {
|
||||
// Free previous resultset if any
|
||||
$this->m_oSQLResult->free();
|
||||
$this->m_oSQLResult = null;
|
||||
}
|
||||
|
||||
try {
|
||||
$oKPI = new ExecutionKPI();
|
||||
@@ -866,7 +871,23 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
*/
|
||||
public function CountExceeds($iLimit)
|
||||
{
|
||||
$iCount = $this->CountWithLimit($iLimit);
|
||||
if (is_null($this->m_iNumTotalDBRows)) {
|
||||
$oKPI = new ExecutionKPI();
|
||||
$sSQL = $this->m_oFilter->MakeSelectQuery([], $this->m_aArgs, null, null, $iLimit + 2, 0, true);
|
||||
$resQuery = CMDBSource::Query($sSQL);
|
||||
$sOQL = $this->GetPseudoOQL($this->m_oFilter, [], $iLimit + 2, 0, true);
|
||||
$oKPI->ComputeStats('OQL Query Exec', $sOQL);
|
||||
if ($resQuery) {
|
||||
$aRow = CMDBSource::FetchArray($resQuery);
|
||||
$iCount = intval($aRow['COUNT']);
|
||||
CMDBSource::FreeResult($resQuery);
|
||||
} else {
|
||||
$iCount = 0;
|
||||
}
|
||||
} else {
|
||||
$iCount = $this->m_iNumTotalDBRows;
|
||||
}
|
||||
|
||||
return ($iCount > $iLimit);
|
||||
}
|
||||
|
||||
@@ -892,8 +913,8 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
$oKPI->ComputeStats('OQL Query Exec', $sOQL);
|
||||
if ($resQuery) {
|
||||
$aRow = CMDBSource::FetchArray($resQuery);
|
||||
$iCount = intval($aRow['COUNT']);
|
||||
CMDBSource::FreeResult($resQuery);
|
||||
$iCount = intval($aRow['COUNT']);
|
||||
} else {
|
||||
$iCount = 0;
|
||||
}
|
||||
@@ -914,14 +935,6 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
return $this->m_iNumLoadedDBRows + count($this->m_aAddedObjects);
|
||||
}
|
||||
|
||||
private function Free()
|
||||
{
|
||||
if (is_object($this->m_oSQLResult)) {
|
||||
CMDBSource::FreeResult($this->m_oSQLResult);
|
||||
$this->m_oSQLResult = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch an object (with the given class alias) at the current position in the set and move the cursor to the next position.
|
||||
*
|
||||
@@ -942,7 +955,6 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
if ($this->m_iCurrRow >= $this->CountLoaded()) {
|
||||
$this->Free();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -950,9 +962,7 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
$sRequestedClassAlias = $this->m_oFilter->GetClassAlias();
|
||||
}
|
||||
|
||||
if ($this->m_iCurrRow < count($this->m_aCacheObj)) {
|
||||
$oRetObj = $this->m_aCacheObj[$this->m_iCurrRow][$sRequestedClassAlias];
|
||||
} else if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) {
|
||||
if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) {
|
||||
// Pick the row from the database
|
||||
$aRow = CMDBSource::FetchArray($this->m_oSQLResult);
|
||||
foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) {
|
||||
@@ -962,7 +972,6 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
} else {
|
||||
try {
|
||||
$oRetObj = MetaModel::GetObjectByRow($sClass, $aRow, $sClassAlias, $this->m_aAttToLoad, $this->m_aExtendedDataSpec);
|
||||
$this->m_aCacheObj[$this->m_iCurrRow] = [$sRequestedClassAlias => $oRetObj];
|
||||
} catch (CoreException $e) {
|
||||
$this->m_iCurrRow++;
|
||||
$oRetObj = $this->Fetch($sRequestedClassAlias);
|
||||
@@ -979,8 +988,6 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
return $oRetObj;
|
||||
}
|
||||
|
||||
private $m_aCacheObj = [];
|
||||
|
||||
/**
|
||||
* Fetch the whole row of objects (if several classes have been specified in the query) and move the cursor to the next position
|
||||
*
|
||||
@@ -999,29 +1006,21 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
}
|
||||
|
||||
if ($this->m_iCurrRow >= $this->CountLoaded()) {
|
||||
$this->Free();
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->m_iCurrRow < count($this->m_aCacheObj)) {
|
||||
$aRetObjects = $this->m_aCacheObj[$this->m_iCurrRow];
|
||||
} else if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) {
|
||||
if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) {
|
||||
// Pick the row from the database
|
||||
$aRow = CMDBSource::FetchArray($this->m_oSQLResult);
|
||||
$aRetObjects = [];
|
||||
foreach ($this->m_oFilter->GetSelectedClasses() as $sClassAlias => $sClass) {
|
||||
$oObj = null;
|
||||
if (!is_null($aRow[$sClassAlias.'id'])) {
|
||||
try {
|
||||
$oObj = MetaModel::GetObjectByRow($sClass, $aRow, $sClassAlias, $this->m_aAttToLoad, $this->m_aExtendedDataSpec);
|
||||
}
|
||||
catch (CoreException $e) {
|
||||
}
|
||||
if (is_null($aRow[$sClassAlias.'id'])) {
|
||||
$oObj = null;
|
||||
} else {
|
||||
$oObj = MetaModel::GetObjectByRow($sClass, $aRow, $sClassAlias, $this->m_aAttToLoad, $this->m_aExtendedDataSpec);
|
||||
}
|
||||
$aRetObjects[$sClassAlias] = $oObj;
|
||||
}
|
||||
|
||||
$this->m_aCacheObj[$this->m_iCurrRow] = $aRetObjects;
|
||||
} else {
|
||||
// Pick the row from the objects added *in memory*
|
||||
$aRetObjects = [];
|
||||
@@ -1064,10 +1063,6 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
$this->Load();
|
||||
}
|
||||
|
||||
if (is_null($this->m_oSQLResult)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->m_iCurrRow = min($iRow, $this->Count());
|
||||
if ($this->m_iCurrRow < $this->m_iNumLoadedDBRows) {
|
||||
$this->m_oSQLResult->data_seek($this->m_iCurrRow);
|
||||
@@ -1241,7 +1236,7 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function HasSameContents(DBObjectSet $oObjectSet, $aExcludeColumns = []): bool
|
||||
public function HasSameContents(DBObjectSet $oObjectSet, $aExcludeColumns = [])
|
||||
{
|
||||
$oComparator = new DBObjectSetComparator($this, $oObjectSet, $aExcludeColumns);
|
||||
return $oComparator->SetsAreEquivalent();
|
||||
|
||||
@@ -39,7 +39,7 @@ abstract class Trigger extends cmdbAbstractObject
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger",
|
||||
@@ -174,7 +174,7 @@ abstract class TriggerOnObject extends Trigger
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onobject",
|
||||
@@ -401,7 +401,7 @@ class TriggerOnPortalUpdate extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onportalupdate",
|
||||
@@ -434,7 +434,7 @@ abstract class TriggerOnStateChange extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onstatechange",
|
||||
@@ -469,7 +469,7 @@ class TriggerOnStateEnter extends TriggerOnStateChange
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onstateenter",
|
||||
@@ -503,7 +503,7 @@ class TriggerOnStateLeave extends TriggerOnStateChange
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onstateleave",
|
||||
@@ -537,7 +537,7 @@ class TriggerOnObjectCreate extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onobjcreate",
|
||||
@@ -572,7 +572,7 @@ class TriggerOnObjectDelete extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onobjdelete",
|
||||
@@ -607,7 +607,7 @@ class TriggerOnObjectUpdate extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onobjupdate",
|
||||
@@ -695,7 +695,7 @@ class TriggerOnObjectMention extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onobjmention",
|
||||
@@ -773,7 +773,7 @@ class TriggerOnAttributeBlobDownload extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onattblobdownload",
|
||||
@@ -852,7 +852,7 @@ class TriggerOnThresholdReached extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_threshold",
|
||||
|
||||
@@ -415,7 +415,12 @@ abstract class User extends cmdbAbstractObject
|
||||
$this->m_aCheckIssues[] = Dict::S('Class:User/Error:CurrentProfilesHaveInsufficientRights');
|
||||
}
|
||||
$oAddon->ResetCache();
|
||||
Session::Set('profile_list', $aCurrentProfiles);
|
||||
|
||||
if (is_null($aCurrentProfiles)) {
|
||||
Session::IsSet('profile_list');
|
||||
} else {
|
||||
Session::Set('profile_list', $aCurrentProfiles);
|
||||
}
|
||||
}
|
||||
// Prevent an administrator to remove their own admin profile
|
||||
if (UserRights::IsAdministrator($this)) {
|
||||
|
||||
@@ -404,7 +404,8 @@ class ValueSetObjects extends ValueSetDefinition
|
||||
if (count($aAdditionalField) > 0) {
|
||||
$aArguments = [];
|
||||
foreach ($aAdditionalField as $sAdditionalField) {
|
||||
array_push($aArguments, $oObject->Get($sAdditionalField));
|
||||
//getAsCSV to have user friendly value in text format
|
||||
array_push($aArguments, $oObject->GetAsCSV($sAdditionalField,' ',''));
|
||||
}
|
||||
$aData['additional_field'] = utils::VSprintf($sFormatAdditionalField, $aArguments);
|
||||
} else {
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\FieldSet\FieldSetUIBlockFactory;
|
||||
use Combodo\iTop\Application\WebPage\WebPage;
|
||||
use Combodo\iTop\Service\Events\EventData;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
use Combodo\iTop\Service\Events\iEventServiceSetup;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
|
||||
class AttachmentPlugIn implements iApplicationUIExtension, iEventServiceSetup
|
||||
{
|
||||
@@ -238,14 +236,10 @@ class AttachmentPlugIn implements iApplicationUIExtension, iEventServiceSetup
|
||||
}
|
||||
$oAttachmentsRenderer = AttachmentsRendererFactory::GetInstance($oPage, $sObjClass, $iObjKey, $sTransactionId);
|
||||
|
||||
$iCount = $oAttachmentsRenderer->GetAttachmentsSet()->Count() + $oAttachmentsRenderer->GetTempAttachmentsSet()->Count();
|
||||
$sTitle = ($iCount > 0) ? Dict::Format('Attachments:TabTitle_Count', $iCount) : Dict::S('Attachments:EmptyTabTitle');
|
||||
if ($this->GetAttachmentsPosition() === 'relations') {
|
||||
$iCount = $oAttachmentsRenderer->GetAttachmentsSet()->Count() + $oAttachmentsRenderer->GetTempAttachmentsSet()->Count();
|
||||
$sTitle = ($iCount > 0) ? Dict::Format('Attachments:TabTitle_Count', $iCount) : Dict::S('Attachments:EmptyTabTitle');
|
||||
$oPage->SetCurrentTab('Attachments:Tab', $sTitle);
|
||||
} else {
|
||||
$oBlock = FieldSetUIBlockFactory::MakeStandard($sTitle);
|
||||
$oBlock->AddSubBlock(new Html(''));
|
||||
$oPage->AddUiBlock($oBlock);
|
||||
}
|
||||
|
||||
$bIsReadOnlyState = self::IsReadonlyState($oObject, $oObject->GetState(), AttachmentPlugIn::ENUM_GUI_BACKOFFICE);
|
||||
|
||||
@@ -24,7 +24,7 @@ class TriggerOnAttachmentCreate extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onattcreate",
|
||||
|
||||
@@ -24,7 +24,7 @@ class TriggerOnAttachmentDelete extends TriggerOnObject
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onattdelete",
|
||||
|
||||
@@ -19,7 +19,7 @@ class TriggerOnAttachmentDownload extends TriggerOnAttributeBlobDownload
|
||||
"category" => "grant_by_profile,core/cmdb,application",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => ['finalclass', 'complement'],
|
||||
"complementary_name_attcode" => ['finalclass', 'target_class'],
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => ['description'],
|
||||
"db_table" => "priv_trigger_onattdownload",
|
||||
|
||||
@@ -323,38 +323,18 @@
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="stock">
|
||||
<code>stock</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-neutral-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-neutral-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>40</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
@@ -6917,29 +6897,14 @@
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
|
||||
@@ -76,9 +76,6 @@
|
||||
<attribute id="finalclass"/>
|
||||
</attributes>
|
||||
</reconciliation>
|
||||
<obsolescence>
|
||||
<condition><![CDATA[status='obsolete']]></condition>
|
||||
</obsolescence>
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="name" xsi:type="AttributeString">
|
||||
@@ -179,32 +176,17 @@
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<sort_type>rank</sort_type>
|
||||
<values>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
@@ -1151,9 +1133,6 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<attribute id="organization_name"/>
|
||||
</attributes>
|
||||
</reconciliation>
|
||||
<obsolescence>
|
||||
<condition><![CDATA[status='obsolete']]></condition>
|
||||
</obsolescence>
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="name" xsi:type="AttributeString">
|
||||
@@ -1205,32 +1184,17 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<sort_type>rank</sort_type>
|
||||
<values>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
@@ -1573,9 +1537,6 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<attribute id="service_name"/>
|
||||
</attributes>
|
||||
</reconciliation>
|
||||
<obsolescence>
|
||||
<condition><![CDATA[status='obsolete']]></condition>
|
||||
</obsolescence>
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="name" xsi:type="AttributeString">
|
||||
@@ -1624,32 +1585,17 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<sort_type>rank</sort_type>
|
||||
<values>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
|
||||
@@ -76,9 +76,6 @@
|
||||
<attribute id="finalclass"/>
|
||||
</attributes>
|
||||
</reconciliation>
|
||||
<obsolescence>
|
||||
<condition><![CDATA[status='obsolete']]></condition>
|
||||
</obsolescence>
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="name" xsi:type="AttributeString">
|
||||
@@ -179,32 +176,17 @@
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<sort_type>rank</sort_type>
|
||||
<values>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
@@ -1140,9 +1122,6 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<attribute id="organization_name"/>
|
||||
</attributes>
|
||||
</reconciliation>
|
||||
<obsolescence>
|
||||
<condition><![CDATA[status='obsolete']]></condition>
|
||||
</obsolescence>
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="name" xsi:type="AttributeString">
|
||||
@@ -1194,32 +1173,17 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<sort_type>rank</sort_type>
|
||||
<values>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
@@ -1584,9 +1548,6 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<attribute id="service_name"/>
|
||||
</attributes>
|
||||
</reconciliation>
|
||||
<obsolescence>
|
||||
<condition><![CDATA[status='obsolete']]></condition>
|
||||
</obsolescence>
|
||||
</properties>
|
||||
<fields>
|
||||
<field id="name" xsi:type="AttributeString">
|
||||
@@ -1635,32 +1596,17 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<field id="status" xsi:type="AttributeEnum">
|
||||
<sort_type>rank</sort_type>
|
||||
<values>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>10</rank>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
|
||||
@@ -1486,29 +1486,14 @@
|
||||
<value id="draft">
|
||||
<code>draft</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="published">
|
||||
<code>published</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
|
||||
@@ -43,38 +43,18 @@
|
||||
<value id="production">
|
||||
<code>production</code>
|
||||
<rank>30</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-active-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-active-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="implementation">
|
||||
<code>implementation</code>
|
||||
<rank>20</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-inactive-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-inactive-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="stock">
|
||||
<code>stock</code>
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-neutral-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-neutral-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
<value id="obsolete">
|
||||
<code>obsolete</code>
|
||||
<rank>40</rank>
|
||||
<style>
|
||||
<main_color>$ibo-lifecycle-frozen-state-primary-color</main_color>
|
||||
<complementary_color>$ibo-lifecycle-frozen-state-secondary-color</complementary_color>
|
||||
<decoration_classes/>
|
||||
</style>
|
||||
</value>
|
||||
</values>
|
||||
<sql>status</sql>
|
||||
|
||||
@@ -612,7 +612,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', [
|
||||
Dict::Add('CS CZ', 'Czech', 'Čeština', [
|
||||
'Class:Trigger' => 'Triger',
|
||||
'Class:Trigger+' => '',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Popis',
|
||||
'Class:Trigger/Attribute:description+' => 'Krátký popis',
|
||||
'Class:Trigger/Attribute:action_list' => 'Spouštěné akce',
|
||||
|
||||
@@ -611,7 +611,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', [
|
||||
Dict::Add('DA DA', 'Danish', 'Dansk', [
|
||||
'Class:Trigger' => 'Triggere',
|
||||
'Class:Trigger+' => '',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Beskrivelse',
|
||||
'Class:Trigger/Attribute:description+' => '',
|
||||
'Class:Trigger/Attribute:action_list' => 'Triggerede handlinger',
|
||||
|
||||
@@ -608,7 +608,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', [
|
||||
Dict::Add('DE DE', 'German', 'Deutsch', [
|
||||
'Class:Trigger' => 'Trigger',
|
||||
'Class:Trigger+' => 'Custom event handler',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Beschreibung',
|
||||
'Class:Trigger/Attribute:description+' => 'Kurzbeschreibung',
|
||||
'Class:Trigger/Attribute:action_list' => 'Verbundene Trigger-Aktionen',
|
||||
|
||||
@@ -705,7 +705,7 @@ Dict::Add('EN US', 'English', 'English', [
|
||||
Dict::Add('EN US', 'English', 'English', [
|
||||
'Class:Trigger' => 'Trigger',
|
||||
'Class:Trigger+' => 'Custom event handler',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s',
|
||||
'Class:Trigger/Attribute:description' => 'Description',
|
||||
'Class:Trigger/Attribute:description+' => 'Be precise as your users will base their potential unsubscription on this information',
|
||||
'Class:Trigger/Attribute:action_list' => 'Triggered actions',
|
||||
|
||||
@@ -688,7 +688,7 @@ Dict::Add('EN GB', 'British English', 'British English', [
|
||||
Dict::Add('EN GB', 'British English', 'British English', [
|
||||
'Class:Trigger' => 'Trigger',
|
||||
'Class:Trigger+' => 'Custom event handler',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Description',
|
||||
'Class:Trigger/Attribute:description+' => 'Be precise as your users will base their potential unsubscribing on this information',
|
||||
'Class:Trigger/Attribute:action_list' => 'Triggered actions',
|
||||
|
||||
@@ -599,7 +599,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
|
||||
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
|
||||
'Class:Trigger' => 'Disparador',
|
||||
'Class:Trigger+' => 'Disparador',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Descripción',
|
||||
'Class:Trigger/Attribute:description+' => 'Descripción',
|
||||
'Class:Trigger/Attribute:action_list' => 'Acciones',
|
||||
|
||||
@@ -650,7 +650,7 @@ Dict::Add('FR FR', 'French', 'Français', [
|
||||
Dict::Add('FR FR', 'French', 'Français', [
|
||||
'Class:Trigger' => 'Déclencheur',
|
||||
'Class:Trigger+' => '',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, classe cible : %2$s',
|
||||
'Class:Trigger/Attribute:description' => 'Description',
|
||||
'Class:Trigger/Attribute:description+' => 'Soyez explicite, afin que vos utilisateurs comprennent à quelles notifications précisement ils se désabonnent',
|
||||
'Class:Trigger/Attribute:action_list' => 'Actions déclenchées',
|
||||
|
||||
@@ -606,7 +606,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', [
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
|
||||
'Class:Trigger' => 'Eseményindító',
|
||||
'Class:Trigger+' => 'Egyéni eseménykezelés',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Leírás',
|
||||
'Class:Trigger/Attribute:description+' => 'Egysoros leírás',
|
||||
'Class:Trigger/Attribute:action_list' => 'Elindított műveletek',
|
||||
|
||||
@@ -606,7 +606,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', [
|
||||
Dict::Add('IT IT', 'Italian', 'Italiano', [
|
||||
'Class:Trigger' => 'Trigger',
|
||||
'Class:Trigger+' => 'Gestore di eventi personalizzati',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Descrizione',
|
||||
'Class:Trigger/Attribute:description+' => 'Una linea di descrizione',
|
||||
'Class:Trigger/Attribute:action_list' => 'Azioni triggerate',
|
||||
|
||||
@@ -610,7 +610,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', [
|
||||
Dict::Add('JA JP', 'Japanese', '日本語', [
|
||||
'Class:Trigger' => 'トリガー',
|
||||
'Class:Trigger+' => 'カスタムイベントハンドラー',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => '説明',
|
||||
'Class:Trigger/Attribute:description+' => '1行の説明',
|
||||
'Class:Trigger/Attribute:action_list' => 'トリガーされたアクション',
|
||||
|
||||
@@ -608,7 +608,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', [
|
||||
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
|
||||
'Class:Trigger' => 'Trigger',
|
||||
'Class:Trigger+' => 'Aanleiding tot het uitvoeren van een actie',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, toegepast op klasse: %2$s',
|
||||
'Class:Trigger/Attribute:description' => 'Beschrijving',
|
||||
'Class:Trigger/Attribute:description+' => 'Beschrijving in één regel',
|
||||
'Class:Trigger/Attribute:action_list' => 'Getriggerde acties',
|
||||
|
||||
@@ -608,7 +608,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', [
|
||||
Dict::Add('PL PL', 'Polish', 'Polski', [
|
||||
'Class:Trigger' => 'Wyzwalacz',
|
||||
'Class:Trigger+' => 'Niestandardowa obsługa zdarzeń',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Opis',
|
||||
'Class:Trigger/Attribute:description+' => 'jedna linia opisu',
|
||||
'Class:Trigger/Attribute:action_list' => 'Działania wyzwalacza',
|
||||
|
||||
@@ -606,7 +606,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
|
||||
'Class:Trigger' => 'Gatilho',
|
||||
'Class:Trigger+' => 'Manipulador de eventos personalizado',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Descrição',
|
||||
'Class:Trigger/Attribute:description+' => 'Uma descrição curta',
|
||||
'Class:Trigger/Attribute:action_list' => 'Ações desencadeadas',
|
||||
|
||||
@@ -611,7 +611,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', [
|
||||
Dict::Add('RU RU', 'Russian', 'Русский', [
|
||||
'Class:Trigger' => 'Триггер',
|
||||
'Class:Trigger+' => 'Пользовательский обработчик событий',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Описание',
|
||||
'Class:Trigger/Attribute:description+' => 'Описание триггера',
|
||||
'Class:Trigger/Attribute:action_list' => 'Действия триггера',
|
||||
|
||||
@@ -624,7 +624,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
|
||||
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
|
||||
'Class:Trigger' => 'Spúštač',
|
||||
'Class:Trigger+' => 'Custom event handler~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Popis',
|
||||
'Class:Trigger/Attribute:description+' => 'Be precise as your users will base their potential unsubscription on this information~~',
|
||||
'Class:Trigger/Attribute:action_list' => 'Spúšťané akcie',
|
||||
|
||||
@@ -611,7 +611,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', [
|
||||
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
|
||||
'Class:Trigger' => 'Tetikleyici',
|
||||
'Class:Trigger+' => 'Özel olay yürütücü',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s~~',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => 'Tanımlama',
|
||||
'Class:Trigger/Attribute:description+' => 'tek satır tanımlama',
|
||||
'Class:Trigger/Attribute:action_list' => 'Tetiklenen işlemler',
|
||||
|
||||
@@ -643,7 +643,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', [
|
||||
Dict::Add('ZH CN', 'Chinese', '简体中文', [
|
||||
'Class:Trigger' => '触发器',
|
||||
'Class:Trigger+' => '自定义事件处理',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, %2$s',
|
||||
'Class:Trigger/ComplementaryName' => '%1$s, class restriction: %2$s~~',
|
||||
'Class:Trigger/Attribute:description' => '描述',
|
||||
'Class:Trigger/Attribute:description+' => '简短描述',
|
||||
'Class:Trigger/Attribute:action_list' => '触发的操作',
|
||||
|
||||
@@ -454,8 +454,7 @@ class iTopExtensionsMap
|
||||
*/
|
||||
public function GetAllExtensionsWithPreviouslyInstalled(): array
|
||||
{
|
||||
//Mind the order, local extensions data must overwrite installed extensions data since installed extensions does not have the associated modules.
|
||||
return array_merge($this->aInstalledExtensions ?? [], $this->aExtensions);
|
||||
return array_merge($this->aExtensions, $this->aInstalledExtensions ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -997,7 +997,7 @@ class RunTimeEnvironment
|
||||
return;
|
||||
}
|
||||
|
||||
SetupLog::Debug("Calling Module Handler: $sModuleInstallerClass::$sHandlerName");
|
||||
SetupLog::Info("Calling Module Handler: $sModuleInstallerClass::$sHandlerName", null, $aArgs);
|
||||
$aCallSpec = [$sModuleInstallerClass, $sHandlerName];
|
||||
if (is_callable($aCallSpec)) {
|
||||
try {
|
||||
|
||||
@@ -210,7 +210,8 @@ class ObjectRepository
|
||||
$aData['has_additional_field'] = true;
|
||||
$aArguments = [];
|
||||
foreach ($aComplementAttributeSpec[1] as $sAdditionalField) {
|
||||
$aArguments[] = $oDbObject->Get($sAdditionalField);
|
||||
//getAsCSV to have user friendly value in text format
|
||||
$aArguments[] = $oDbObject->GetAsCSV($sAdditionalField,' ','');
|
||||
}
|
||||
$aData['additional_field'] = utils::VSprintf($aComplementAttributeSpec[0], $aArguments);
|
||||
$sAdditionalFieldForHtml = utils::EscapeHtml($aData['additional_field']);
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
# PHP static analysis
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usages](#usages)
|
||||
- [Analysing a package](#analysing-a-package)
|
||||
- [Analysing a module](#analysing-a-module)
|
||||
- [Configuration](#configuration)
|
||||
- [Adjust local configuration to your needs](#adjust-local-configuration-to-your-needs)
|
||||
- [Adjust configuration for a particular CI repository / job](#adjust-configuration-for-a-particular-ci-repository--job)
|
||||
|
||||
## Installation
|
||||
- Install dependencies by running `composer install` in this folder
|
||||
- You should be all set! 🚀
|
||||
|
||||
## Usages
|
||||
### Analysing a package
|
||||
_Do this if you want to analyse the whole iTop package (iTop core, extensions, third-party libs, ...)_
|
||||
|
||||
- Make sure you ran a setup on your iTop as it will analyse the `env-production` folder
|
||||
- Open a prompt in your iTop folder
|
||||
- Run the following command
|
||||
```bash
|
||||
tests/php-static-analysis/vendor/bin/phpstan analyse \
|
||||
--configuration ./tests/php-static-analysis/config/for-package.dist.neon \
|
||||
--error-format raw
|
||||
```
|
||||
|
||||
You will then have an output like this listing all errors:
|
||||
```bash
|
||||
tests/php-static-analysis/vendor/bin/phpstan analyse \
|
||||
--configuration ./tests/php-static-analysis/config/for-package.dist.neon \
|
||||
--error-format raw
|
||||
|
||||
1049/1049 [============================] 100%
|
||||
|
||||
<ITOP>\addons\userrights\userrightsprofile.class.inc.php:552:Call to static method InitSharedClassProperties() on an unknown class SharedObject.
|
||||
<ITOP>\addons\userrights\userrightsprofile.db.class.inc.php:927:Call to static method GetSharedClassProperties() on an unknown class SharedObject.
|
||||
<ITOP>\addons\userrights\userrightsprojection.class.inc.php:722:Access to an undefined property UserRightsProjection::$m_aClassProjs.
|
||||
<ITOP>\application\applicationextension.inc.php:295:Method AbstractPreferencesExtension::ApplyPreferences() should return bool but return statement is missing.
|
||||
<ITOP>\application\cmdbabstract.class.inc.php:1010:Class utils referenced with incorrect case: Utils.
|
||||
[...]
|
||||
```
|
||||
|
||||
### Analysing a module
|
||||
_Do this if you only want to analyse one or more modules within this iTop but not the whole package_
|
||||
|
||||
- Make sure you ran a setup on your iTop as it will analyse the `env-production` folder
|
||||
- Open a prompt in your iTop folder
|
||||
- Run the following command
|
||||
```
|
||||
tests/php-static-analysis/vendor/bin/phpstan analyse \
|
||||
--configuration ./tests/php-static-analysis/config/for-module.dist.neon \
|
||||
--error-format raw \
|
||||
env-production/<MODULE_CODE_1> [env-production/<MODULE_CODE_2> ...]
|
||||
```
|
||||
|
||||
You will then have an output like this listing all errors:
|
||||
```
|
||||
tests/php-static-analysis/vendor/bin/phpstan analyse \
|
||||
--configuration ./tests/php-static-analysis/config/for-module.dist.neon \
|
||||
--error-format raw \
|
||||
env-production/authent-ldap env-production/itop-oauth-client
|
||||
|
||||
49/49 [============================] 100%
|
||||
|
||||
<ITOP>\env-production\authent-ldap\model.authent-ldap.php:79:Undefined variable: $hDS
|
||||
<ITOP>\env-production\authent-ldap\model.authent-ldap.php:80:Undefined variable: $name
|
||||
<ITOP>\env-production\authent-ldap\model.authent-ldap.php:80:Undefined variable: $value
|
||||
<ITOP>\env-production\itop-oauth-client\vendor\composer\InstalledVersions.php:105:Parameter $parser of method Composer\InstalledVersions::satisfies() has invalid type Composer\Semver\VersionParser.
|
||||
[...]
|
||||
```
|
||||
|
||||
## Configuration
|
||||
### Adjust local configuration to your needs
|
||||
#### Define which PHP version to run the analysis for
|
||||
The way we configured PHPStan in this project changes how it will find the PHP version to run the analysis for. \
|
||||
By default PHPStan check the information from the composer.json file, but we changed that (via the `config/php-includes/set-php-version-from-process.php` include) so it used the PHP
|
||||
version currently ran by the CLI.
|
||||
|
||||
So all you have to do is either:
|
||||
- Prepend your command line with the path of the executable of the desired PHP version
|
||||
- Change the default PHP interpreter in your IDE settings
|
||||
|
||||
#### Change some parameters for a local run
|
||||
If you want to change some particular settings (eg. the memory limit, the rules level, ...) for a local run of the analysis you have 2 choices.
|
||||
|
||||
##### Method 1: CLI parameter
|
||||
For most parameters there is a good chance you can just add the parameter and its value in your command, which will override the one defined in the configuration file. \
|
||||
Below are some example, but your can find the complete reference [here](https://phpstan.org/user-guide/command-line-usage).
|
||||
|
||||
```bash
|
||||
--memory-limit 1G
|
||||
--level 5
|
||||
--error-format raw
|
||||
[...]
|
||||
```
|
||||
|
||||
**Pros** Quick and easy to try different parameters \
|
||||
**Cons** Parameters aren't saved, so you'll have to remember them and put them again next time
|
||||
|
||||
##### Method 2: Configuration file
|
||||
Crafting your own configuration file gives you the ability to fine tune any parameters, it's way more powerful but can also quickly lead to crashes if you mess with the symbols discovery (classes, ...). \
|
||||
But mostly it can be saved, shared, re-used; which is it's main purpose.
|
||||
|
||||
It is recommended that you create your configuration file from scratch and that you include the `base.dist.neon` so you are bootstrapped for the symbols discovery. Then you can override any parameter. \
|
||||
Check [the documentation](https://phpstan.org/config-reference#multiple-files) for more information.
|
||||
|
||||
```neon
|
||||
includes:
|
||||
- base.dist.neon
|
||||
|
||||
parameters:
|
||||
# Override parameters here
|
||||
```
|
||||
|
||||
#### Analyse only one (or some) folder(s) quicker
|
||||
It's pretty easy and good news you don't need to create a new configuration file or change an existing one. \
|
||||
Just adapt and use command lines from the [usages section](#usages) and add the folders you want to analyse at the end of the command, exactly like when analysing modules.
|
||||
|
||||
For example if you want to analyse just `<ITOP>/setup` and `<ITOP>/sources`, use something like:
|
||||
```
|
||||
tests/php-static-analysis/vendor/bin/phpstan analyse \
|
||||
--configuration ./tests/php-static-analysis/config/for-package.dist.neon \
|
||||
--error-format raw \
|
||||
setup sources
|
||||
```
|
||||
|
||||
### Adjust configuration for a particular CI repository / job
|
||||
TODO
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"require": {
|
||||
"phpstan/phpstan": "^2.1"
|
||||
}
|
||||
}
|
||||
72
tests/php-static-analysis/composer.lock
generated
72
tests/php-static-analysis/composer.lock
generated
@@ -1,72 +0,0 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "cc6d7580a5e98236d68d8b91de9ddebb",
|
||||
"packages": [
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "2.1.33",
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f",
|
||||
"reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpstan/phpstan-shim": "*"
|
||||
},
|
||||
"bin": [
|
||||
"phpstan",
|
||||
"phpstan.phar"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan - PHP Static Analysis Tool",
|
||||
"keywords": [
|
||||
"dev",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://phpstan.org/user-guide/getting-started",
|
||||
"forum": "https://github.com/phpstan/phpstan/discussions",
|
||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||
"security": "https://github.com/phpstan/phpstan/security/policy",
|
||||
"source": "https://github.com/phpstan/phpstan-src"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ondrejmirtes",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/phpstan",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-05T10:24:31+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
## Disclaimer
|
||||
DON'T modify the following files without knowledge and discussing with the team:
|
||||
- base.dist.neon
|
||||
- for-package.dist.neon
|
||||
- for-module.dist.neon
|
||||
|
||||
## Purpose of these files
|
||||
### base.dist.neon
|
||||
This configuration file contains the common parameters for all analysis, whereas it is a package, a module or something specific. Among others:
|
||||
- Rules level for analysis
|
||||
- PHP version to compare
|
||||
- Necessary files for autoloaders discovery and such
|
||||
- ...
|
||||
|
||||
This file should not be modified for your specific needs, you should always include it and override the desired parameters. \
|
||||
See how it is done in `for-package.dist.neon` and `for-module.dist.neon` or on the documentation [here](https://phpstan.org/config-reference#multiple-files).
|
||||
|
||||
### for-package.dist.neon
|
||||
This configuration file contains the parameters to analyse a package (iTop core, modules, third-party libs).
|
||||
|
||||
### for-module.dist.neon
|
||||
This configuration file contains the parameters to analyse one or more modules only.
|
||||
|
||||
## How / when can I modify these files?
|
||||
**You CAN'T!** \
|
||||
Well, unless there is a good reason and you talked about it with the team. But you should never modify them for a specific need on your local environment.
|
||||
|
||||
- If you have a particular need for your local environment (eg. increase memory limit, change rules levels, analyse only a specific folder), check the [Configuration section](../#configuration) of the main README.md.
|
||||
- If you feel like there is need for an adjustment in the default configurations, discuss it with th team and make a PR.
|
||||
@@ -1,40 +0,0 @@
|
||||
includes:
|
||||
- php-includes/set-php-version-from-process.php # Workaround to set PHP version to the on running the CLI
|
||||
# for an explanation of the baseline concept, see: https://phpstan.org/user-guide/baseline
|
||||
#baseline HERE DO NOT REMOVE FOR CI
|
||||
|
||||
parameters:
|
||||
level: 0
|
||||
#phpVersion: null # Explicitly commented as we rather use the detected version from the above include (`php-includes/target-php-version.php`)
|
||||
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' # Open in PHPStorm as it's Combodo's default IDE
|
||||
bootstrapFiles:
|
||||
- ../../../approot.inc.php
|
||||
- ../../../bootstrap.inc.php
|
||||
|
||||
scanFiles:
|
||||
# Files necessary as they contain some declarations (constants, classes, functions, ...)
|
||||
- ../../../approot.inc.php
|
||||
- ../../../bootstrap.inc.php
|
||||
excludePaths:
|
||||
analyse:
|
||||
# For third-party libs we should analyse them in a dedicated configuration as we can't improve / clean them which would
|
||||
# prevent us from raising the rules level as we improve / clean our codebase
|
||||
- ../../../lib # Irrelevant as we only want to analyze our codebase
|
||||
- ../../../node_modules # Irrelevant as we only want to analyze our codebase
|
||||
analyseAndScan:
|
||||
# This file generates "unignorable errors" for the baseline due to its format, so we don't have any other choice than to exclude it.
|
||||
# But mind that it will prevent PHPStan from warning us about PHP syntax errors in this file.
|
||||
- ../../../core/oql/build/PHP/Lempar.php
|
||||
|
||||
#- ../../../data # Left and commented on purpose to show that we want to analyse the generated cache files
|
||||
|
||||
# Note 1: We can't analyse these folders as if a PHP file requires another PHP element declared in an XML file, it won't find it. So we rely only on `env-production`
|
||||
# Note 2: Only the options selected during the setup will be analysed correctly in `env-production`. For unselected options, we still want to ignore them during the analysis as they would only give a false sentiment of security as their XML PHP classes / snippets / etc would not be tested.
|
||||
- ../../../data/production-modules (?) # Irrelevent as it will already be in `env-production` (for local run only, not useful in the CI)
|
||||
- ../../../datamodels # Irrelevent as it will already be in `env-production`
|
||||
- ../../../extensions # Irrelevent as it will already be in `env-production` (for local run only, not useful in the CI)
|
||||
- ../../../env-php-unit-tests (?) # Irrelevant as it will either already be in `env-production` or might be desynchronized from `env-production`
|
||||
- ../../../env-toolkit (?) # Irrelevent as it will either already be in `env-production` or might be desynchronized from `env-production` (for local run only, not useful in the CI)
|
||||
|
||||
- ../../../tests (?) # Exclude tests for now
|
||||
- ../../../toolkit (?) # Exlclude toolkit for now
|
||||
@@ -1,15 +0,0 @@
|
||||
includes:
|
||||
- base.dist.neon
|
||||
|
||||
parameters:
|
||||
paths:
|
||||
# We just want to analyse the module folder(s), either:
|
||||
# - Create your own `for-module.neon` file, include this one and override this parameter (see https://phpstan.org/config-reference#multiple-files)
|
||||
# - Pass the module folder(s) in the commande line (see https://phpstan.org/config-reference#analysed-files)
|
||||
scanDirectories:
|
||||
# Unlike for `for-package.dist.neon`, here we need to scan all the folders to discover symbols, but we only want to analyse the module folder.
|
||||
# We initially thought of doing it through the `excludePaths` param. by excluding everything but the module folder, but it doesn't seem to be possible, because it uses the `fnmatch()` function.
|
||||
# As a workaround, we list here all the folders to scan.
|
||||
#
|
||||
# Scan the whole project and rely on the `excludePaths` param. to filter the unnecessary
|
||||
- ../../..
|
||||
@@ -1,7 +0,0 @@
|
||||
includes:
|
||||
- base.dist.neon
|
||||
|
||||
parameters:
|
||||
paths:
|
||||
# We want to analyse almost the whole project, so we do a negative selection between the `paths` and `excludePaths` (see base.dist.neon) parameters
|
||||
- ../../../
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is only here to allow setting a specific PHP version to run the analysis for without
|
||||
* having to explicitly set it in the .neon file. This is the best way we found so far.
|
||||
*
|
||||
* @link https://phpstan.org/config-reference#phpversion
|
||||
*
|
||||
* Usage: Uses the CLI PHP version by default, which would work fine for
|
||||
* - The CI as the docker image has the target PHP version in both CLI and web
|
||||
* - The developer's IDE as PHPStorm also has a default PHP version configured which can be changed on the fly
|
||||
*/
|
||||
|
||||
// Default PHP version to analyse is the one running in CLI
|
||||
$config = [];
|
||||
$config['parameters']['phpVersion'] = PHP_VERSION_ID;
|
||||
|
||||
return $config;
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
Documentation on creating and maintaining tests in iTop.
|
||||
|
||||
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
||||
### PHPUnit configuration file
|
||||
@@ -75,8 +78,7 @@ Example :
|
||||
$oTagData->DBDelete();
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> When the condition is met the test is finished and following code will be ignored !
|
||||
Warning : when the condition is met the test is finished and following code will be ignored !
|
||||
|
||||
Another way to do is using try/catch blocks, for example :
|
||||
```php
|
||||
|
||||
@@ -28,14 +28,14 @@ class AjaxPageTest extends ItopDataTestCase
|
||||
$iLastCompilation = filemtime(APPROOT.'env-production');
|
||||
|
||||
// When
|
||||
$sOutput = $this->CallItopUri(
|
||||
"pages/exec.php?exec_module=itop-hub-connector&exec_page=ajax.php",
|
||||
$sOutput = $this->CallItopUrl(
|
||||
"/pages/exec.php?exec_module=itop-hub-connector&exec_page=ajax.php",
|
||||
[
|
||||
'auth_user' => $sLogin,
|
||||
'auth_pwd' => self::AUTHENTICATION_PASSWORD,
|
||||
'operation' => "compile",
|
||||
'authent' => self::AUTHENTICATION_TOKEN,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Then
|
||||
@@ -53,4 +53,26 @@ class AjaxPageTest extends ItopDataTestCase
|
||||
clearstatcache();
|
||||
$this->assertGreaterThan($iLastCompilation, filemtime(APPROOT.'env-production'), 'The env-production directory should have been rebuilt');
|
||||
}
|
||||
|
||||
protected function CallItopUrl($sUri, ?array $aPostFields = null, bool $bXDebugEnabled = false)
|
||||
{
|
||||
$ch = curl_init();
|
||||
if ($bXDebugEnabled) {
|
||||
curl_setopt($ch, CURLOPT_COOKIE, 'XDEBUG_SESSION=phpstorm');
|
||||
}
|
||||
|
||||
$sUrl = \MetaModel::GetConfig()->Get('app_root_url')."/$sUri";
|
||||
var_dump($sUrl);
|
||||
curl_setopt($ch, CURLOPT_URL, $sUrl);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
$sOutput = curl_exec($ch);
|
||||
//echo "$sUrl error code:".curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $sOutput;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -25,15 +24,19 @@
|
||||
require_once('../../../approot.inc.php');
|
||||
require_once(APPROOT.'application/startup.inc.php');
|
||||
|
||||
|
||||
$sEnvironment = MetaModel::GetEnvironmentId();
|
||||
$aEntries = [];
|
||||
$aEntries = array();
|
||||
$aCacheUserData = apc_cache_info_compat();
|
||||
if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list'])) {
|
||||
if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list']))
|
||||
{
|
||||
$sPrefix = 'itop-'.$sEnvironment.'-query-cache-';
|
||||
|
||||
foreach ($aCacheUserData['cache_list'] as $i => $aEntry) {
|
||||
foreach($aCacheUserData['cache_list'] as $i => $aEntry)
|
||||
{
|
||||
$sEntryKey = array_key_exists('info', $aEntry) ? $aEntry['info'] : $aEntry['key'];
|
||||
if (strpos($sEntryKey, $sPrefix) === 0) {
|
||||
if (strpos($sEntryKey, $sPrefix) === 0)
|
||||
{
|
||||
$aEntries[] = $sEntryKey;
|
||||
}
|
||||
}
|
||||
@@ -41,39 +44,52 @@ if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list'])) {
|
||||
|
||||
echo "<pre>";
|
||||
|
||||
if (empty($aEntries)) {
|
||||
if (empty($aEntries))
|
||||
{
|
||||
echo "No Data";
|
||||
return;
|
||||
}
|
||||
|
||||
$sKey = $aEntries[0];
|
||||
$result = apc_fetch($sKey);
|
||||
if (!is_object($result)) {
|
||||
if (!is_object($result))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$oSQLQuery = $result;
|
||||
|
||||
echo "NB Tables before;NB Tables after;";
|
||||
foreach ($oSQLQuery->m_aContextData as $sField => $oValue) {
|
||||
foreach($oSQLQuery->m_aContextData as $sField => $oValue)
|
||||
{
|
||||
echo $sField.';';
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
sort($aEntries);
|
||||
|
||||
foreach ($aEntries as $sKey) {
|
||||
foreach($aEntries as $sKey)
|
||||
{
|
||||
$result = apc_fetch($sKey);
|
||||
if (is_object($result)) {
|
||||
if (is_object($result))
|
||||
{
|
||||
$oSQLQuery = $result;
|
||||
if (isset($oSQLQuery->m_aContextData)) {
|
||||
if (isset($oSQLQuery->m_aContextData))
|
||||
{
|
||||
echo $oSQLQuery->m_iOriginalTableCount.";".$oSQLQuery->CountTables().';';
|
||||
foreach ($oSQLQuery->m_aContextData as $oValue) {
|
||||
if (is_array($oValue)) {
|
||||
foreach($oSQLQuery->m_aContextData as $oValue)
|
||||
{
|
||||
if (is_array($oValue))
|
||||
{
|
||||
$sVal = json_encode($oValue);
|
||||
} else {
|
||||
if (empty($oValue)) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($oValue))
|
||||
{
|
||||
$sVal = '';
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$sVal = $oValue;
|
||||
}
|
||||
}
|
||||
@@ -85,3 +101,4 @@ foreach ($aEntries as $sKey) {
|
||||
}
|
||||
|
||||
echo "</pre>";
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ use ArchivedObjectException;
|
||||
use CMDBObject;
|
||||
use CMDBSource;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
use Config;
|
||||
use Contact;
|
||||
use CoreException;
|
||||
use CoreUnexpectedValue;
|
||||
@@ -71,9 +70,6 @@ abstract class ItopDataTestCase extends ItopTestCase
|
||||
private $aCreatedObjects = [];
|
||||
private $aEventListeners = [];
|
||||
|
||||
protected ?string $sConfigTmpBackupFile = null;
|
||||
protected ?Config $oiTopConfig = null;
|
||||
|
||||
/**
|
||||
* @var bool When testing with silo, there are some cache we need to update on tearDown. Doing it all the time will cost too much, so it's opt-in !
|
||||
* @see tearDown
|
||||
@@ -128,8 +124,6 @@ abstract class ItopDataTestCase extends ItopTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
\IssueLog::Error($this->getName());
|
||||
|
||||
$this->PrepareEnvironment();
|
||||
|
||||
if (static::USE_TRANSACTION) {
|
||||
@@ -196,8 +190,6 @@ abstract class ItopDataTestCase extends ItopTestCase
|
||||
|
||||
CMDBObject::SetCurrentChange(null);
|
||||
|
||||
$this->RestoreConfiguration();
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
@@ -1525,35 +1517,4 @@ abstract class ItopDataTestCase extends ItopTestCase
|
||||
$oObject->Set($sStopwatchAttCode, $oStopwatch);
|
||||
}
|
||||
|
||||
protected function BackupConfiguration(): void
|
||||
{
|
||||
$sConfigPath = MetaModel::GetConfig()->GetLoadedFile();
|
||||
clearstatcache();
|
||||
echo sprintf("rights via ls on %s:\n %s \n", $sConfigPath, exec("ls -al $sConfigPath"));
|
||||
$sFilePermOutput = substr(sprintf('%o', fileperms('/etc/passwd')), -4);
|
||||
echo sprintf("rights via fileperms on %s:\n %s \n", $sConfigPath, $sFilePermOutput);
|
||||
|
||||
$this->sConfigTmpBackupFile = tempnam(sys_get_temp_dir(), "config_");
|
||||
MetaModel::GetConfig()->WriteToFile($this->sConfigTmpBackupFile);
|
||||
$this->oiTopConfig = new Config($sConfigPath);
|
||||
}
|
||||
|
||||
protected function RestoreConfiguration(): void
|
||||
{
|
||||
if (is_null($this->sConfigTmpBackupFile) || ! is_file($this->sConfigTmpBackupFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_null($this->oiTopConfig)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//put config back
|
||||
$sConfigPath = $this->oiTopConfig->GetLoadedFile();
|
||||
@chmod($sConfigPath, 0770);
|
||||
$oConfig = new Config($this->sConfigTmpBackupFile);
|
||||
$oConfig->WriteToFile($sConfigPath);
|
||||
@chmod($sConfigPath, 0440);
|
||||
@unlink($this->sConfigTmpBackupFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
namespace Combodo\iTop\Test\UnitTest;
|
||||
|
||||
use CMDBSource;
|
||||
use DateTime;
|
||||
use DeprecatedCallsLog;
|
||||
use MySQLTransactionNotClosedException;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use ReflectionMethod;
|
||||
use SetupUtils;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
use const DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||
@@ -28,7 +29,6 @@ use const DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||
abstract class ItopTestCase extends KernelTestCase
|
||||
{
|
||||
public const TEST_LOG_DIR = 'test';
|
||||
protected array $aFileToClean = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
@@ -37,7 +37,7 @@ abstract class ItopTestCase extends KernelTestCase
|
||||
public const DISABLE_DEPRECATEDCALLSLOG_ERRORHANDLER = true;
|
||||
public static $DEBUG_UNIT_TEST = false;
|
||||
protected static $aBackupStaticProperties = [];
|
||||
public ?array $aLastCurlGetInfo = null;
|
||||
|
||||
/**
|
||||
* @link https://docs.phpunit.de/en/9.6/annotations.html#preserveglobalstate PHPUnit `preserveGlobalState` annotation documentation
|
||||
*
|
||||
@@ -175,15 +175,6 @@ abstract class ItopTestCase extends KernelTestCase
|
||||
}
|
||||
throw new MySQLTransactionNotClosedException('Some DB transactions were opened but not closed ! Fix the code by adding ROLLBACK or COMMIT statements !', []);
|
||||
}
|
||||
|
||||
foreach ($this->aFileToClean as $sPath) {
|
||||
if (is_file($sPath)) {
|
||||
@unlink($sPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
SetupUtils::tidydir($sPath);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -640,62 +631,4 @@ abstract class ItopTestCase extends KernelTestCase
|
||||
fclose($handle);
|
||||
return array_reverse($aLines);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sUrl
|
||||
* @param array|null $aPostFields
|
||||
* @param array|null $aCurlOptions
|
||||
* @param $bXDebugEnabled
|
||||
* @return string
|
||||
*/
|
||||
protected function CallUrl($sUrl, ?array $aPostFields = [], ?array $aCurlOptions = [], $bXDebugEnabled = false): string
|
||||
{
|
||||
$ch = curl_init();
|
||||
if ($bXDebugEnabled) {
|
||||
curl_setopt($ch, CURLOPT_COOKIE, "XDEBUG_SESSION=phpstorm");
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $sUrl);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
// Force disable of certificate check as most of dev / test env have a self-signed certificate
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt_array($ch, $aCurlOptions);
|
||||
if ($this->IsArrayOfArray($aPostFields)) {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($aPostFields));
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields);
|
||||
}
|
||||
|
||||
$sOutput = curl_exec($ch);
|
||||
|
||||
$info = curl_getinfo($ch);
|
||||
$this->aLastCurlGetInfo = $info;
|
||||
$sErrorMsg = curl_error($ch);
|
||||
$iErrorCode = curl_errno($ch);
|
||||
curl_close($ch);
|
||||
|
||||
\IssueLog::Info(__METHOD__, null, ['url' => $sUrl, 'error' => $sErrorMsg, 'error_code' => $iErrorCode, 'post_fields' => $aPostFields, 'info' => $info]);
|
||||
|
||||
return $sOutput;
|
||||
}
|
||||
|
||||
private function IsArrayOfArray(array $aStruct): bool
|
||||
{
|
||||
foreach ($aStruct as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function CallItopUri(string $sUri, ?array $aPostFields = [], ?array $aCurlOptions = [], $bXDebugEnabled = false): string
|
||||
{
|
||||
$sUrl = \MetaModel::GetConfig()->Get('app_root_url')."/$sUri";
|
||||
|
||||
return $this->CallUrl($sUrl, $aPostFields, $aCurlOptions, $bXDebugEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
63
tests/php-unit-tests/unitary-tests/application/LoginTest.php
Normal file
63
tests/php-unit-tests/unitary-tests/application/LoginTest.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Application;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use MetaModel;
|
||||
|
||||
class LoginTest extends ItopDataTestCase
|
||||
{
|
||||
protected $sConfigTmpBackupFile;
|
||||
protected $sConfigPath;
|
||||
protected $sLoginMode;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
// The test consists in requesting UI.php from outside iTop with a specific configuration
|
||||
// Hence the configuration file must be tweaked on disk (and restored)
|
||||
$this->sConfigPath = MetaModel::GetConfig()->GetLoadedFile();
|
||||
$this->sConfigTmpBackupFile = tempnam(sys_get_temp_dir(), "config_");
|
||||
file_put_contents($this->sConfigTmpBackupFile, file_get_contents($this->sConfigPath));
|
||||
|
||||
$oConfig = new \Config($this->sConfigPath);
|
||||
$this->sLoginMode = "unimplemented_loginmode";
|
||||
$oConfig->AddAllowedLoginTypes($this->sLoginMode);
|
||||
|
||||
@chmod($this->sConfigPath, 0770);
|
||||
$oConfig->WriteToFile();
|
||||
@chmod($this->sConfigPath, 0444);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if (! is_null($this->sConfigTmpBackupFile) && is_file($this->sConfigTmpBackupFile)) {
|
||||
//put config back
|
||||
@chmod($this->sConfigPath, 0770);
|
||||
file_put_contents($this->sConfigPath, file_get_contents($this->sConfigTmpBackupFile));
|
||||
@chmod($this->sConfigPath, 0444);
|
||||
@unlink($this->sConfigTmpBackupFile);
|
||||
}
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
protected function CallItopUrlByCurl($sUri, ?array $aPostFields = [])
|
||||
{
|
||||
$ch = curl_init();
|
||||
|
||||
$sUrl = MetaModel::GetConfig()->Get('app_root_url')."/$sUri";
|
||||
curl_setopt($ch, CURLOPT_URL, $sUrl);
|
||||
if (0 !== sizeof($aPostFields)) {
|
||||
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$sOutput = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
return $sOutput;
|
||||
}
|
||||
}
|
||||
@@ -143,12 +143,34 @@ class QueryTest extends ItopDataTestCase
|
||||
{
|
||||
// compute request url
|
||||
$url = $oQuery->GetExportUrl();
|
||||
$aCurlOptions = [
|
||||
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
|
||||
CURLOPT_USERPWD => self::USER.':'.self::PASSWORD,
|
||||
];
|
||||
|
||||
return $this->CallUrl($url, [], $aCurlOptions);
|
||||
// open curl
|
||||
$curl = curl_init();
|
||||
|
||||
// curl options
|
||||
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||
curl_setopt($curl, CURLOPT_USERPWD, self::USER.':'.self::PASSWORD);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
// Force disable of certificate check as most of dev / test env have a self-signed certificate
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
|
||||
// execute curl
|
||||
$result = curl_exec($curl);
|
||||
if (curl_errno($curl)) {
|
||||
$info = curl_getinfo($curl);
|
||||
var_export($info);
|
||||
var_dump([
|
||||
'url' => $url,
|
||||
'app_root_url:' => MetaModel::GetConfig()->Get('app_root_url'),
|
||||
'GetAbsoluteUrlAppRoot:' => \utils::GetAbsoluteUrlAppRoot(),
|
||||
]);
|
||||
}
|
||||
// close curl
|
||||
curl_close($curl);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
|
||||
class DBObjectSetTest extends ItopDataTestCase
|
||||
{
|
||||
public const USE_TRANSACTION = true;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
$this->CreateURs();
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
CMDBSource::TriggerExceptionWhenSqlQuery(null);
|
||||
parent::tearDown(); // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
private function CreateURs()
|
||||
{
|
||||
$this->CreateTestOrganization();
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$this->CreateTicket($i);
|
||||
}
|
||||
}
|
||||
|
||||
public function testCount()
|
||||
{
|
||||
$oSearch = DBObjectSearch::FromOQL_AllData("SELECT UserRequest");
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
|
||||
$iCount = $oSet->Count();
|
||||
$oSet->Fetch();
|
||||
$this->assertEquals($iCount, $oSet->Count());
|
||||
$this->assertEquals($iCount, $oSet->CountWithLimit(0));
|
||||
$this->assertTrue($oSet->CountExceeds(0));
|
||||
|
||||
//no DB SQL query: exception will be raised after here
|
||||
CMDBSource::TriggerExceptionWhenSqlQuery(__METHOD__.' :'.__LINE__);
|
||||
$this->assertEquals($iCount, $oSet->Count(), 'should use cache and not call DB again');
|
||||
}
|
||||
|
||||
public function testRewind()
|
||||
{
|
||||
$oSearch = DBObjectSearch::FromOQL_AllData("SELECT UserRequest");
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
|
||||
while ($oObj = $oSet->Fetch()) {
|
||||
$this->assertNotEquals(0, $oObj->GetKey());
|
||||
}
|
||||
|
||||
//no DB SQL query: exception will be raised after here
|
||||
CMDBSource::TriggerExceptionWhenSqlQuery(__METHOD__.' :'.__LINE__);
|
||||
$oSet->Rewind();
|
||||
while ($oObj = $oSet->Fetch()) {
|
||||
$this->assertNotEquals(0, $oObj->GetKey());
|
||||
}
|
||||
}
|
||||
|
||||
public function testDBObjectSetComparator()
|
||||
{
|
||||
$oSearch = DBObjectSearch::FromOQL_AllData("SELECT UserRequest");
|
||||
$DBObjectSet1 = new DBObjectSet($oSearch);
|
||||
$DBObjectSet3 = new DBObjectSet($oSearch);
|
||||
$oDBObjectSetComparator = new DBObjectSetComparator($DBObjectSet1, $DBObjectSet3);
|
||||
$this->assertTrue($oDBObjectSetComparator->SetsAreEquivalent());
|
||||
}
|
||||
|
||||
public function testDBObjectSetComparator_CheckCache()
|
||||
{
|
||||
$oSearch = DBObjectSearch::FromOQL_AllData("SELECT UserRequest");
|
||||
$DBObjectSet1 = new DBObjectSet($oSearch);
|
||||
$DBObjectSet3 = new DBObjectSet($oSearch);
|
||||
$oDBObjectSetComparator = new DBObjectSetComparator($DBObjectSet1, $DBObjectSet3);
|
||||
$this->assertTrue($oDBObjectSetComparator->SetsAreEquivalent());
|
||||
|
||||
$sMsg = __METHOD__.' :'.__LINE__;
|
||||
//no DB SQL query: exception will be raised after here
|
||||
CMDBSource::TriggerExceptionWhenSqlQuery($sMsg);
|
||||
$oDBObjectSetComparator = new DBObjectSetComparator($DBObjectSet1, $DBObjectSet3);
|
||||
$this->assertTrue($oDBObjectSetComparator->SetsAreEquivalent());
|
||||
|
||||
$oDBObjectSetComparator = new DBObjectSetComparator($DBObjectSet1, new DBObjectSet($oSearch));
|
||||
$this->expectExceptionMessage($sMsg, "should call DB again this time");
|
||||
$this->assertTrue($oDBObjectSetComparator->SetsAreEquivalent());
|
||||
}
|
||||
|
||||
public static function JeffreyProvider()
|
||||
{
|
||||
return [
|
||||
'basic' => [false],
|
||||
'opt trick' => [true],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider JeffreyProvider
|
||||
*/
|
||||
public function testJeffrey(bool $bTrick)
|
||||
{
|
||||
echo '<p>-------</p>';
|
||||
|
||||
$this->doesNotPerformAssertions();
|
||||
$iMax = 100;
|
||||
|
||||
|
||||
$oFilter = DBObjectSearch::FromOQL_AllData('SELECT UserRequest');
|
||||
$oSet = new DBObjectSet($oFilter);
|
||||
$oSet->OptimizeColumnLoad([
|
||||
'UserRequest' => ['ref', 'status', 'title'],
|
||||
]);
|
||||
|
||||
if ($bTrick) {
|
||||
$oNewSet = DBObjectSet::FromScratch($oSet->GetClass());
|
||||
while ($oObj = $oSet->Fetch()) {
|
||||
$oNewSet->AddObject($oObj);
|
||||
}
|
||||
$oSet = $oNewSet;
|
||||
}
|
||||
|
||||
echo '<p>Start: '.date('Y-m-d H:i:s').'</p>';
|
||||
$i = 0;
|
||||
while ($i < $iMax) {
|
||||
$oSet->Rewind();
|
||||
while ($oObj = $oSet->Fetch()) {
|
||||
// Do nothing
|
||||
$s = $oObj->Get('title');
|
||||
}
|
||||
|
||||
$i += 1;
|
||||
}
|
||||
|
||||
$peak = memory_get_peak_usage(true) / 1000000;
|
||||
echo '<p>End: '.date('Y-m-d H:i:s').'</p><p>Peak memory: '.$peak.'</p> \n';
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,10 @@ class CliResetSessionTest extends ItopDataTestCase
|
||||
public const USE_TRANSACTION = false;
|
||||
|
||||
private $sCookieFile = "";
|
||||
private $sUrl;
|
||||
private $sLogin;
|
||||
private $sPassword = "Iuytrez9876543ç_è-(";
|
||||
protected $sConfigTmpBackupFile;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
@@ -22,13 +24,16 @@ class CliResetSessionTest extends ItopDataTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->BackupConfiguration();
|
||||
$this->sConfigTmpBackupFile = tempnam(sys_get_temp_dir(), "config_");
|
||||
MetaModel::GetConfig()->WriteToFile($this->sConfigTmpBackupFile);
|
||||
|
||||
$this->sLogin = "rest-user-".date('dmYHis');
|
||||
$this->CreateTestOrganization();
|
||||
|
||||
$this->sCookieFile = tempnam(sys_get_temp_dir(), 'jsondata_');
|
||||
|
||||
$this->sUrl = \MetaModel::GetConfig()->Get('app_root_url');
|
||||
|
||||
$oRestProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'REST Services User'], true);
|
||||
$oAdminProfile = \MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", ['name' => 'Administrator'], true);
|
||||
|
||||
@@ -42,6 +47,16 @@ class CliResetSessionTest extends ItopDataTestCase
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
if (! is_null($this->sConfigTmpBackupFile) && is_file($this->sConfigTmpBackupFile)) {
|
||||
//put config back
|
||||
$sConfigPath = MetaModel::GetConfig()->GetLoadedFile();
|
||||
@chmod($sConfigPath, 0770);
|
||||
$oConfig = new Config($this->sConfigTmpBackupFile);
|
||||
$oConfig->WriteToFile($sConfigPath);
|
||||
@chmod($sConfigPath, 0444);
|
||||
unlink($this->sConfigTmpBackupFile);
|
||||
}
|
||||
|
||||
if (!empty($this->sCookieFile)) {
|
||||
unlink($this->sCookieFile);
|
||||
}
|
||||
@@ -135,18 +150,26 @@ class CliResetSessionTest extends ItopDataTestCase
|
||||
*/
|
||||
private function SendHTTPRequestWithCookies($sUri, $aPostFields, $sForcedLoginMode = null): string
|
||||
{
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->sCookieFile);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->sCookieFile);
|
||||
|
||||
$sUrl = "$this->sUrl/$sUri";
|
||||
if (!is_null($sForcedLoginMode)) {
|
||||
$sUri .= "?login_mode=$sForcedLoginMode";
|
||||
$sUrl .= "?login_mode=$sForcedLoginMode";
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_URL, $sUrl);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
// Force disable of certificate check as most of dev / test env have a self-signed certificate
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
|
||||
$aCurlOptions = [
|
||||
CURLOPT_COOKIEJAR => $this->sCookieFile,
|
||||
CURLOPT_COOKIEFILE => $this->sCookieFile,
|
||||
CURLOPT_HEADER => 1,
|
||||
];
|
||||
|
||||
$sResponse = $this->CallItopUri($sUri, $aPostFields, $aCurlOptions);
|
||||
var_dump($this->aLastCurlGetInfo);
|
||||
$sResponse = curl_exec($ch);
|
||||
/** $sResponse example
|
||||
* "HTTP/1.1 200 OK
|
||||
Date: Wed, 07 Jun 2023 05:00:40 GMT
|
||||
@@ -154,15 +177,16 @@ class CliResetSessionTest extends ItopDataTestCase
|
||||
Set-Cookie: itop-2e83d2e9b00e354fdc528621cac532ac=q7ldcjq0rvbn33ccr9q8u8e953; path=/
|
||||
*/
|
||||
//var_dump($sResponse);
|
||||
$iHeaderSize = $this->aLastCurlGetInfo['header_size'] ?? 0;
|
||||
$iHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$sBody = substr($sResponse, $iHeaderSize);
|
||||
|
||||
//$iHttpCode = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||
if (preg_match('/HTTP.* (\d*) /', $sResponse, $aMatches)) {
|
||||
$sHttpCode = $aMatches[1];
|
||||
} else {
|
||||
$sHttpCode = $this->aLastCurlGetInfo['http_code'] ?? -1;
|
||||
$sHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
$this->assertEquals(200, $sHttpCode, "The test logic assumes that the HTTP request is correctly handled");
|
||||
return $sBody;
|
||||
|
||||
@@ -17,6 +17,7 @@ class RestTest extends ItopDataTestCase
|
||||
public const USE_TRANSACTION = false;
|
||||
public const CREATE_TEST_ORG = false;
|
||||
|
||||
private static $sUrl;
|
||||
private static $sLogin;
|
||||
private static $sPassword = "Iuytrez9876543ç_è-(";
|
||||
|
||||
@@ -43,6 +44,7 @@ class RestTest extends ItopDataTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
static::$sUrl = MetaModel::GetConfig()->Get('app_root_url');
|
||||
static::$sLogin = "rest-user-".date('dmYHis');
|
||||
|
||||
$this->CreateTestOrganization();
|
||||
@@ -94,6 +96,7 @@ class RestTest extends ItopDataTestCase
|
||||
|
||||
public function testPostJSONDataAsCurlFile()
|
||||
{
|
||||
$sCallbackName = 'fooCallback';
|
||||
$sJsonData = '{"operation": "list_operations"}';
|
||||
|
||||
// Test regular JSON result
|
||||
@@ -294,7 +297,16 @@ JSON;
|
||||
$aPostFields['callback'] = $sCallbackName;
|
||||
}
|
||||
|
||||
$sJson = $this->CallItopUri('webservices/rest.php', $aPostFields);
|
||||
curl_setopt($ch, CURLOPT_URL, static::$sUrl."/webservices/rest.php");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $aPostFields);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
// Force disable of certificate check as most of dev / test env have a self-signed certificate
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
|
||||
$sJson = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
if (!is_null($sTmpFile)) {
|
||||
unlink($sTmpFile);
|
||||
|
||||
Reference in New Issue
Block a user