Compare commits

..

2 Commits

26 changed files with 966 additions and 1404 deletions

View File

@@ -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)',

View File

@@ -52,6 +52,8 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
*/
protected $bHasDelta = false;
protected $bAllowAllData = false;
/**
* Object from the original set, minus the removed objects
* @var DBObject[] array of iObjectId => DBObject
@@ -118,6 +120,11 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
return clone $this->oOriginalSet->GetFilter();
}
public function AllowAllData(): void
{
$this->bAllowAllData = true;
}
/**
* Specify the subset of attributes to load (for each class of objects) before performing the SQL query for retrieving the rows from the DB
*
@@ -309,6 +316,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
return $ret;
}
/**
* Return the current element
*
@@ -329,7 +337,7 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
$iPreservedCount = count($this->aPreserved);
if ($this->iCursor < $iPreservedCount) {
$sId = key($this->aPreserved);
$oRet = MetaModel::GetObject($this->sClass, $sId);
$oRet = MetaModel::GetObject($this->sClass, $sId, true, $this->bAllowAllData);
} else {
$iModifiedCount = count($this->aModified);
if ($this->iCursor < $iPreservedCount + $iModifiedCount) {

File diff suppressed because one or more lines are too long

View File

@@ -311,35 +311,29 @@ fieldset {
}
.module-selection-body {
overflow: auto;
box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, .06) !important;
background-color: #F7FAFC;
padding: 10px;
.wiz-choice{
&:checked ~ .description {
#itop-ticket-mgmt-simple-ticket-enhanced-portal:not(:checked),
#itop-ticket-mgmt-itil-enhanced-portal:not(:checked) {
~ .description::after {
content: "Legacy portal is no longer part of iTop, by leaving this option unchecked your portal users won't be able to access iTop anymore.";
display: block;
margin-top: 0.5em;
font-weight: bold;
color: $legacy-portal-removal-text-color;
}
}
}
&:not(:checked) ~ label .setup-extension-tag.checked{
display:none;
}
&:checked ~ label .setup-extension-tag.unchecked{
display:none;
}
}
overflow: auto;
box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, .06) !important;
background-color: #F7FAFC;
padding: 10px;
.wiz-choice:checked ~ .description {
#itop-ticket-mgmt-simple-ticket-enhanced-portal:not(:checked),
#itop-ticket-mgmt-itil-enhanced-portal:not(:checked) {
~ .description::after {
content: "Legacy portal is no longer part of iTop, by leaving this option unchecked your portal users won't be able to access iTop anymore.";
display: block;
margin-top: 0.5em;
font-weight: bold;
color: $legacy-portal-removal-text-color;
}
}
}
}
body {
font-size: 1.17rem;
font-family: "Raleway";
@@ -601,35 +595,6 @@ body {
color: $ibo-color-blue-700;
font-size: $ibo-font-size-200;
}
.setup-extension--missing .setup-extension--icon{
color:#a00000;
}
.setup-extension-tag {
background-color: grey;
border-radius: 8px;
padding-left: 3px;
padding-right: 3px;
margin-right: 3px;
&.installed{
background-color:#9eff9e
}
&.notinstalled{
background-color:#ed9eff
}
&.tobeinstalled{
background-color:#9ef0ff
}
&.tobeuninstalled{
background-color:#ff9e9e
}
&.notuninstallable{
background-color:#ffc98c
}
&.removed{
background-color: #969594
}
}
.setup--wizard-choice--label + .setup--wizard-choice--more-info {
margin-left: 0.5rem;
}

View File

@@ -72,15 +72,6 @@
</modules>
<default>true</default>
</choice>
<choice>
<extension_code>itop-flow-map</extension_code>
<title>Data flow</title>
<description>Map data flows between applications</description>
<modules type="array">
<module>itop-flow-map</module>
</modules>
<default>false</default>
</choice>
</options>
</step>
<step>

View File

@@ -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);

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<DataFlowType alias="DataFlowType" id="1">
<name>http</name>
</DataFlowType>
<DataFlowType alias="DataFlowType" id="2">
<name>https</name>
</DataFlowType>
<DataFlowType alias="DataFlowType" id="3">
<name>ftp</name>
</DataFlowType>
<DataFlowType alias="DataFlowType" id="4">
<name>sftp</name>
</DataFlowType>
<DataFlowType alias="DataFlowType" id="5">
<name>AS2</name>
</DataFlowType>
<DataFlowType alias="DataFlowType" id="6">
<name>X.400</name>
</DataFlowType>
</Set>

View File

@@ -1,747 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.3">
<classes>
<class id="DataFlow" _delta="define">
<parent>cmdbAbstractObject</parent>
<properties>
<category>bizmodel,searchable</category>
<abstract>false</abstract>
<db_table>dataflow</db_table>
<style>
<icon>images/icons8-sorting-arrows-horizontal.svg</icon>
</style>
<naming>
<attributes>
<attribute id="name"/>
</attributes>
</naming>
<reconciliation>
<attributes>
<attribute id="name"/>
<attribute id="destination_id"/>
<attribute id="org_id"/>
<attribute id="source_id"/>
<attribute id="flowtype_id"/>
</attributes>
</reconciliation>
<obsolescence>
<condition>status='inactive'</condition>
</obsolescence>
<fields_semantic>
<state_attribute>status</state_attribute>
</fields_semantic>
</properties>
<fields>
<field id="name" xsi:type="AttributeString">
<sql>name</sql>
<default_value/>
<is_null_allowed>false</is_null_allowed>
</field>
<field id="org_id" xsi:type="AttributeExternalKey">
<sql>org_id</sql>
<filter/>
<dependencies/>
<is_null_allowed>false</is_null_allowed>
<target_class>Organization</target_class>
<on_target_delete>DEL_MANUAL</on_target_delete>
<tracking_level>all</tracking_level>
</field>
<field id="source_id" xsi:type="AttributeExternalKey">
<sql>source_id</sql>
<filter/>
<dependencies/>
<is_null_allowed>false</is_null_allowed>
<target_class>FunctionalCI</target_class>
<on_target_delete>DEL_MANUAL</on_target_delete>
<tracking_level>all</tracking_level>
</field>
<field id="source_impact" xsi:type="AttributeEnum">
<sort_type>rank</sort_type>
<values>
<value id="yes">
<code>yes</code>
<rank>10</rank>
</value>
<value id="no">
<code>no</code>
<rank>20</rank>
</value>
</values>
<sql>source_impact</sql>
<default_value>yes</default_value>
<is_null_allowed>false</is_null_allowed>
<display_style>radio_horizontal</display_style>
</field>
<field id="destination_id" xsi:type="AttributeExternalKey">
<sql>destination_id</sql>
<filter/>
<dependencies/>
<is_null_allowed>false</is_null_allowed>
<target_class>FunctionalCI</target_class>
<on_target_delete>DEL_MANUAL</on_target_delete>
<tracking_level>all</tracking_level>
</field>
<field id="destination_impact" xsi:type="AttributeEnum">
<sort_type>rank</sort_type>
<values>
<value id="yes">
<code>yes</code>
<rank>10</rank>
</value>
<value id="no">
<code>no</code>
<rank>20</rank>
</value>
</values>
<sql>destination_impact</sql>
<default_value>no</default_value>
<is_null_allowed>false</is_null_allowed>
<display_style>radio_horizontal</display_style>
</field>
<field id="dataflowtype_id" xsi:type="AttributeExternalKey">
<sql>dataflowtype_id</sql>
<filter/>
<dependencies/>
<is_null_allowed>true</is_null_allowed>
<target_class>DataFlowType</target_class>
<on_target_delete>DEL_MANUAL</on_target_delete>
<tracking_level>all</tracking_level>
</field>
<field id="description" xsi:type="AttributeHTML">
<sql>description</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<tracking_level>all</tracking_level>
</field>
<field id="status" xsi:type="AttributeEnum">
<sql>status</sql>
<values>
<value id="active">
<code>active</code>
<rank>10</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="inactive">
<code>inactive</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>
</values>
<sort_type>label</sort_type>
<default_value>active</default_value>
<is_null_allowed>false</is_null_allowed>
<display_style>list</display_style>
<tracking_level>all</tracking_level>
</field>
<field id="business_criticity" xsi:type="AttributeEnum">
<sort_type>rank</sort_type>
<values>
<value id="high">
<code>high</code>
<rank>10</rank>
</value>
<value id="medium">
<code>medium</code>
<rank>20</rank>
</value>
<value id="low">
<code>low</code>
<rank>30</rank>
</value>
</values>
<sql>business_criticity</sql>
<default_value>low</default_value>
<is_null_allowed>false</is_null_allowed>
<display_style>list</display_style>
</field>
<field id="execution_frequency" xsi:type="AttributeEnum">
<sort_type>rank</sort_type>
<values>
<value id="realtime">
<code>realtime</code>
<rank>10</rank>
</value>
<value id="ondemand">
<code>ondemand</code>
<rank>20</rank>
</value>
<value id="hourly">
<code>hourly</code>
<rank>30</rank>
</value>
<value id="daily">
<code>daily</code>
<rank>40</rank>
</value>
<value id="weekly">
<code>weekly</code>
<rank>50</rank>
</value>
<value id="monthly">
<code>monthly</code>
<rank>60</rank>
</value>
<value id="yearly">
<code>yearly</code>
<rank>70</rank>
</value>
</values>
<sql>execution_frequency</sql>
<default_value>daily</default_value>
<is_null_allowed>false</is_null_allowed>
<display_style>list</display_style>
</field>
<field id="contacts_list" xsi:type="AttributeLinkedSetIndirect">
<linked_class>lnkContactToDataFlow</linked_class>
<ext_key_to_me>dataflow_id</ext_key_to_me>
<count_min>0</count_min>
<count_max>0</count_max>
<ext_key_to_remote>contact_id</ext_key_to_remote>
<duplicates/>
</field>
<field id="documents_list" xsi:type="AttributeLinkedSetIndirect">
<linked_class>lnkDocumentToDataFlow</linked_class>
<ext_key_to_me>dataflow_id</ext_key_to_me>
<count_min>0</count_min>
<count_max>0</count_max>
<ext_key_to_remote>document_id</ext_key_to_remote>
<duplicates/>
</field>
</fields>
<methods/>
<presentation>
<list>
<items>
<item id="name">
<rank>10</rank>
</item>
<item id="source_id">
<rank>20</rank>
</item>
<item id="destination_id">
<rank>30</rank>
</item>
<item id="dataflowtype_id">
<rank>40</rank>
</item>
<item id="business_criticity">
<rank>50</rank>
</item>
</items>
</list>
<search>
<items>
<item id="org_id">
<rank>10</rank>
</item>
<item id="source_id">
<rank>20</rank>
</item>
<item id="destination_id">
<rank>30</rank>
</item>
<item id="status">
<rank>40</rank>
</item>
</items>
</search>
<details>
<items>
<item id="col:col1">
<items>
<item id="fieldset:DataFlow:baseinfo">
<items>
<item id="name">
<rank>10</rank>
</item>
<item id="org_id">
<rank>20</rank>
</item>
<item id="status">
<rank>30</rank>
</item>
<item id="business_criticity">
<rank>40</rank>
</item>
</items>
<rank>10</rank>
</item>
<item id="fieldset:DataFlow:moreinfo">
<items>
<item id="source_id">
<rank>10</rank>
</item>
<item id="source_impact">
<rank>20</rank>
</item>
<item id="destination_id">
<rank>30</rank>
</item>
<item id="destination_impact">
<rank>40</rank>
</item>
<item id="dataflowtype_id">
<rank>50</rank>
</item>
<item id="execution_frequency">
<rank>60</rank>
</item>
</items>
<rank>20</rank>
</item>
</items>
<rank>10</rank>
</item>
<item id="col:col2">
<items>
<item id="fieldset:DataFlow:otherinfo">
<items>
<item id="description">
<rank>10</rank>
</item>
</items>
<rank>10</rank>
</item>
</items>
<rank>20</rank>
</item>
<item id="contacts_list">
<rank>70</rank>
</item>
<item id="documents_list">
<rank>80</rank>
</item>
</items>
</details>
<default_search>
<items>
<item id="org_id">
<rank>10</rank>
</item>
<item id="source_id">
<rank>20</rank>
</item>
<item id="destination_id">
<rank>30</rank>
</item>
<item id="dataflowtype_id">
<rank>40</rank>
</item>
<item id="status">
<rank>50</rank>
</item>
</items>
</default_search>
<summary>
<items>
<item id="org_id">
<rank>10</rank>
</item>
<item id="description">
<rank>20</rank>
</item>
</items>
</summary>
</presentation>
<relations>
<relation id="impacts">
<neighbours>
<neighbour id="functionalci ">
<query_down><![CDATA[SELECT FunctionalCI WHERE :this->destination_impact = 'yes' AND id = :this->destination_id]]></query_down>
<query_up><![CDATA[SELECT DataFlow AS f JOIN FunctionalCI AS ci ON f.destination_id = ci.id WHERE f.destination_impact = 'yes' AND ci.id=:this->id]]></query_up>
<direction>both</direction>
</neighbour>
</neighbours>
</relation>
</relations>
</class>
<class id="lnkDocumentToDataFlow" _delta="define">
<parent>cmdbAbstractObject</parent>
<properties>
<is_link>1</is_link>
<category>bizmodel</category>
<abstract>false</abstract>
<key_type>autoincrement</key_type>
<db_table>lnkdocumenttodataflow</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field/>
<naming>
<attributes>
<attribute id="document_id_friendlyname"/>
<attribute id="dataflow_id_friendlyname"/>
</attributes>
</naming>
<style>
<icon/>
</style>
<reconciliation>
<attributes>
<attribute id="dataflow_id"/>
<attribute id="document_id"/>
</attributes>
</reconciliation>
<uniqueness_rules>
<rule id="no_duplicate">
<attributes>
<attribute id="document_id"/>
<attribute id="dataflow_id"/>
</attributes>
<filter><![CDATA[]]></filter>
<disabled>false</disabled>
<is_blocking>true</is_blocking>
</rule>
</uniqueness_rules>
</properties>
<fields>
<field id="dataflow_id" xsi:type="AttributeExternalKey">
<sql>dataflow_id</sql>
<target_class>DataFlow</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
<field id="document_id" xsi:type="AttributeExternalKey">
<sql>document_id</sql>
<target_class>Document</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
</fields>
<methods/>
<presentation>
<details>
<items>
<item id="document_id">
<rank>10</rank>
</item>
<item id="dataflow_id">
<rank>20</rank>
</item>
</items>
</details>
<search>
<items>
<item id="dataflow_id">
<rank>10</rank>
</item>
<item id="document_id">
<rank>20</rank>
</item>
</items>
</search>
<list>
<items>
<item id="dataflow_id">
<rank>10</rank>
</item>
<item id="document_id">
<rank>20</rank>
</item>
</items>
</list>
</presentation>
</class>
<class id="lnkContactToDataFlow" _delta="define">
<parent>cmdbAbstractObject</parent>
<properties>
<is_link>1</is_link>
<category>bizmodel</category>
<abstract>false</abstract>
<key_type>autoincrement</key_type>
<db_table>lnkcontacttodataflow</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field/>
<naming>
<attributes>
<attribute id="contact_id_friendlyname"/>
<attribute id="dataflow_id_friendlyname"/>
</attributes>
</naming>
<style>
<icon/>
</style>
<reconciliation>
<attributes>
<attribute id="dataflow_id"/>
<attribute id="contact_id"/>
</attributes>
</reconciliation>
<uniqueness_rules>
<rule id="no_duplicate">
<attributes>
<attribute id="contact_id"/>
<attribute id="dataflow_id"/>
</attributes>
<filter><![CDATA[]]></filter>
<disabled>false</disabled>
<is_blocking>true</is_blocking>
</rule>
</uniqueness_rules>
</properties>
<fields>
<field id="dataflow_id" xsi:type="AttributeExternalKey">
<sql>dataflow_id</sql>
<target_class>DataFlow</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
<field id="contact_id" xsi:type="AttributeExternalKey">
<sql>contact_id</sql>
<target_class>Contact</target_class>
<is_null_allowed>false</is_null_allowed>
<on_target_delete>DEL_AUTO</on_target_delete>
</field>
</fields>
<methods/>
<presentation>
<details>
<items>
<item id="contact_id">
<rank>10</rank>
</item>
<item id="dataflow_id">
<rank>20</rank>
</item>
</items>
</details>
<search>
<items>
<item id="dataflow_id">
<rank>10</rank>
</item>
<item id="contact_id">
<rank>20</rank>
</item>
</items>
</search>
<list>
<items>
<item id="dataflow_id">
<rank>10</rank>
</item>
<item id="contact_id">
<rank>20</rank>
</item>
</items>
</list>
</presentation>
</class>
<class id="DataFlowType" _delta="define">
<parent>Typology</parent>
<properties>
<category>bizmodel,searchable</category>
<abstract>false</abstract>
<db_table>dataflowtype</db_table>
<naming>
<attributes>
<attribute id="name"/>
</attributes>
</naming>
<reconciliation>
<attributes>
<attribute id="name"/>
<attribute id="finalclass"/>
</attributes>
</reconciliation>
</properties>
<fields/>
<methods/>
<presentation>
<list>
<items>
<item id="finalclass">
<rank>10</rank>
</item>
</items>
</list>
<search>
<items>
<item id="name">
<rank>10</rank>
</item>
</items>
</search>
<details>
<items>
<item id="name">
<rank>10</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="FunctionalCI" _delta="must_exist">
<fields>
<field id="dataflows" xsi:type="AttributeDashboard" _delta="define">
<is_user_editable>true</is_user_editable>
<definition>
<layout>DashboardLayoutTwoCols</layout>
<title>FunctionalCI:DataFlow:Title</title>
<auto_reload>
<enabled>false</enabled>
<interval>300</interval>
</auto_reload>
<cells>
<cell id="0">
<rank>0</rank>
<dashlets>
<dashlet id="DataFlow_Inbound" xsi:type="DashletObjectList">
<rank>0</rank>
<title>FunctionalCI:DataFlow:Inbound</title>
<query>SELECT DataFlow WHERE destination_id=:this->id</query>
<menu>true</menu>
</dashlet>
</dashlets>
</cell>
<cell id="1">
<rank>1</rank>
<dashlets>
<dashlet id="DataFlow_Outbound" xsi:type="DashletObjectList">
<rank>0</rank>
<title>FunctionalCI:DataFlow:Outbound</title>
<query>SELECT DataFlow WHERE source_id=:this->id</query>
<menu>true</menu>
</dashlet>
</dashlets>
</cell>
</cells>
</definition>
</field>
</fields>
<relations>
<relation id="impacts">
<neighbours>
<neighbour id="flow" _delta="define">
<query_down><![CDATA[SELECT DataFlow WHERE source_id = :this->id AND source_impact = 'yes']]></query_down>
<query_up><![CDATA[SELECT FunctionalCI AS ci JOIN DataFlow AS f ON f.source_id = ci.id WHERE f.source_impact = 'yes' AND f.id = :this->id]]></query_up>
<direction>both</direction>
</neighbour>
</neighbours>
</relation>
</relations>
</class>
<class id="ApplicationSolution" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="DatabaseSchema" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="DBServer" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="Middleware" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="MiddlewareInstance" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="WebApplication" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="WebServer" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
<class id="OtherSoftware" _delta="must_exist">
<presentation>
<details>
<items>
<item id="dataflows" _delta="define">
<rank>25</rank>
</item>
</items>
</details>
</presentation>
</class>
</classes>
<menus>
<menu id="ConfigManagementOverview" xsi:type="DashboardMenuNode" _delta="must_exist">
<definition>
<cells>
<cell id="3" delta="must_exist">
<dashlets>
<dashlet id="DataFlow_20" xsi:type="DashletBadge" _delta="define">
<rank>20</rank>
<class>DataFlow</class>
</dashlet>
</dashlets>
</cell>
</cells>
</definition>
</menu>
</menus>
<user_rights>
<groups>
<group id="Configuration">
<classes>
<class id="DataFlow" _delta="define"/>
<class id="DataFlowType" _delta="define"/>
</classes>
</group>
</groups>
<profiles>
</profiles>
</user_rights>
</itop_design>

View File

@@ -1,96 +0,0 @@
<?php
/**
* Module combodo-flow-map
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('EN US', 'English', 'English', [
'Class:FunctionalCI/Attribute:dataflows' => 'Data flows',
'Class:FunctionalCI/Attribute:dataflows+' => 'Data flows for which this object is the source or the destination',
'FunctionalCI:DataFlow:Title' => 'Data flows',
'FunctionalCI:DataFlow:Inbound' => 'Inbound flows',
'FunctionalCI:DataFlow:Outbound' => 'Outbound flows',
'DataFlow:baseinfo' => 'General information',
'DataFlow:otherinfo' => 'Other information',
'DataFlow:moreinfo' => 'Flow specifics',
'Class:DataFlow' => 'Flow',
'Class:DataFlow+' => 'For application flow for example',
'Class:DataFlow/Name' => '%1$s',
'Class:DataFlow/Attribute:name' => 'Name',
'Class:DataFlow/Attribute:name_id+' => 'Data that are transferred',
'Class:DataFlow/Attribute:source_id' => 'Source',
'Class:DataFlow/Attribute:source_id+' => 'Source Ci of the flow',
'Class:DataFlow/Attribute:source_impact' => 'Source impacts?',
'Class:DataFlow/Attribute:source_impact+' => 'Does the source impact the flow?',
'Class:DataFlow/Attribute:source_impact/Value:yes' => 'yes',
'Class:DataFlow/Attribute:source_impact/Value:yes+' => 'If the source falls down, the flow is impacted',
'Class:DataFlow/Attribute:source_impact/Value:no' => 'no',
'Class:DataFlow/Attribute:source_impact/Value:no+' => 'If the source falls down, the flow is not impacted',
'Class:DataFlow/Attribute:destination_id' => 'Destination',
'Class:DataFlow/Attribute:destination_id+' => 'Destination Ci for the flow',
'Class:DataFlow/Attribute:destination_impact' => 'Destination impacted',
'Class:DataFlow/Attribute:destination_impact+' => 'Is the destination impacted by the flow ?',
'Class:DataFlow/Attribute:destination_impact/Value:yes' => 'yes',
'Class:DataFlow/Attribute:destination_impact/Value:yes+' => 'If the flow stops, the destination is impacted',
'Class:DataFlow/Attribute:destination_impact/Value:no' => 'no',
'Class:DataFlow/Attribute:destination_impact/Value:no+' => 'If the flow stops, the destination is not impacted',
'Class:DataFlow/Attribute:dataflowtype_id' => 'Flow type',
'Class:DataFlow/Attribute:dataflowtype_id+' => 'Typology of Flow.',
'Class:DataFlow/Attribute:description' => 'Description',
'Class:DataFlow/Attribute:description+' => '',
'Class:DataFlow/Attribute:status' => 'Status',
'Class:DataFlow/Attribute:status+' => '',
'Class:DataFlow/Attribute:status/Value:active' => 'active',
'Class:DataFlow/Attribute:status/Value:inactive' => 'inactive',
'Class:DataFlow/Attribute:org_id' => 'Organization',
'Class:DataFlow/Attribute:org_id+' => '',
'Class:DataFlow/Attribute:business_criticity' => 'Business criticality',
'Class:DataFlow/Attribute:business_criticity+' => '',
'Class:DataFlow/Attribute:business_criticity/Value:high' => 'high',
'Class:DataFlow/Attribute:business_criticity/Value:high+' => '',
'Class:DataFlow/Attribute:business_criticity/Value:low' => 'low',
'Class:DataFlow/Attribute:business_criticity/Value:low+' => '',
'Class:DataFlow/Attribute:business_criticity/Value:medium' => 'medium',
'Class:DataFlow/Attribute:business_criticity/Value:medium+' => '',
'Class:DataFlow/Attribute:execution_frequency' => 'Execution frequency',
'Class:DataFlow/Attribute:execution_frequency+' => 'How often the data flow is executed',
'Class:DataFlow/Attribute:execution_frequency/Value:realtime' => 'real-time',
'Class:DataFlow/Attribute:execution_frequency/Value:realtime+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:ondemand' => 'on demand',
'Class:DataFlow/Attribute:execution_frequency/Value:ondemand+' => 'on the fly, not scheduled',
'Class:DataFlow/Attribute:execution_frequency/Value:hourly' => 'hourly',
'Class:DataFlow/Attribute:execution_frequency/Value:hourly+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:daily' => 'daily',
'Class:DataFlow/Attribute:execution_frequency/Value:daily+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:weekly' => 'weekly',
'Class:DataFlow/Attribute:execution_frequency/Value:weekly+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:monthly' => 'monthly',
'Class:DataFlow/Attribute:execution_frequency/Value:monthly+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:yearly' => 'yearly',
'Class:DataFlow/Attribute:execution_frequency/Value:yearly+' => '',
'Class:DataFlow/Attribute:documents_list' => 'Documents',
'Class:DataFlow/Attribute:documents_list+' => 'Eg: technical specifications, runbooks, etc.',
'Class:DataFlow/Attribute:contacts_list' => 'Contacts',
'Class:DataFlow/Attribute:contacts_list+' => 'Eg: flow owner, technical support, etc.',
/*
'Class:DataFlow/Attribute:source_id_friendlyname' => 'source_id_friendlyname',
'Class:DataFlow/Attribute:source_id_friendlyname+' => 'Full name',
'Class:DataFlow/Attribute:source_id_finalclass_recall' => 'source_id->CI sub-class',
'Class:DataFlow/Attribute:source_id_finalclass_recall+' => 'Name of the final class',
'Class:DataFlow/Attribute:source_id_obsolescence_flag' => 'source_id->Obsolete',
'Class:DataFlow/Attribute:source_id_obsolescence_flag+' => 'Computed dynamically on other attributes',
'Class:DataFlow/Attribute:destination_id_friendlyname' => 'destination_id_friendlyname',
'Class:DataFlow/Attribute:destination_id_friendlyname+' => 'Full name',
'Class:DataFlow/Attribute:destination_id_finalclass_recall' => 'destination_id->CI sub-class',
'Class:DataFlow/Attribute:destination_id_finalclass_recall+' => 'Name of the final class',
'Class:DataFlow/Attribute:destination_id_obsolescence_flag' => 'destination_id->Obsolete',
'Class:DataFlow/Attribute:destination_id_obsolescence_flag+' => 'Computed dynamically on other attributes',
*/
]);

View File

@@ -1,96 +0,0 @@
<?php
/**
* Module combodo-flow-map
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('FR FR', 'French', 'Français', [
'Class:FunctionalCI/Attribute:dataflows' => 'Flux de données',
'Class:FunctionalCI/Attribute:dataflows+' => 'Flux de données dont cet objet est la source ou la destination',
'FunctionalCI:DataFlow:Title' => 'Flux de données',
'FunctionalCI:DataFlow:Inbound' => 'Flux entrants',
'FunctionalCI:DataFlow:Outbound' => 'Flux sortants',
'DataFlow:baseinfo' => 'Informations générales',
'DataFlow:otherinfo' => 'Autres informations',
'DataFlow:moreinfo' => 'Spécificités du flux',
'Class:DataFlow' => 'Flux de Données',
'Class:DataFlow+' => 'Modélise les données transférées entre instances d\'application',
'Class:DataFlow/Name' => '%1$s',
'Class:DataFlow/Attribute:name' => 'Nom',
'Class:DataFlow/Attribute:name_id+' => 'Type de données transferées',
'Class:DataFlow/Attribute:source_id' => 'Source',
'Class:DataFlow/Attribute:source_id+' => 'Instance d\application à la source du flux de données',
'Class:DataFlow/Attribute:source_impact' => 'Source impactante ?',
'Class:DataFlow/Attribute:source_impact+' => 'La source impacte-t-elle le flux de données ?',
'Class:DataFlow/Attribute:source_impact/Value:yes' => 'oui',
'Class:DataFlow/Attribute:source_impact/Value:yes+' => 'Si la source tombe en panne, le flux de données est impacté',
'Class:DataFlow/Attribute:source_impact/Value:no' => 'non',
'Class:DataFlow/Attribute:source_impact/Value:no+' => 'Si la source tombe en panne, le flux de données n\'est pas impacté',
'Class:DataFlow/Attribute:destination_id' => 'Destinataire',
'Class:DataFlow/Attribute:destination_id+' => 'Destinataire des données, à choisir parmi les instances d\'application',
'Class:DataFlow/Attribute:destination_impact' => 'Destinataire impacté ?',
'Class:DataFlow/Attribute:destination_impact+' => 'Le destinataire est-il impacté si le flux de données s\'arrête ?',
'Class:DataFlow/Attribute:destination_impact/Value:yes' => 'oui',
'Class:DataFlow/Attribute:destination_impact/Value:yes+' => 'Si le flux s\'arrête, le destinataire est impacté',
'Class:DataFlow/Attribute:destination_impact/Value:no' => 'non',
'Class:DataFlow/Attribute:destination_impact/Value:no+' => 'Si le flux s\'arrête, le destinataire n\'est pas impacté',
'Class:DataFlow/Attribute:dataflowtype_id' => 'Type de flux',
'Class:DataFlow/Attribute:dataflowtype_id+' => 'Typologie du flux',
'Class:DataFlow/Attribute:description' => 'Description',
'Class:DataFlow/Attribute:description+' => '',
'Class:DataFlow/Attribute:status' => 'Etat',
'Class:DataFlow/Attribute:status+' => '',
'Class:DataFlow/Attribute:status/Value:active' => 'actif',
'Class:DataFlow/Attribute:status/Value:inactive' => 'inactif',
'Class:DataFlow/Attribute:org_id' => 'Organisation',
'Class:DataFlow/Attribute:org_id+' => '',
'Class:DataFlow/Attribute:business_criticity' => 'Criticité',
'Class:DataFlow/Attribute:business_criticity+' => '',
'Class:DataFlow/Attribute:business_criticity/Value:high' => 'haute',
'Class:DataFlow/Attribute:business_criticity/Value:high+' => '',
'Class:DataFlow/Attribute:business_criticity/Value:low' => 'basse',
'Class:DataFlow/Attribute:business_criticity/Value:low+' => '',
'Class:DataFlow/Attribute:business_criticity/Value:medium' => 'moyenne',
'Class:DataFlow/Attribute:business_criticity/Value:medium+' => '',
'Class:DataFlow/Attribute:execution_frequency' => 'Fréquence d\'exécution',
'Class:DataFlow/Attribute:execution_frequency+' => 'À quelle fréquence le transfert de données est-il exécuté',
'Class:DataFlow/Attribute:execution_frequency/Value:realtime' => 'temps réel',
'Class:DataFlow/Attribute:execution_frequency/Value:realtime+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:ondemand' => 'à la demande',
'Class:DataFlow/Attribute:execution_frequency/Value:ondemand+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:hourly' => 'horaire',
'Class:DataFlow/Attribute:execution_frequency/Value:hourly+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:daily' => 'journalière',
'Class:DataFlow/Attribute:execution_frequency/Value:daily+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:weekly' => 'hebdomadaire',
'Class:DataFlow/Attribute:execution_frequency/Value:weekly+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:monthly' => 'mensuelle',
'Class:DataFlow/Attribute:execution_frequency/Value:monthly+' => '',
'Class:DataFlow/Attribute:execution_frequency/Value:yearly' => 'annuelle',
'Class:DataFlow/Attribute:execution_frequency/Value:yearly+' => '',
'Class:DataFlow/Attribute:documents_list' => 'Documents',
'Class:DataFlow/Attribute:documents_list+' => 'Eg: technical specifications, runbooks, etc.',
'Class:DataFlow/Attribute:contacts_list' => 'Contacts',
'Class:DataFlow/Attribute:contacts_list+' => 'Eg: flow owner, technical support, etc.',
/*
'Class:DataFlow/Attribute:source_id_friendlyname' => 'source_id_friendlyname',
'Class:DataFlow/Attribute:source_id_friendlyname+' => 'Nom complet',
'Class:DataFlow/Attribute:source_id_finalclass_recall' => 'source_id->CI sub-class',
'Class:DataFlow/Attribute:source_id_finalclass_recall+' => 'Classe finale',
'Class:DataFlow/Attribute:source_id_obsolescence_flag' => 'source_id->Obsolete',
'Class:DataFlow/Attribute:source_id_obsolescence_flag+' => 'Computed dynamically on other attributes',
'Class:DataFlow/Attribute:destination_id_friendlyname' => 'destination_id_friendlyname',
'Class:DataFlow/Attribute:destination_id_friendlyname+' => 'Nom complet',
'Class:DataFlow/Attribute:destination_id_finalclass_recall' => 'destination_id->CI sub-class',
'Class:DataFlow/Attribute:destination_id_finalclass_recall+' => 'Classe finale',
'Class:DataFlow/Attribute:destination_id_obsolescence_flag' => 'destination_id->Obsolete',
'Class:DataFlow/Attribute:destination_id_obsolescence_flag+' => 'Computed dynamically on other attributes',
*/
]);

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="96px" height="96px"><linearGradient id="mv_DwPz_GcV~datTQ_sP3a" x1="27.258" x2="38.501" y1="18.189" y2="44.314" gradientTransform="rotate(90 23.5 24)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#32bdef"/><stop offset="1" stop-color="#1ea2e4"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3a)" d="M14,41.19V37h14c0.552,0,1-0.448,1-1v-4c0-0.552-0.448-1-1-1H14v-4.19 c0-0.72-0.87-1.08-1.379-0.571L5.92,32.939c-0.586,0.586-0.586,1.536,0,2.121l6.701,6.701C13.13,42.271,14,41.91,14,41.19z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3b" x1="32.674" x2="34.456" y1="9.581" y2="13.722" gradientTransform="rotate(90 23.5 24)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#32bdef"/><stop offset="1" stop-color="#1ea2e4"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3b)" d="M35,36v-4c0-0.552,0.448-1,1-1l0,0c0.552,0,1,0.448,1,1v4c0,0.552-0.448,1-1,1l0,0 C35.448,37,35,36.552,35,36z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3c" x1="32.674" x2="34.456" y1="5.581" y2="9.722" gradientTransform="rotate(90 23.5 24)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#32bdef"/><stop offset="1" stop-color="#1ea2e4"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3c)" d="M39,36v-4c0-0.552,0.448-1,1-1l0,0c0.552,0,1,0.448,1,1v4c0,0.552-0.448,1-1,1l0,0 C39.448,37,39,36.552,39,36z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3d" x1="32.674" x2="34.456" y1="13.581" y2="17.722" gradientTransform="rotate(90 23.5 24)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#32bdef"/><stop offset="1" stop-color="#1ea2e4"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3d)" d="M31,36v-4c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v4c0,0.552-0.448,1-1,1h0 C31.448,37,31,36.552,31,36z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3e" x1="551.258" x2="562.501" y1="-252.291" y2="-226.167" gradientTransform="rotate(-90 421.24 151.26)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1ea2e4"/><stop offset="1" stop-color="#32bdef"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3e)" d="M33,7.81V12H19c-0.552,0-1,0.448-1,1v4c0,0.552,0.448,1,1,1h14v4.19 c0,0.72,0.87,1.08,1.379,0.571l6.701-6.701c0.586-0.586,0.586-1.536,0-2.121l-6.701-6.701C33.87,6.729,33,7.09,33,7.81z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3f" x1="556.674" x2="558.456" y1="-260.899" y2="-256.759" gradientTransform="rotate(-90 421.24 151.26)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1ea2e4"/><stop offset="1" stop-color="#32bdef"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3f)" d="M12,13v4c0,0.552-0.448,1-1,1h0c-0.552,0-1-0.448-1-1v-4c0-0.552,0.448-1,1-1h0 C11.552,12,12,12.448,12,13z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3g" x1="556.674" x2="558.456" y1="-264.899" y2="-260.759" gradientTransform="rotate(-90 421.24 151.26)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1ea2e4"/><stop offset="1" stop-color="#32bdef"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3g)" d="M8,13v4c0,0.552-0.448,1-1,1h0c-0.552,0-1-0.448-1-1v-4c0-0.552,0.448-1,1-1h0 C7.552,12,8,12.448,8,13z"/><linearGradient id="mv_DwPz_GcV~datTQ_sP3h" x1="556.674" x2="558.456" y1="-256.899" y2="-252.758" gradientTransform="rotate(-90 421.24 151.26)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1ea2e4"/><stop offset="1" stop-color="#32bdef"/></linearGradient><path fill="url(#mv_DwPz_GcV~datTQ_sP3h)" d="M16,13v4c0,0.552-0.448,1-1,1h0c-0.552,0-1-0.448-1-1v-4c0-0.552,0.448-1,1-1h0 C15.552,12,16,12.448,16,13z"/></svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -1,50 +0,0 @@
<?php
//
// iTop module definition file
//
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-flow-map/3.3.0',
[
// Identification
//
'label' => 'Map applications data flows',
'category' => 'business',
// Setup
//
'dependencies' => [
'itop-config-mgmt/3.2.0',
],
'mandatory' => false,
'visible' => true,
// Components
//
'datamodel' => [
],
'webservice' => [
],
'data.struct' => [
'data/en_us.data.itop-flow-map.xml',
],
'data.sample' => [
// add your sample data XML files here,
],
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => [
// Module specific settings go here, if any
],
]
);

View File

@@ -20,7 +20,7 @@ function DisplayStatus(WebPage $oPage)
if (is_dir($sPath)) {
$aExtraDirs[] = $sPath; // Also read the extra downloaded-modules directory
}
$oExtensionsMap = new iTopExtensionsMap('production', $aExtraDirs);
$oExtensionsMap = new iTopExtensionsMap('production', true, $aExtraDirs);
$oExtensionsMap->LoadChoicesFromDatabase(MetaModel::GetConfig());
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) {
@@ -154,7 +154,7 @@ function DoInstall(WebPage $oPage)
if (is_dir($sPath)) {
$aExtraDirs[] = $sPath; // Also read the extra downloaded-modules directory
}
$oExtensionsMap = new iTopExtensionsMap('production', $aExtraDirs);
$oExtensionsMap = new iTopExtensionsMap('production', true, $aExtraDirs);
$oExtensionsMap->LoadChoicesFromDatabase(MetaModel::GetConfig());
foreach ($oExtensionsMap->GetAllExtensions() as $oExtension) {

View File

@@ -365,6 +365,9 @@ class ObjectFormManager extends FormManager
}
$oAttDef = MetaModel::GetAttributeDef(get_class($this->oObject), $sAttCode);
if ($oAttDef instanceof \AttributeLinkedSet && array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('ignore_scopes', $this->aExtraData[$sAttCode])) {
$oAttDef->AllowAllData();
}
/** @var Field $oField */
$oField = null;
@@ -572,7 +575,11 @@ class ObjectFormManager extends FormManager
$aLimitedAccessItemIDs = [];
/** @var \ormLinkSet $oFieldOriginalSet */
$oFieldOriginalSet = $oField->GetCurrentValue();
if (array_key_exists($sAttCode, $this->aExtraData) && array_key_exists('ignore_scopes', $this->aExtraData[$sAttCode])) {
$oFieldOriginalSet->AllowAllData();
}
foreach ($oFieldOriginalSet as $oLink) {
if ($oField->IsIndirect()) {
$iRemoteKey = $oLink->Get($oAttDef->GetExtKeyToRemote());

View File

@@ -60,11 +60,6 @@ class iTopExtension
* @var bool
*/
public $bMarkedAsChosen;
/**
* If null, check if at least one module cannot be uninstalled
* @var bool|null
*/
public ?bool $bCanBeUninstalled = null;
/**
* @var bool
@@ -96,14 +91,6 @@ class iTopExtension
* @var string[]
*/
public $aMissingDependencies;
/**
* @var bool
*/
public bool $bInstalled = false;
/**
* @var bool
*/
public bool $bRemovedFromDisk = false;
public function __construct()
{
@@ -128,14 +115,13 @@ class iTopExtension
* @since 3.3.0
* @return bool
*/
public function CanBeUninstalled(): bool
public function CanBeUninstalled()
{
if (!is_null($this->bCanBeUninstalled)) {
return $this->bCanBeUninstalled;
}
foreach ($this->aModuleInfo as $sModuleCode => $aModuleInfo) {
$this->bCanBeUninstalled = $aModuleInfo['uninstallable'] === 'yes';
return $this->bCanBeUninstalled;
$bUninstallable = $aModuleInfo['uninstallable'] === 'yes';
if (!$bUninstallable) {
return false;
}
}
return true;
}
@@ -153,11 +139,6 @@ class iTopExtensionsMap
* @return void
*/
protected $aExtensions;
/**
* The list of all currently installed extensions
* @var array|null
*/
protected ?array $aInstalledExtensions = null;
/**
* The list of directories browsed using the ReadDir method when building the map
@@ -165,7 +146,7 @@ class iTopExtensionsMap
*/
protected $aScannedDirs;
public function __construct($sFromEnvironment = 'production', $aExtraDirs = [])
public function __construct($sFromEnvironment = 'production', $bNormalizeOldExtensions = true, $aExtraDirs = [])
{
$this->aExtensions = [];
$this->aScannedDirs = [];
@@ -174,6 +155,9 @@ class iTopExtensionsMap
$this->ReadDir($sDir, iTopExtension::SOURCE_REMOTE);
}
$this->CheckDependencies($sFromEnvironment);
if ($bNormalizeOldExtensions) {
$this->NormalizeOldExtensions();
}
}
/**
@@ -229,7 +213,6 @@ class iTopExtensionsMap
$oExtension = new iTopExtension();
$oExtension->sCode = $aChoiceInfo['extension_code'];
$oExtension->sLabel = $aChoiceInfo['title'];
$oExtension->sDescription = $aChoiceInfo['description'];
if (array_key_exists('modules', $aChoiceInfo)) {
// Some wizard choices are not associated with any module
$oExtension->aModules = $aChoiceInfo['modules'];
@@ -278,7 +261,7 @@ class iTopExtensionsMap
*
* @return \iTopExtension|null
*/
public function GetFromExtensionCode(string $sExtensionCode): ?iTopExtension
public function Get(string $sExtensionCode): ?iTopExtension
{
foreach ($this->aExtensions as $oExtension) {
if ($oExtension->sCode === $sExtensionCode) {
@@ -358,7 +341,7 @@ class iTopExtensionsMap
$this->aExtensions[$sParentExtensionId]->aModuleVersion[$sModuleName] = $sModuleVersion;
$this->aExtensions[$sParentExtensionId]->aModuleInfo[$sModuleName] = $aModuleInfo[ModuleFileReader::MODULE_INFO_CONFIG];
} else {
// Not already inside a folder containing an 'extension.xml' file
// Not already inside an folder containing an 'extension.xml' file
// Ignore non-visible modules and auto-select ones, since these are never prompted
// as a choice to the end-user
@@ -449,19 +432,10 @@ class iTopExtensionsMap
return $this->aExtensions;
}
/**
* @return array All available extensions and extensions currently installed but not available due to files removal
*/
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);
}
/**
* Mark the given extension as chosen
* @param string $sExtensionCode The code of the extension (code without version number)
* @param bool $bMark The value to set for the bMarkAsChosen flag
* @param string $sExtensionCode The code of the extension (code without verison number)
* @param bool $bMark The value to set for the bmarkAschosen flag
* @return void
*/
public function MarkAsChosen($sExtensionCode, $bMark = true)
@@ -526,55 +500,124 @@ class iTopExtensionsMap
* @return bool
*/
public function LoadChoicesFromDatabase(Config $oConfig)
{
foreach ($this->LoadInstalledExtensionsFromDatabase($oConfig) as $oExtension) {
$this->MarkAsChosen($oExtension->sCode);
$this->SetInstalledVersion($oExtension->sCode, $oExtension->sVersion);
}
return true;
}
protected function LoadInstalledExtensionsFromDatabase(Config $oConfig): array|false
{
try {
$aInstalledExtensions = [];
if (CMDBSource::DBName() === null) {
CMDBSource::InitFromConfig($oConfig);
}
$sLatestInstallationDate = CMDBSource::QueryToScalar("SELECT max(installed) FROM ".$oConfig->Get('db_subname')."priv_extension_install");
$aDBInfo = CMDBSource::QueryToArray("SELECT * FROM ".$oConfig->Get('db_subname')."priv_extension_install WHERE installed = '".$sLatestInstallationDate."'");
$this->aInstalledExtensions = [];
foreach ($aDBInfo as $aExtensionInfo) {
$oExtension = new iTopExtension();
$oExtension->sCode = $aExtensionInfo['code'];
$oExtension->sLabel = $aExtensionInfo['label'];
$oExtension->sDescription = $aExtensionInfo['description'] ?? '';
$oExtension->sVersion = $aExtensionInfo['version'];
$oExtension->sSource = $aExtensionInfo['source'];
$oExtension->bMandatory = false;
$oExtension->sMoreInfoUrl = '';
$oExtension->aModules = [];
$oExtension->aModuleVersion = [];
$oExtension->aModuleInfo = [];
$oExtension->sSourceDir = '';
$oExtension->bVisible = true;
$oExtension->bInstalled = true;
$oExtension->bCanBeUninstalled = !isset($aExtensionInfo['uninstallable']) || $aExtensionInfo['uninstallable'] === 'yes';
$oChoice = $this->GetFromExtensionCode($oExtension->sCode);
if ($oChoice) {
$oChoice->bInstalled = true;
} else {
$oExtension->bRemovedFromDisk = true;
}
$this->aInstalledExtensions[$oExtension->sCode.'/'.$oExtension->sVersion] = $oExtension;
}
return $this->aInstalledExtensions;
$aInstalledExtensions = CMDBSource::QueryToArray("SELECT * FROM ".$oConfig->Get('db_subname')."priv_extension_install WHERE installed = '".$sLatestInstallationDate."'");
} catch (MySQLException $e) {
// No database or erroneous information
return false;
}
foreach ($aInstalledExtensions as $aDBInfo) {
$this->MarkAsChosen($aDBInfo['code']);
$this->SetInstalledVersion($aDBInfo['code'], $aDBInfo['version']);
}
return true;
}
/**
* Find is a single-module extension is contained within another extension
* @param iTopExtension $oExtension
* @return NULL|iTopExtension
*/
public function IsExtensionObsoletedByAnother(iTopExtension $oExtension)
{
// Complex extensions (more than 1 module) are never considered as obsolete
if (count($oExtension->aModules) != 1) {
return null;
}
foreach ($this->GetAllExtensions() as $oOtherExtension) {
if (($oOtherExtension->sSourceDir != $oExtension->sSourceDir) && ($oOtherExtension->sSource != iTopExtension::SOURCE_WIZARD)) {
if (array_key_exists($oExtension->sCode, $oOtherExtension->aModuleVersion) &&
(version_compare($oOtherExtension->aModuleVersion[$oExtension->sCode], $oExtension->sVersion, '>='))) {
// Found another extension containing a more recent version of the extension/module
return $oOtherExtension;
}
}
}
// No match at all
return null;
}
/**
* Search for multi-module extensions that are NOT deployed as an extension (i.e. shipped with an extension.xml file)
* but as a bunch of un-related modules based on the signature of some well-known extensions. If such an extension is found,
* replace the stand-alone modules by an "extension" with the appropriate label/description/version containing the same modules.
* @param string $sInSourceOnly The source directory to scan (datamodel|extensions|data)
*/
public function NormalizeOldExtensions($sInSourceOnly = iTopExtension::SOURCE_MANUAL)
{
$aSignatures = $this->GetOldExtensionsSignatures();
foreach ($aSignatures as $sExtensionCode => $aExtensionSignatures) {
$bFound = false;
foreach ($aExtensionSignatures['versions'] as $sVersion => $aModules) {
$bInstalled = true;
foreach ($aModules as $sModuleId) {
if (!$this->ModuleIsPresent($sModuleId, $sInSourceOnly)) {
$bFound = false;
break; // One missing module is enough to determine that the extension/version is not present
} else {
$bInstalled = $bInstalled && $this->ModuleIsInstalled($sModuleId, $sInSourceOnly);
$bFound = true;
}
}
if ($bFound) {
break;
} // The current version matches the signature
}
if ($bFound) {
$oExtension = new iTopExtension();
$oExtension->sCode = $sExtensionCode;
$oExtension->sLabel = $aExtensionSignatures['label'];
$oExtension->sSource = $sInSourceOnly;
$oExtension->sDescription = $aExtensionSignatures['description'];
$oExtension->sVersion = $sVersion;
$oExtension->aModules = [];
if ($bInstalled) {
$oExtension->sInstalledVersion = $sVersion;
$oExtension->bMarkedAsChosen = true;
}
foreach ($aModules as $sModuleId) {
list($sModuleName, $sModuleVersion) = ModuleDiscovery::GetModuleName($sModuleId);
$oExtension->aModules[] = $sModuleName;
$oExtension->aModuleInfo[$sModuleName] = $this->aExtensions[$sModuleId]->aModuleInfo[$sModuleName];
}
$this->ReplaceModulesByNormalizedExtension($aExtensionSignatures['versions'][$sVersion], $oExtension);
}
}
}
/**
* Check if the given module-code/version is present on the disk
* @param string $sModuleIdToFind The module ID (code/version) to search for
* @param string $sInSourceOnly The origin (=source) to search in (datamodel|extensions|data)
* @return boolean
*/
protected function ModuleIsPresent($sModuleIdToFind, $sInSourceOnly)
{
return (array_key_exists($sModuleIdToFind, $this->aExtensions) && ($this->aExtensions[$sModuleIdToFind]->sSource == $sInSourceOnly));
}
/**
* Check if the given module-code/version is currently installed
* @param string $sModuleIdToFind The module ID (code/version) to search for
* @param string $sInSourceOnly The origin (=source) to search in (datamodel|extensions|data)
* @return boolean
*/
protected function ModuleIsInstalled($sModuleIdToFind, $sInSourceOnly)
{
return (array_key_exists($sModuleIdToFind, $this->aExtensions) &&
($this->aExtensions[$sModuleIdToFind]->sSource == $sInSourceOnly) &&
($this->aExtensions[$sModuleIdToFind]->sInstalledVersion !== ''));
}
/**
@@ -597,4 +640,657 @@ class iTopExtensionsMap
return false;
}
/**
* Replace a given set of stand-alone modules by one single "extension"
* @param string[] $aModules
* @param iTopExtension $oNewExtension
*/
protected function ReplaceModulesByNormalizedExtension($aModules, iTopExtension $oNewExtension)
{
foreach ($aModules as $sModuleId) {
unset($this->aExtensions[$sModuleId]);
}
$this->AddExtension($oNewExtension);
}
/**
* Get the list of signatures of some well-known multi-module extensions without extension.xml file (should not exist anymore)
*
* @return string[][]|string[][][][]
*/
protected function GetOldExtensionsSignatures()
{
// Generated by the Factory using the page export_component_versions_for_normalisation.php
return [
'combodo-approval-process-light' =>
[
'label' => 'Approval process light',
'description' => 'Approve a request via a simple email',
'versions' =>
[
'1.0.1' =>
[
0 => 'approval-base/2.1.0',
1 => 'combodo-approval-light/1.0.1',
],
'1.0.2' =>
[
0 => 'approval-base/2.1.1',
1 => 'combodo-approval-light/1.0.2',
],
'1.0.3' =>
[
0 => 'approval-base/2.1.2',
1 => 'combodo-approval-light/1.0.2',
],
'1.1.0' =>
[
0 => 'approval-base/2.2.2',
1 => 'combodo-approval-light/1.0.2',
],
'1.1.1' =>
[
0 => 'approval-base/2.2.3',
1 => 'combodo-approval-light/1.0.2',
],
'1.1.2' =>
[
0 => 'approval-base/2.2.6',
1 => 'combodo-approval-light/1.0.2',
],
'1.1.3' =>
[
0 => 'approval-base/2.2.6',
1 => 'combodo-approval-light/1.0.3',
],
'1.2.0' =>
[
0 => 'approval-base/2.3.0',
1 => 'combodo-approval-light/1.0.3',
],
'1.2.1' =>
[
0 => 'approval-base/2.4.0',
1 => 'combodo-approval-light/1.0.4',
],
'1.3.0' =>
[
0 => 'approval-base/2.4.2',
1 => 'combodo-approval-light/1.1.1',
],
'1.3.1' =>
[
0 => 'approval-base/2.5.0',
1 => 'combodo-approval-light/1.1.1',
],
'1.3.2' =>
[
0 => 'approval-base/2.5.0',
1 => 'combodo-approval-light/1.1.2',
],
'1.2.2' =>
[
0 => 'approval-base/2.4.2',
1 => 'combodo-approval-light/1.0.5',
],
'1.3.3' =>
[
0 => 'approval-base/2.5.1',
1 => 'combodo-approval-light/1.1.2',
],
'1.3.4' =>
[
0 => 'approval-base/2.5.2',
1 => 'combodo-approval-light/1.1.2',
],
'1.3.5' =>
[
0 => 'approval-base/2.5.3',
1 => 'combodo-approval-light/1.1.2',
],
'1.4.0' =>
[
0 => 'approval-base/2.5.3',
1 => 'combodo-approval-light/1.1.2',
2 => 'itop-approval-portal/1.0.0',
],
],
],
'combodo-approval-process-automation' =>
[
'label' => 'Approval process automation',
'description' => 'Control your approval process with predefined rules based on service catalog',
'versions' =>
[
'1.0.1' =>
[
0 => 'approval-base/2.1.0',
1 => 'combodo-approval-extended/1.0.2',
],
'1.0.2' =>
[
0 => 'approval-base/2.1.1',
1 => 'combodo-approval-extended/1.0.4',
],
'1.0.3' =>
[
0 => 'approval-base/2.1.2',
1 => 'combodo-approval-extended/1.0.4',
],
'1.1.0' =>
[
0 => 'approval-base/2.2.2',
1 => 'combodo-approval-extended/1.0.4',
],
'1.1.1' =>
[
0 => 'approval-base/2.2.3',
1 => 'combodo-approval-extended/1.0.4',
],
'1.1.2' =>
[
0 => 'approval-base/2.2.6',
1 => 'combodo-approval-extended/1.0.5',
],
'1.1.3' =>
[
0 => 'approval-base/2.2.6',
1 => 'combodo-approval-extended/1.0.6',
],
'1.2.0' =>
[
0 => 'approval-base/2.3.0',
1 => 'combodo-approval-extended/1.0.7',
],
'1.2.1' =>
[
0 => 'approval-base/2.4.0',
1 => 'combodo-approval-extended/1.0.8',
],
'1.3.0' =>
[
0 => 'approval-base/2.4.2',
1 => 'combodo-approval-extended/1.2.1',
],
'1.3.1' =>
[
0 => 'approval-base/2.5.0',
1 => 'combodo-approval-extended/1.2.1',
],
'1.3.2' =>
[
0 => 'approval-base/2.5.0',
1 => 'combodo-approval-extended/1.2.2',
],
'1.2.2' =>
[
0 => 'approval-base/2.4.2',
1 => 'combodo-approval-extended/1.0.9',
],
'1.3.3' =>
[
0 => 'approval-base/2.5.1',
1 => 'combodo-approval-extended/1.2.3',
],
'1.3.4' =>
[
0 => 'approval-base/2.5.2',
1 => 'combodo-approval-extended/1.2.3',
],
'1.3.5' =>
[
0 => 'approval-base/2.5.3',
1 => 'combodo-approval-extended/1.2.3',
],
'1.4.0' =>
[
0 => 'approval-base/2.5.3',
1 => 'combodo-approval-extended/1.2.3',
3 => 'itop-approval-portal/1.0.0',
],
],
],
'combodo-predefined-response-models' =>
[
'label' => 'Predefined response models',
'description' => 'Pick common answers from a list of predefined replies grouped by categories to update tickets log',
'versions' =>
[
'1.0.0' =>
[
0 => 'precanned-replies/1.0.0',
1 => 'precanned-replies-pro/1.0.0',
],
'1.0.1' =>
[
0 => 'precanned-replies/1.0.1',
1 => 'precanned-replies-pro/1.0.1',
],
'1.0.2' =>
[
0 => 'precanned-replies/1.0.2',
1 => 'precanned-replies-pro/1.0.1',
],
'1.0.3' =>
[
0 => 'precanned-replies/1.0.3',
1 => 'precanned-replies-pro/1.0.1',
],
'1.0.4' =>
[
0 => 'precanned-replies/1.0.3',
1 => 'precanned-replies-pro/1.0.2',
],
'1.0.5' =>
[
0 => 'precanned-replies/1.0.4',
1 => 'precanned-replies-pro/1.0.2',
],
'1.1.0' =>
[
0 => 'precanned-replies/1.1.0',
1 => 'precanned-replies-pro/1.0.2',
],
'1.1.1' =>
[
0 => 'precanned-replies/1.1.1',
1 => 'precanned-replies-pro/1.0.2',
],
],
],
'combodo-customized-request-forms' =>
[
'label' => 'Customized request forms',
'description' => 'Define personalized request forms based on the service catalog. Add extra fields for a given type of request.',
'versions' =>
[
'1.0.1' =>
[
0 => 'templates-base/2.1.1',
1 => 'itop-request-template/1.0.0',
],
'1.0.2' =>
[
0 => 'templates-base/2.1.2',
1 => 'itop-request-template/1.0.0',
],
'1.0.3' =>
[
0 => 'templates-base/2.1.2',
1 => 'itop-request-template/1.0.1',
],
'1.0.4' =>
[
0 => 'templates-base/2.1.3',
1 => 'itop-request-template/1.0.1',
],
'1.0.5' =>
[
0 => 'templates-base/2.1.4',
1 => 'itop-request-template/1.0.1',
],
'2.0.0' =>
[
0 => 'templates-base/3.0.0',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.1' =>
[
0 => 'templates-base/3.0.1',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.2' =>
[
0 => 'templates-base/3.0.2',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.3' =>
[
0 => 'templates-base/3.0.4',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.4' =>
[
0 => 'templates-base/3.0.5',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.5' =>
[
0 => 'templates-base/3.0.6',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.6' =>
[
0 => 'templates-base/3.0.8',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.7' =>
[
0 => 'templates-base/3.0.9',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
'2.0.8' =>
[
0 => 'templates-base/3.0.12',
1 => 'itop-request-template/2.0.0',
2 => 'itop-request-template-portal/1.0.0',
],
],
],
'combodo-sla-considering-business-hours' =>
[
'label' => 'SLA considering business hours',
'description' => 'Compute SLAs taking into account service coverage window and holidays',
'versions' =>
[
'2.0.1' =>
[
0 => 'combodo-sla-computation/2.0.1',
1 => 'combodo-coverage-windows-computation/2.0.0',
],
'2.1.0' =>
[
0 => 'combodo-sla-computation/2.1.0',
1 => 'combodo-coverage-windows-computation/2.0.0',
],
'2.1.1' =>
[
0 => 'combodo-sla-computation/2.1.1',
1 => 'combodo-coverage-windows-computation/2.0.0',
],
'2.1.2' =>
[
0 => 'combodo-sla-computation/2.1.2',
1 => 'combodo-coverage-windows-computation/2.0.0',
],
'2.1.3' =>
[
0 => 'combodo-sla-computation/2.1.2',
1 => 'combodo-coverage-windows-computation/2.0.1',
],
'2.0.2' =>
[
0 => 'combodo-sla-computation/2.0.1',
1 => 'combodo-coverage-windows-computation/2.0.1',
],
'2.1.4' =>
[
0 => 'combodo-sla-computation/2.1.3',
1 => 'combodo-coverage-windows-computation/2.0.1',
],
'2.1.5' =>
[
0 => 'combodo-sla-computation/2.1.5',
1 => 'combodo-coverage-windows-computation/2.0.1',
],
'2.1.6' =>
[
0 => 'combodo-sla-computation/2.1.5',
1 => 'combodo-coverage-windows-computation/2.0.2',
],
'2.1.7' =>
[
0 => 'combodo-sla-computation/2.1.6',
1 => 'combodo-coverage-windows-computation/2.0.2',
],
'2.1.8' =>
[
0 => 'combodo-sla-computation/2.1.7',
1 => 'combodo-coverage-windows-computation/2.0.2',
],
'2.1.9' =>
[
0 => 'combodo-sla-computation/2.1.8',
1 => 'combodo-coverage-windows-computation/2.0.2',
],
],
],
'combodo-mail-to-ticket-automation' =>
[
'label' => 'Mail to ticket automation',
'description' => 'Scan several mailboxes to create or update tickets.',
'versions' =>
[
'2.6.0' =>
[
0 => 'combodo-email-synchro/2.6.0',
1 => 'itop-standard-email-synchro/2.6.0',
],
'2.6.1' =>
[
0 => 'combodo-email-synchro/2.6.1',
1 => 'itop-standard-email-synchro/2.6.0',
],
'2.6.2' =>
[
0 => 'combodo-email-synchro/2.6.2',
1 => 'itop-standard-email-synchro/2.6.0',
],
'2.6.3' =>
[
0 => 'combodo-email-synchro/2.6.2',
1 => 'itop-standard-email-synchro/2.6.1',
],
'2.6.4' =>
[
0 => 'combodo-email-synchro/2.6.3',
1 => 'itop-standard-email-synchro/2.6.2',
],
'2.6.5' =>
[
0 => 'combodo-email-synchro/2.6.4',
1 => 'itop-standard-email-synchro/2.6.2',
],
'2.6.6' =>
[
0 => 'combodo-email-synchro/2.6.5',
1 => 'itop-standard-email-synchro/2.6.3',
],
'2.6.7' =>
[
0 => 'combodo-email-synchro/2.6.6',
1 => 'itop-standard-email-synchro/2.6.4',
],
'2.6.8' =>
[
0 => 'combodo-email-synchro/2.6.7',
1 => 'itop-standard-email-synchro/2.6.4',
],
'2.6.9' =>
[
0 => 'combodo-email-synchro/2.6.8',
1 => 'itop-standard-email-synchro/2.6.5',
],
'2.6.10' =>
[
0 => 'combodo-email-synchro/2.6.9',
1 => 'itop-standard-email-synchro/2.6.6',
],
'2.6.11' =>
[
0 => 'combodo-email-synchro/2.6.10',
1 => 'itop-standard-email-synchro/2.6.6',
],
'2.6.12' =>
[
0 => 'combodo-email-synchro/2.6.11',
1 => 'itop-standard-email-synchro/2.6.6',
],
'3.0.0' =>
[
0 => 'combodo-email-synchro/3.0.0',
1 => 'itop-standard-email-synchro/3.0.0',
],
'3.0.1' =>
[
0 => 'combodo-email-synchro/3.0.1',
1 => 'itop-standard-email-synchro/3.0.1',
],
'3.0.2' =>
[
0 => 'combodo-email-synchro/3.0.2',
1 => 'itop-standard-email-synchro/3.0.1',
],
'3.0.3' =>
[
0 => 'combodo-email-synchro/3.0.3',
1 => 'itop-standard-email-synchro/3.0.3',
],
'3.0.4' =>
[
0 => 'combodo-email-synchro/3.0.3',
1 => 'itop-standard-email-synchro/3.0.4',
],
'3.0.5' =>
[
0 => 'combodo-email-synchro/3.0.4',
1 => 'itop-standard-email-synchro/3.0.4',
],
'3.0.6' =>
[
0 => 'combodo-email-synchro/3.0.5',
1 => 'itop-standard-email-synchro/3.0.4',
],
'3.0.7' =>
[
0 => 'combodo-email-synchro/3.0.5',
1 => 'itop-standard-email-synchro/3.0.5',
],
],
],
'combodo-configurator-for-automatic-object-creation' =>
[
'label' => 'Configurator for automatic object creation',
'description' => 'Templating based on existing objects.',
'versions' =>
[
'1.0.13' =>
[
1 => 'itop-stencils/1.0.6',
],
],
],
'combodo-user-actions-configurator' =>
[
'label' => 'User actions configurator',
'description' => 'Configure user actions to simplify and automate processes (e.g. create an incident from a CI).',
'versions' =>
[
'1.0.0' =>
[
0 => 'itop-object-copier/1.0.0',
],
'1.0.1' =>
[
0 => 'itop-object-copier/1.0.1',
],
'1.0.2' =>
[
0 => 'itop-object-copier/1.0.2',
],
'1.0.3' =>
[
0 => 'itop-object-copier/1.0.3',
],
'1.1.0' =>
[
0 => 'itop-object-copier/1.1.0',
],
'1.1.1' =>
[
0 => 'itop-object-copier/1.1.1',
],
'1.1.2' =>
[
0 => 'itop-object-copier/1.1.2',
],
'1.1.3' =>
[
0 => 'itop-object-copier/1.1.3',
],
'1.1.4' =>
[
0 => 'itop-object-copier/1.1.4',
],
'1.1.5' =>
[
0 => 'itop-object-copier/1.1.5',
],
'1.1.6' =>
[
0 => 'itop-object-copier/1.1.6',
],
'1.1.7' =>
[
0 => 'itop-object-copier/1.1.7',
],
'1.1.8' =>
[
0 => 'itop-object-copier/1.1.8',
],
],
],
'combodo-send-updates-by-email' =>
[
'label' => 'Send updates by email',
'description' => 'Send an email to pre-configured contacts when a ticket log is updated.',
'versions' =>
[
'1.0.1' =>
[
0 => 'email-reply/1.0.1',
],
'1.0.3' =>
[
0 => 'email-reply/1.0.3',
],
'1.1.1' =>
[
0 => 'email-reply/1.1.1',
],
'1.1.2' =>
[
0 => 'email-reply/1.1.2',
],
'1.1.3' =>
[
0 => 'email-reply/1.1.3',
],
'1.1.4' =>
[
0 => 'email-reply/1.1.4',
],
'1.1.5' =>
[
0 => 'email-reply/1.1.5',
],
'1.1.6' =>
[
0 => 'email-reply/1.1.6',
],
'1.1.7' =>
[
0 => 'email-reply/1.1.7',
],
// 1.1.8 was never released
'1.1.9' =>
[
0 => 'email-reply/1.1.9',
],
'1.1.10' =>
[
0 => 'email-reply/1.1.10',
],
],
],
];
}
}

View File

@@ -3,7 +3,6 @@
namespace Combodo\iTop\Setup\ModuleDependency;
require_once(APPROOT.'/setup/runtimeenv.class.inc.php');
use Combodo\iTop\PhpParser\Evaluation\PhpExpressionEvaluator;
use ModuleFileReaderException;
use RunTimeEnvironment;
@@ -39,7 +38,7 @@ class DependencyExpression
if (preg_match_all('/([^\(\)&| ]+)/', $sDependencyExpression, $aMatches)) {
foreach ($aMatches as $aMatch) {
foreach ($aMatch as $sModuleId) {
if (!array_key_exists($sModuleId, $this->aParamsPerModuleId)) {
if (! array_key_exists($sModuleId, $this->aParamsPerModuleId)) {
// $sModuleId in the dependency string is made of a <name>/<optional_operator><version>
// where the operator is < <= = > >= (by default >=)
$aModuleMatches = [];
@@ -72,7 +71,6 @@ class DependencyExpression
/**
* Return module names potentially required by current dependency
*
* @return array
*/
public function GetRemainingModuleNamesToResolve(): array
@@ -87,25 +85,22 @@ class DependencyExpression
/**
* Check if dependency is resolved with current list of module versions
*
* @param array $aResolvedModuleVersions : versions by module names dict
* @param array $aAllModuleNames : modules names dict
* @param array $aModuleVersions: versions by module names dict
* @param array $aSelectedModules: modules names dict
*
* @return void
*/
public function UpdateModuleResolutionState(array $aResolvedModuleVersions, array $aAllModuleNames): void
public function UpdateModuleResolutionState(array $aModuleVersions, array $aSelectedModules): void
{
if (!$this->bValid) {
return;
}
$aReplacements = [];
$bDelayEvaluation = false;
foreach ($this->aParamsPerModuleId as $sModuleId => list($sModuleName, $sOperator, $sExpectedVersion)) {
if (array_key_exists($sModuleName, $aResolvedModuleVersions)) {
// module is resolved, check the version
$sCurrentVersion = $aResolvedModuleVersions[$sModuleName];
if (array_key_exists($sModuleName, $aModuleVersions)) {
// module is present, check the version
$sCurrentVersion = $aModuleVersions[$sModuleName];
if (version_compare($sCurrentVersion, $sExpectedVersion, $sOperator)) {
if (array_key_exists($sModuleName, $this->aRemainingModuleNamesToResolve)) {
unset($this->aRemainingModuleNamesToResolve[$sModuleName]);
@@ -117,23 +112,19 @@ class DependencyExpression
// a function call that results in a runtime fatal error
}
} else {
// module is not resolved yet
if (array_key_exists($sModuleName, $aAllModuleNames)) {
//Weird piece of code that covers below usecase:
//module B dependency: 'moduleA || true'
// if moduleA not present on disk, whole expression can be evaluated and may be resolved
// if moduleA present on disk, we need to sort moduleB after moduleA. expression cannot be resolved yet
$bDelayEvaluation = true;
} else {
$aReplacements[$sModuleId] = '(false)'; // Add parentheses to protect against invalid condition causing
}
// module is not present
$aReplacements[$sModuleId] = '(false)'; // Add parentheses to protect against invalid condition causing
// a function call that results in a runtime fatal error
}
}
if ($bDelayEvaluation) {
return;
foreach ($this->aRemainingModuleNamesToResolve as $sModuleName => $c) {
if (array_key_exists($sModuleName, $aSelectedModules)) {
// This module is actually a prerequisite
if (!array_key_exists($sModuleName, $aModuleVersions)) {
return;
}
}
}
$bResult = false;

View File

@@ -93,18 +93,18 @@ class Module
/**
* Check if module dependencies are resolved with current list of module versions
* @param array<string, string> $aResolvedModuleVersions : versions by module names dict
* @param array<string> $aAllModuleNames : resolved modules names
* @param array $aModuleVersions : versions by module names dict
* @param array $aSelectedModules : modules names dict
*
* @return void
*/
public function UpdateModuleResolutionState(array $aResolvedModuleVersions, array $aAllModuleNames): void
public function UpdateModuleResolutionState(array $aModuleVersions, array $aSelectedModules): void
{
$aNextDependencies = [];
foreach ($this->aRemainingDependenciesToResolve as $sDependencyExpression => $oModuleDependency) {
/** @var DependencyExpression $oModuleDependency*/
$oModuleDependency->UpdateModuleResolutionState($aResolvedModuleVersions, $aAllModuleNames);
$oModuleDependency->UpdateModuleResolutionState($aModuleVersions, $aSelectedModules);
if (!$oModuleDependency->IsResolved()) {
$aNextDependencies[$sDependencyExpression] = $oModuleDependency;
}

View File

@@ -33,10 +33,8 @@ class ModuleDependencySort
/**
* Sort a list of modules, based on their (inter) dependencies
*
* @param array $aModules The list of modules to process: 'id' => $aModuleInfo
* @param bool $bAbortOnMissingDependency ...
*
* @return array
* @throws \MissingDependencyException
*/
@@ -44,13 +42,13 @@ class ModuleDependencySort
{
// Filter modules to compute
$aUnresolvedDependencyModules = [];
$aAllModuleNames = [];
$aModuleNames = [];
foreach ($aModules as $sModuleId => $aModule) {
$oModule = new Module($sModuleId);
$sModuleName = $oModule->GetModuleName();
$oModule->SetDependencies($aModule['dependencies']);
$aUnresolvedDependencyModules[$sModuleId] = $oModule;
$aAllModuleNames[$sModuleName] = true;
$aModuleNames[$sModuleName] = true;
}
// Make sure order is deterministic (alphabtical order)
@@ -58,7 +56,7 @@ class ModuleDependencySort
//Attempt to resolve module dependencies
$aOrderedModules = [];
$aResolvedModuleVersions = [];
$aModuleVersions = [];
$iPreviousUnresolvedCount = -1;
//loop until no dependency is resolved
while ($iPreviousUnresolvedCount !== count($aUnresolvedDependencyModules)) {
@@ -69,10 +67,10 @@ class ModuleDependencySort
foreach ($aUnresolvedDependencyModules as $sModuleId => $oModule) {
/** @var Module $oModule */
$oModule->UpdateModuleResolutionState($aResolvedModuleVersions, $aAllModuleNames);
$oModule->UpdateModuleResolutionState($aModuleVersions, $aModuleNames);
if ($oModule->IsResolved()) {
$aOrderedModules[] = $sModuleId;
$aResolvedModuleVersions[$oModule->GetModuleName()] = $oModule->GetVersion();
$aModuleVersions[$oModule->GetModuleName()] = $oModule->GetVersion();
unset($aUnresolvedDependencyModules[$sModuleId]);
}
}
@@ -102,7 +100,6 @@ class ModuleDependencySort
foreach ($aOrderedModules as $sId) {
$aResult[$sId] = $aModules[$sId];
}
return $aResult;
}
@@ -114,7 +111,7 @@ class ModuleDependencySort
* - cyclic dependencies
* - further versions of same module (name)
*
* @param array $aUnresolvedDependencyModules : dict of Module objects by moduleId key
* @param array $aUnresolvedDependencyModules: dict of Module objects by moduleId key
*
* @return void
*/
@@ -149,7 +146,7 @@ class ModuleDependencySort
uasort($aCountDepsByModuleId, function (array $aDeps1, array $aDeps2) {
//compare $iInDegreeCounter
$res = $aDeps1[0] - $aDeps2[0];
$res = $aDeps1[0] - $aDeps2[0];
if ($res != 0) {
return $res;
}
@@ -180,7 +177,7 @@ class ModuleDependencySort
//when 2 versions of the same module (name) below array has been removed already
if (array_key_exists($oModule->GetModuleName(), $aDependsOnModuleName)) {
foreach ($aDependsOnModuleName[$oModule->GetModuleName()] as $sModuleId2) {
if (!array_key_exists($sModuleId2, $aCountDepsByModuleId)) {
if (! array_key_exists($sModuleId2, $aCountDepsByModuleId)) {
continue;
}
$aDepCount = $aCountDepsByModuleId[$sModuleId2];

View File

@@ -89,7 +89,6 @@ class ExtensionInstallation extends cmdbAbstractObject
MetaModel::Init_AddAttribute(new AttributeString("source", ["allowed_values" => null, "sql" => "source", "default_value" => null, "is_null_allowed" => false, "depends_on" => []]));
MetaModel::Init_AddAttribute(new AttributeEnum("uninstallable", ["allowed_values" => new ValueSetEnum('yes,no,maybe'), "sql" => "uninstallable", "default_value" => 'yes', "is_null_allowed" => false, "depends_on" => []]));
MetaModel::Init_AddAttribute(new AttributeDateTime("installed", ["allowed_values" => null, "sql" => "installed", "default_value" => 'NOW()', "is_null_allowed" => false, "depends_on" => []]));
MetaModel::Init_AddAttribute(new AttributeText("description", ["allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => []]));
// Display lists
MetaModel::Init_SetZListItems('details', ['code', 'label', 'version', 'installed', 'source']); // Attributes to be displayed for the complete details

View File

@@ -373,7 +373,7 @@ class RunTimeEnvironment
// mark as (automatically) chosen alll the "remote" modules present in the
// target environment (data/<target-env>-modules)
// The actual choices will be recorded by RecordInstallation below
$this->oExtensionsMap = new iTopExtensionsMap($this->sTargetEnv, $aExtraDirs);
$this->oExtensionsMap = new iTopExtensionsMap($this->sTargetEnv, true, $aExtraDirs);
$this->oExtensionsMap->LoadChoicesFromDatabase($oSourceConfig);
foreach ($this->oExtensionsMap->GetAllExtensions() as $oExtension) {
if ($this->IsExtensionSelected($oExtension)) {
@@ -719,7 +719,6 @@ class RunTimeEnvironment
$oInstallRec->Set('source', $oExtension->sSource);
$oInstallRec->Set('uninstallable', $oExtension->CanBeUninstalled() ? 'yes' : 'no');
$oInstallRec->Set('installed', $iInstallationTime);
$oInstallRec->Set('description', $oExtension->sDescription);
$oInstallRec->DBInsertNoReload();
}
}
@@ -997,7 +996,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 {

View File

@@ -79,7 +79,7 @@ class InstallationFileService
public function GetItopExtensionsMap(): ItopExtensionsMap
{
if (is_null($this->oItopExtensionsMap)) {
$this->oItopExtensionsMap = new iTopExtensionsMap($this->sTargetEnvironment);
$this->oItopExtensionsMap = new iTopExtensionsMap($this->sTargetEnvironment, true);
}
return $this->oItopExtensionsMap;
}

View File

@@ -210,12 +210,12 @@ HTML;
}
}
$oPage->LinkScriptFromAppRoot('setup/setup.js');
$oPage->add_script("function CanMoveForward()\n{\n".$oStep->JSCanMoveForward()."\n}\n");
$oPage->add_script("function CanMoveBackward()\n{\n".$oStep->JSCanMoveBackward()."\n}\n");
$oPage->add('<form id="wiz_form" class="ibo-setup--wizard" method="post">');
$oPage->add('<div class="ibo-setup--wizard--content">');
$oStep->Display($oPage);
$oPage->add('</div>');
$oPage->add_script("function CanMoveForward()\n{\n".$oStep->JSCanMoveForward()."\n}\n");
$oPage->add_script("function CanMoveBackward()\n{\n".$oStep->JSCanMoveBackward()."\n}\n");
// Add the back / next buttons and the hidden form
// to store the parameters

View File

@@ -1310,16 +1310,14 @@ EOF
*/
class WizStepModulesChoice extends WizardStep
{
protected static string $SEP = '_';
protected bool $bUpgrade = false;
protected bool $bCanMoveForward = true;
protected ?Config $oConfig = null;
protected static $SEP = '_';
protected $bUpgrade = false;
/**
*
* @var iTopExtensionsMap
*/
protected iTopExtensionsMap $oExtensionsMap;
protected $oExtensionsMap;
protected PhpExpressionEvaluator $oPhpExpressionEvaluator;
@@ -1327,7 +1325,7 @@ class WizStepModulesChoice extends WizardStep
* Whether we were able to load the choices from the database or not
* @var bool
*/
protected bool $bChoicesFromDatabase;
protected $bChoicesFromDatabase;
public function __construct(WizardController $oWizard, $sCurrentState)
{
@@ -1345,13 +1343,12 @@ class WizStepModulesChoice extends WizardStep
// only called if the config file exists : we are updating a previous installation !
// WARNING : we can't load this config directly, as it might be from another directory with a different approot_url (N°2684)
if ($sConfigPath !== null) {
$this->oConfig = new Config($sConfigPath);
$oConfig = new Config($sConfigPath);
$aParamValues = $oWizard->GetParamForConfigArray();
$this->oConfig->UpdateFromParams($aParamValues);
$oConfig->UpdateFromParams($aParamValues);
$this->oExtensionsMap->LoadChoicesFromDatabase($this->oConfig);
$this->bChoicesFromDatabase = true;
$this->bChoicesFromDatabase = $this->oExtensionsMap->LoadChoicesFromDatabase($oConfig);
}
}
@@ -1455,7 +1452,7 @@ class WizStepModulesChoice extends WizardStep
}
$oPage->add('<img src="'.$sBannerUrl.'"/>');
}
$sDescription = $aStepInfo['description'] ?? '';
$sDescription = isset($aStepInfo['description']) ? $aStepInfo['description'] : '';
$oPage->add('<span>'.$sDescription.'</span>');
$oPage->add('</div>');
@@ -1849,7 +1846,6 @@ EOF
}
return $index;
}
protected function GetStepInfo($idx = null)
{
$aStepInfo = null;
@@ -1870,12 +1866,12 @@ EOF
// Additional step for the "extensions"
$aStepDefinition = [
'title' => 'Extensions',
'description' => '<h2>Select additional extensions to install. You can launch the installation again to install new extensions or remove installed ones.</h2>',
'description' => '<h2>Select additional extensions to install. You can launch the installation again to install new extensions, but you cannot remove already installed extensions.</h2>',
'banner' => '/images/icons/icons8-puzzle.svg',
'options' => [],
];
foreach ($this->oExtensionsMap->GetAllExtensionsWithPreviouslyInstalled() as $oExtension) {
foreach ($this->oExtensionsMap->GetAllExtensions() as $oExtension) {
if (($oExtension->sSource !== iTopExtension::SOURCE_WIZARD) && ($oExtension->bVisible) && (count($oExtension->aMissingDependencies) == 0)) {
$aStepDefinition['options'][] = [
'extension_code' => $oExtension->sCode,
@@ -1886,19 +1882,16 @@ EOF
'modules' => $oExtension->aModules,
'mandatory' => $oExtension->bMandatory || ($oExtension->sSource === iTopExtension::SOURCE_REMOTE),
'source_label' => $this->GetExtensionSourceLabel($oExtension->sSource),
'uninstallable' => $oExtension->CanBeUninstalled(),
'missing' => $oExtension->bRemovedFromDisk,
];
}
}
// Display this step of the wizard only if there is something to display
if (count($aStepDefinition['options']) !== 0) {
$aSteps[] = $aStepDefinition;
$this->oWizard->SetParameter('additional_extensions_modules', json_encode($aStepDefinition['options']));
}
} else {
// No wizard configuration provided, build a standard one with just one big list. All items are mandatory, only works when there are no conflicted modules.
// No wizard configuration provided, build a standard one with just one big list
$aStepDefinition = [
'title' => 'Modules Selection',
'description' => '<h2>Select the modules to install. You can launch the installation again to install new modules, but you cannot remove already installed modules.</h2>',
@@ -1965,41 +1958,18 @@ EOF
$sId = utils::EscapeHtml($aChoice['extension_code']);
$bIsDefault = array_key_exists($sChoiceId, $aDefaults);
$oITopExtension = $this->oExtensionsMap->GetFromExtensionCode($aChoice['extension_code']);
$bCanBeUninstalled = isset($aChoice['uninstallable']) ? $aChoice['uninstallable'] : $oITopExtension->CanBeUninstalled();
$bCanBeUninstalled = $this->oExtensionsMap->Get($aChoice['extension_code'])->CanBeUninstalled();
$bSelected = isset($aSelectedComponents[$sChoiceId]) && ($aSelectedComponents[$sChoiceId] == $sChoiceId);
$bMandatory = (isset($aChoice['mandatory']) && $aChoice['mandatory']) || $this->bUpgrade && $bIsDefault && !$bCanBeUninstalled && !$bDisableUninstallCheck;
;
$bMissingFromDisk = isset($aChoice['missing']) && $aChoice['missing'] === true;
$bInstalled = $bMissingFromDisk || $oITopExtension->bInstalled;
$bDisabled = $bMandatory || $bAllDisabled || $bMissingFromDisk;
$bDisabled = $bMandatory || $bAllDisabled;
$bChecked = $bMandatory || $bSelected;
$sTooltip = '';
$sUnremovable = '';
if ($bMissingFromDisk) {
$sTooltip .= '<span class="setup-extension-tag removed">source removed</span>';
}
if ($bInstalled) {
$sTooltip .= '<span class="setup-extension-tag checked installed">installed</span>';
$sTooltip .= '<span class="setup-extension-tag unchecked tobeuninstalled">to be uninstalled</span>';
} else {
$sTooltip .= '<span class="setup-extension-tag checked tobeinstalled">to be installed</span>';
$sTooltip .= '<span class="setup-extension-tag unchecked notinstalled">not installed</span>';
}
if (!$bCanBeUninstalled) {
$sTooltip .= '<span class="setup-extension-tag notuninstallable">cannot be uninstalled</span>';
}
if ($bDisabled && !$bChecked && !$bCanBeUninstalled && !$bDisableUninstallCheck) {
$this->bCanMoveForward = false;//Disable "Next"
}
$sChecked = $bChecked ? ' checked ' : '';
$sDisabled = $bDisabled ? ' disabled data-disabled="disabled" ' : '';
$sMissingModule = $bMissingFromDisk ? 'setup-extension--missing' : '';
$sUnremovable = !$bCanBeUninstalled ? ' unremovable ' : '';
$sHiddenInput = $bDisabled && $bChecked ? '<input type="hidden" name="choice['.$sChoiceId.']" value="'.$sChoiceId.'"/>' : '';
$oPage->add('<div class="choice '.$sMissingModule.'" '.$sDataId.'><input class="wiz-choice '.$sUnremovable.'" id="'.$sId.'" name="choice['.$sChoiceId.']" type="checkbox" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/>'.$sHiddenInput.'&nbsp;');
$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled, $sTooltip);
$oPage->add('<div class="choice" '.$sDataId.'><input class="wiz-choice '.$sUnremovable.'" id="'.$sId.'" name="choice['.$sChoiceId.']" type="checkbox" value="'.$sChoiceId.'" '.$sDisabled.$sChecked.'/>'.$sHiddenInput.'&nbsp;');
$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled, $bCanBeUninstalled);
$oPage->add('</div>');
}
$sChoiceName = null;
@@ -2060,13 +2030,14 @@ EOF
}
}
protected function DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled = false, $sTooltip = '')
protected function DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $bDisabled = false, $bUninstallable = true)
{
$sMoreInfo = (isset($aChoice['more_info']) && ($aChoice['more_info'] != '')) ? '<a class="setup--wizard-choice--more-info" target="_blank" href="'.$aChoice['more_info'].'">More information</a>' : '';
$sSourceLabel = $aChoice['source_label'] ?? '';
$sSourceLabel = isset($aChoice['source_label']) ? $aChoice['source_label'] : '';
$sId = utils::EscapeHtml($aChoice['extension_code']);
$sUninstallationWarning = $bUninstallable ? '' : '<span style="color:orangered" title="Once this extension has been installed, it cannot be removed">(!)</span>';
$oPage->add('<label class="setup--wizard-choice--label" for="'.$sId.'">'.$sSourceLabel.'<b>'.utils::EscapeHtml($aChoice['title']).'</b>'.'&nbsp;'.$sTooltip.'</label> '.$sMoreInfo.'');
$oPage->add('<label class="setup--wizard-choice--label" for="'.$sId.'">'.$sSourceLabel.'<b>'.utils::EscapeHtml($aChoice['title']).'</b>'.'</label>&nbsp;'.$sUninstallationWarning.' '.$sMoreInfo.'');
$sDescription = isset($aChoice['description']) ? utils::EscapeHtml($aChoice['description']) : '';
$oPage->add('<div class="setup--wizard-choice--description description">'.$sDescription.'<span id="sub_choices'.$sId.'">');
if (isset($aChoice['sub_options'])) {
@@ -2081,22 +2052,6 @@ EOF
return $sSourceDir.'/installation.xml';
}
public function CanMoveForward()
{
return true;
}
public function JSCanMoveForward()
{
return $this->bCanMoveForward ? 'return true;' : 'return false;';
}
public function GetNextButtonLabel()
{
return $this->bCanMoveForward ? 'Next' : 'Non-uninstallable extension missing';
}
}
/**

View File

@@ -32,6 +32,7 @@ use ValueSetObjects;
*/
class AttributeLinkedSet extends AttributeDefinition
{
public $bAllowAllData = false;
/**
* Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329)
*
@@ -50,6 +51,11 @@ class AttributeLinkedSet extends AttributeDefinition
$this->aCSSClasses[] = 'attribute-set';
}
public function AllowAllData()
{
$this->bAllowAllData = true;
}
public static function ListExpectedParams()
{
return array_merge(
@@ -143,6 +149,9 @@ class AttributeLinkedSet extends AttributeDefinition
}
$oLinkSearch = new DBObjectSearch($sLinkClass);
if ($this->bAllowAllData) {
$oLinkSearch->AllowAllData(true);
}
$oLinkSearch->AddCondition_PointingTo($oMyselfSearch, $sExtKeyToMe);
if ($this->IsIndirect()) {
// Join the remote class so that the archive flag will be taken into account

View File

@@ -1,26 +0,0 @@
<?php
namespace Combodo\iTop\Test\UnitTest\Integration;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use ItopExtensionsMap;
use ModuleDiscovery;
class ExtensionsMapTest extends ItopTestCase
{
protected function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
$this->RequireOnceItopFile('/setup/unattended-install/InstallationFileService.php');
ModuleDiscovery::ResetCache();
}
public function testGetAllExtensionsWithPreviouslyInstalledDoesNotCrash()
{
$oExtensionsMap = new iTopExtensionsMap();
$aExtensions = $oExtensionsMap->GetAllExtensionsWithPreviouslyInstalled();
$this->assertGreaterThan(0, count($aExtensions));
}
}

View File

@@ -24,23 +24,23 @@ class DependencyExpressionTest extends ItopTestCase
{
return [
"nominal case" => [
"dep" => "itop-config-mgmt/2.4.0",
"dep" => "itop-config-mgmt/2.4.0",
'expected_operator' => '>=',
],
">" => [
"dep" => "itop-config-mgmt/>2.4.0",
">" => [
"dep" => "itop-config-mgmt/>2.4.0",
'expected_operator' => '>',
],
">=" => [
"dep" => "itop-config-mgmt/>=2.4.0",
">=" => [
"dep" => "itop-config-mgmt/>=2.4.0",
'expected_operator' => '>=',
],
"<" => [
"dep" => "itop-config-mgmt/<2.4.0",
"<" => [
"dep" => "itop-config-mgmt/<2.4.0",
'expected_operator' => '<',
],
"<=" => [
"dep" => "itop-config-mgmt/<=2.4.0",
"<=" => [
"dep" => "itop-config-mgmt/<=2.4.0",
'expected_operator' => '<=',
],
];
@@ -59,32 +59,31 @@ class DependencyExpressionTest extends ItopTestCase
$this->assertEquals(['itop-config-mgmt'], $oModuleDependency->GetRemainingModuleNamesToResolve());
}
public static function WithVariousOperatorProvider()
public static function WithOperatorOperandProvider()
{
$aInternalStructure = ['itop-structure/3.0.0' => ['itop-structure', ">=", '3.0.0'], 'itop-portal/<3.2.1' => ['itop-portal', "<", '3.2.1']];
$aInternalStructure = ['itop-structure/3.0.0' => [ 'itop-structure', ">=", '3.0.0'], 'itop-portal/<3.2.1' => [ 'itop-portal', "<", '3.2.1']];
return [
'&&' => [
'sDepId' => 'itop-structure/3.0.0 && itop-portal/<3.2.1',
'&&' => [
'sDepId' => 'itop-structure/3.0.0 && itop-portal/<3.2.1',
'expected_structure' => $aInternalStructure,
],
'&& with parenthesis' => [
'sDepId' => '(itop-structure/3.0.0) && (itop-portal/<3.2.1)',
'sDepId' => '(itop-structure/3.0.0) && (itop-portal/<3.2.1)',
'expected_structure' => $aInternalStructure,
],
'||' => [
'sDepId' => 'itop-structure/3.0.0 || itop-portal/<3.2.1',
'||' => [
'sDepId' => 'itop-structure/3.0.0 || itop-portal/<3.2.1',
'expected_structure' => $aInternalStructure,
],
'|| with parenthesis' => [
'sDepId' => '(itop-structure/3.0.0) || (itop-portal/<3.2.1)',
'sDepId' => '(itop-structure/3.0.0) || (itop-portal/<3.2.1)',
'expected_structure' => $aInternalStructure,
],
];
}
/**
* @dataProvider WithVariousOperatorProvider
* @dataProvider WithOperatorOperandProvider
*/
public function testModuleDependencyInit_WithOperand($sDepId, $sExpected)
{
@@ -98,30 +97,30 @@ class DependencyExpressionTest extends ItopTestCase
public static function SimpleDependencyExpressionIsResolvedProvider()
{
return [
'unresolved with major version' => [
'expr' => 'itop-config-mgmt/2.4.0',
'resolved_module_versions' => ['itop-config-mgmt' => '1.2.3'],
'expected_is_resolved' => false,
'unresolved with major version' => [
'expr' => 'itop-config-mgmt/2.4.0',
'module_versions' => ['itop-config-mgmt' => '1.2.3'],
'expected_is_resolved' => false,
],
'unresolved with minor version' => [
'expr' => 'itop-config-mgmt/2.4.1',
'resolved_module_versions' => ['itop-config-mgmt' => '2.4.0-1'],
'expected_is_resolved' => false,
'unresolved with minor version' => [
'expr' => 'itop-config-mgmt/2.4.1',
'module_versions' => ['itop-config-mgmt' => '2.4.0-1'],
'expected_is_resolved' => false,
],
'resolution OK with major version' => [
'expr' => 'itop-config-mgmt/2.4.0',
'resolved_module_versions' => ['itop-config-mgmt' => '2.4.2'],
'expected_is_resolved' => true,
'expr' => 'itop-config-mgmt/2.4.0',
'module_versions' => ['itop-config-mgmt' => '2.4.2'],
'expected_is_resolved' => true,
],
'resolution OK with minor version' => [
'expr' => 'itop-config-mgmt/2.4.0',
'resolved_module_versions' => ['itop-config-mgmt' => '2.4.0-1'],
'expected_is_resolved' => true,
'expr' => 'itop-config-mgmt/2.4.0',
'module_versions' => ['itop-config-mgmt' => '2.4.0-1'],
'expected_is_resolved' => true,
],
'unproper use of api' => [
'expr' => 'itop-config-mgmt/2.4.0',
'resolved_module_versions' => [],
'expected_is_resolved' => false,
'unproper use of api' => [
'expr' => 'itop-config-mgmt/2.4.0',
'module_versions' => [],
'expected_is_resolved' => false,
],
];
}
@@ -141,64 +140,37 @@ class DependencyExpressionTest extends ItopTestCase
public static function ComplexDependencyExpressionIsResolvedProvider()
{
$aAllModules = ['itop-structure' => true, 'itop-portal' => true];
return [
'and + unresolved due to missing itop-portal' => [
'expr' => 'itop-structure/3.0.0 && itop-portal/3.2.1',
'resolved_module_versions' => ['itop-structure' => '3.0.0'],
'all_modules' => $aAllModules,
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-portal'],
'and + unresolved due to missing itop-portal' => [
'expr' => 'itop-structure/3.0.0 && itop-portal/3.2.1',
'module_versions' => ['itop-structure' => '3.0.0'],
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-portal'],
],
'and + unresolved due to unsifficient itop-portal version' => [
'expr' => 'itop-structure/3.0.0 && itop-portal/3.2.1',
'resolved_module_versions' => ['itop-structure' => '3.0.0', 'itop-portal' => '1.0.0'],
'all_modules' => $aAllModules,
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-portal'],
'and + unresolved due to unsifficient itop-portal version' => [
'expr' => 'itop-structure/3.0.0 && itop-portal/3.2.1',
'module_versions' => ['itop-structure' => '3.0.0', 'itop-portal' => '1.0.0'],
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-portal'],
],
'and + resolved' => [
'expr' => 'itop-structure/3.0.0 && itop-portal/3.2.1',
'resolved_module_versions' => ['itop-structure' => '3.0.0', 'itop-portal' => '3.3.3'],
'all_modules' => $aAllModules,
'expected_is_resolved' => true,
'remaining_module_names' => [],
'and + resolved' => [
'expr' => 'itop-structure/3.0.0 && itop-portal/3.2.1',
'module_versions' => ['itop-structure' => '3.0.0', 'itop-portal' => '3.3.3'],
'expected_is_resolved' => true,
'remaining_module_names' => [],
],
'or||true (step1) + dependency expression evaluation is delayed for sorting purpose' => [
'expr' => 'itop-structure/3.0.0||true',
'resolved_module_versions' => [],
'all_modules' => $aAllModules,
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-structure'],
'or + resolved' => [
'expr' => 'itop-structure/3.0.0 || itop-portal/3.2.1',
'module_versions' => ['itop-structure' => '3.0.0'],
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-portal'],
],
'or||true (step2) + expression is evaluated because itop-structure has been resolved' => [
'expr' => 'itop-structure/3.0.0||true',
'resolved_module_versions' => ['itop-structure' => '3.0.0'],
'all_modules' => $aAllModules,
'expected_is_resolved' => true,
'remaining_module_names' => [],
],
'or||true + resolved DIRECTLY as itop-structure is not on disk (all_modules)' => [
'expr' => 'itop-structure/3.0.0||true',
'resolved_module_versions' => [],
'all_modules' => [],
'expected_is_resolved' => true,
'remaining_module_names' => ['itop-structure'],
],
'or + unresolved because dependency trick used to sort as well' => [
'expr' => 'itop-structure/3.0.0 || itop-portal/3.2.1',
'resolved_module_versions' => ['itop-structure' => '3.0.0'],
'all_modules' => $aAllModules,
'expected_is_resolved' => false,
'remaining_module_names' => ['itop-portal'],
],
'1 can be used as a boolean' => [
'expr' => 'true||1',
'resolved_module_versions' => [],
'all_modules' => [],
'expected_is_resolved' => true,
'remaining_module_names' => [],
'or + resolved with less prerequisites' => [
'expr' => 'itop-structure/3.0.0 || itop-portal/3.2.1',
'module_versions' => ['itop-structure' => '3.0.0'],
'expected_is_resolved' => true,
'remaining_module_names' => ['itop-portal'],
'prerequisites' => ['itop-structure' => true],
],
];
}
@@ -206,11 +178,11 @@ class DependencyExpressionTest extends ItopTestCase
/**
* @dataProvider ComplexDependencyExpressionIsResolvedProvider
*/
public function testComplexDependencyExpressionIsResolved($sExpression, $aModuleVersions, $aAllModules, $bExpectedResolved, $aRemainingModuleNames)
public function testComplexDependencyExpressionIsResolved($sExpression, $aModuleVersions, $bExpectedResolved, $aRemainingModuleNames, $aPrerequisites = ['itop-structure' => true, 'itop-portal' => true])
{
$oModuleDependency = new DependencyExpression($sExpression);
$oModuleDependency->UpdateModuleResolutionState($aModuleVersions, $aAllModules);
$oModuleDependency->UpdateModuleResolutionState($aModuleVersions, $aPrerequisites);
$this->assertEquals($aRemainingModuleNames, $oModuleDependency->GetRemainingModuleNamesToResolve());
$this->assertEquals($bExpectedResolved, $oModuleDependency->IsResolved());
}