2.3.x至2.4.0迁入注意

iTop的版本2.4.0与先前的2.x版本(2.3.4、2.3.3,...,2.2.1、2.2.0、2.1.0、2.0.3、2.0.2 ...)完全向后兼容。 ,但是此版本引入了许多重大更改。

本文档重点介绍了将iTop迁移到版本时可能发生的问题。

  • 要重点关注新功能,请检查2.4新增功能 
  • 有关更改的详尽列表,请检查变更日志 

升级前检查

封存

当您过时的数据开始代表比活动的数据多得多的功能时,新的能力已添加到iTop内核到改进搜索性能。

默认情况下,iTop上未启用它。它必须由模块激活。

更多关于封存

废弃

默认情况下,用户偏好已设置为不显示过时的数据

许多对象将从用户屏幕上消失,并且可能会使它们感到困惑。如果要最大程度地减少用户对此的疑问,可以通过在iTop中添加一行来将iTop设置为其他默认值。配置文件

'show_obsolete_data' => true,

该版本带来了一套默认废弃准则。如果您已自定义数据模型,则如果违反以下规则,则在安装过程中可能会中断:
配置项上的废弃准则不能依赖当前配置项的父类

例:因为我们希望服务器是DBServer或ClusterServer,所以将DatabaseSchema dbserver_id从DBServer ExternalKey更改为FunctionalCI ExternalKey会导致DatabaseSchema废弃计算中的无限循环。

更多关于废弃

重写DisplayBareRelations方法

如果DisplayBareRelations方法被覆盖以显示包含带有计数列表的选项卡,则如果用户不显示过时的数据,则计数将不正确。为了显示正确的计数,用于计数的DBObjectSet应该知道废弃显示屏上的用户选择。为此,请插入以下代码段:

CMDBObjectSet::SetShowObsoleteData(utils::ShowObsoleteData());

例如 :

$oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL));
//
// Add the obsolescence filter here
   $oSet->SetShowObsoleteData(utils::ShowObsoleteData());
// End of patch
//
$iCount = $oSet->();
if ($iCount > 0)
{
    $oPage->SetCurrentTab($sClassName." ($iCount)");
}
else
{
    $oPage->SetCurrentTab($sClassName); 
}     
self::DisplaySet($oPage, $oSet);

转换上的标志

iTop 2.4的标准数据模型使用新的能力进行定义过渡标志。对类UserRequest(和事件)进行了更改

  • 在从分配到分配状态的分派转换上,需要更改agent_id。
  • 在分配状态下,agent_id是只读的。

门户:表格转换

作为默认门户的一部分,重新​​打开的转换现在会提示用户在Caselog中提供信息。这是可选的,因为用户在重新打开之前可能已经在用户工单中提供了它。

新的备份格式

php的zip库限制为4Gb备份。
结果,如果您的iTop数据库备份文件超过4Gb,则将无法对数据进行复原,因为生成的备份文件不可读。因此,为了解决这个已知问题,我们决定切换到没有大小限制的tar.gz格式。这意味着您将必须在iTop备份上安装phar和zlib。

它似乎是Windows上的php软件包和Ubuntu 0.16.04上的php7的一部分。它可以是要添加的库,也可能需要新的php版本。

iTop仍然可以将现有的小于4Gb且使用zip格式的备份文件保留为恢复。但是defaut将使用tar.gz生成新的备份文件。

原有门户

原有门户现在已弃用,从iTop 2.7.0开始将被删除。

增强门户

用户描述砖

仅从PHP 5.5.16起可用,您可以隐藏表单的部分,例如偏好,密码和简档图片

新的搜索砖

扩展

一些提供新砖块或扩展本机砖块的扩展已合并到iTop中,现在已过时。在iTop 2.4及更高版本中使用它们可能会导致冲突。这里是有关的扩展:

  • itop-portal-create-brick-extended

  • itop-portal-filter-brick

客制化

DB 对象::获取默认值

DBObject上有一个新的动词。 GetDefaultValue($ sAttCode)是可重写的,并允许对象使用属性的默认价值到变更。 (它的用例之一可能是在创建新的对象时设置默认值)

DB 对象::Getset

DB 对象::现在,获取“链接集”类型的属性会返回ormLinkSet类的对象,而用于返回DBObjectSet类的对象。

DB 对象::Set接受类ormLinkSet(首选!)的对象或DBObjectSet(不推荐使用,但保留此属性是为了向后兼容)。

这是受支持的(尽管已弃用)模式:

$oCurrentSet = $oObject->Get('person_list');
$oNewSet = DBObjectSet::FromScratch('lnkSomeClassToPerson');
// Copy the current set
while ($oSomeLink = $oCurrentSet->Fetch())
{
        $oNewLink = MetaModel::NewObject('lnkSomeClassToPerson');
        $oNewLink->Set('name', $oSomeLink->Get('name'));
        $oNewLink->Set('firstname', $oSomeLink->Get('firstname'));
        $oNewSet->AddObject($oNewLink);
 
}
// Add an item
$oNewLink = MetaModel::NewObject('lnkSomeClassToPerson');
$oNewLink->Set('name', 'Doe');
$oNewLink->Set('firstname', 'John');
$oNewSet->AddObject($oNewLink);
$oObject->Set('person_list', $oNewSet);

这是推荐的(更简单,更有效的)模式:

$oCurrentSet = $oObject->Get('person_list');
$oNewLink = MetaModel::NewObject('lnkSomeClassToPerson');
$oNewLink->Set('name', 'Doe');
$oNewLink->Set('firstname', 'John');
$oCurrentSet->AddItem($oNewLink);
$oObject->Set('person_list', $oNewSet);

UILinksWigettUILinksWidgetDirect::Display

在iTop 2.4.x中,尚未根据新的ormLinkSet对象更新UILinksWidget :: Display和UILinksWidgetDirect :: Display方法,它仅接受DBObjectSet作为$ oValue参数。

这意味着您可以直接使用ormLinkSet对象(例如,从DBObject :: Get获得链接集属性,如前所述),您可以将其转换为原有DBObjectSet格式。为此,只需使用ormLinkSet :: ToDBObjectSet方法。

这是无效代码的示例:

// Prepare links widget
$oWidget = new UILinksWidget(...);
 
// Retrieve links
$oSet = $oObject->Get('person_list');
 
// Display widget
$oWidget->Display(..., $oSet, ...);

这是上面示例的更正:

// Prepare links widget
$oWidget = new UILinksWidget(...);
 
// Retrieve links
$oSet = $oObject->Get('person_list');
$oLegacySet = $oSet->ToDBObjectSet(utils::ShowObsoleteData());
 
// Display widget
$oWidget->Display(..., $oLegacySet, ...);

元模型::获取对象

可以在模块使用对象之前对其进行归档。由于存档等效于“软删除”,因此默认情况下,禁用归档模式时,MetaModel :: GetObject不会返回已存档的对象。如果启用它,则所有已归档的对象都是可见的,并且以前的行为没有对象。

当禁用归档模式时,这是$ mustBeFound参数值上依赖的不同行为:

对象型$ mustBeFound价值返回
未归档的对象真正对象
未归档的对象对象
存档的对象真正存档对象例外
存档的对象空值
不存在的对象真正核心异常
不存在的对象空值

在2.4之前,该方法已经抛出CoreException。当ArchivedObjectException扩展此对象时,您不必修改现有的catch语句。

如果即使已存档也需要获取对象,则应使用新方法MetaModel :: GetObjectWithArchive。

备份/还原

数据库回退:不推荐使用CreateZip(可以使用一段时间),而推荐使用DBBackup :: CreateCompressedBackup来生成tar.gz。

数据库:不推荐使用RestoreFromZip(可以保留一段时间),而推荐使用DBRestore :: RestoreFromCompressedFile(该文件自动检测格式以实现向后兼容性)。

细节:保留现有的价值

当字段A(模型)依赖于字段B(品牌)并且在A上有一个字段(SELECT Model WHERE brand=this→brand)时,在编辑过滤器时:

  • 如果A的现有价值与过滤器和B价值不一致,则不再删除它

此新行为是故意的。示例:如果父为已关闭,并且已关闭中不允许已关闭状况,则父工单丢失

  • 如果修改了字段B,则像以前一样重置A

生命周期

在门户的'被解决'工单上,呼叫人只能重新打开或关闭,默认情况下不能再修改

附件

配置文件中提供了新参数,以防止在已关闭工单上添加附件。

数据同步

从版本2.3.4开始,由dataSynchro创建的副本表对日期列使用VARCHAR(10)格式而不是DATE。

当MySQL安装程序不接受注册日期价值时,使用此变更可以使用同步_导入清空日期列。

在副本表中

  • NULL价值的含义是忽略此列,因此请不要更新目标对象。
  • 空字符串表示目标对象字段为空(强制价值重置),
  • 一个注册日期价值意味着重置日期价值,但这不适用于许多MySQL设置(因此我们切换到字符串格式)

原贴链接:https://www.itophub.io/wiki/page?id=2_7_0%3Ainstall%3A230_to_240_migration_notes


2.3.x to 2.4.0 Migration Notes

The version 2.4.0 of iTop is fully backward compatible with the previous 2.x versions (2.3.4, 2.3.3, …, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2…), however this version introduces quite a few significative changes.

This document highlights issues which can occur while migrating your iTop to this version.

To check before upgrading

Archiving

A new capability has been added to iTop core to improve search performance when your outdated data start to represent much more than the active ones.

It is not enabled by default on iTop. It has to be activated by a module.

More on Archiving

Obsolescence

By default user preference have been set to not show obsolete data

Many objects will disappear from user screen and it may confuse them. If you want to minimize users' question on this, you can set your iTop to have a different default by adding a line in the Configuration file

   'show_obsolete_data' => true,

This version brings a set of default obsolescence criteria. If you have customized your datamodel, that may break during setup, if the below rule is broken:
Obsolescence criteria on a CI cannot depends on a parent class of the current CI

Example: changing DatabaseSchema dbserver_id from a DBServer ExternalKey to a FunctionalCI ExternalKey, because we want the server to be either a DBServer or ClusterServer, leads to an infinite loop in the DatabaseSchema obsolescence computation.

More on obsolescence

Overriden DisplayBareRelations method

If the DisplayBareRelations method is overriden to display tabs containing lists with counts, the counts will not be correct if the user does not display the obsolete data. In order to display a correct count, the DBObjectSet used for the count should be aware of the user choice on obsolescence display. To do so insert the following code snippet:

CMDBObjectSet::SetShowObsoleteData(utils::ShowObsoleteData());

For example :

$oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL));
//
// Add the obsolescence filter here
   $oSet->SetShowObsoleteData(utils::ShowObsoleteData());
// End of patch
//
$iCount = $oSet->();
if ($iCount > 0)
{
    $oPage->SetCurrentTab($sClassName." ($iCount)");
}
else
{
    $oPage->SetCurrentTab($sClassName); 
}     
self::DisplaySet($oPage, $oSet);

Flags on transition

Standard Data Model of iTop 2.4 is using the new capability to define flags on transitions. Changes were made on class UserRequest (and Incident)

  • on a re-assign transition from assigned to assigned state, agent_id is required to be changed.

  • on an assigned state, the agent_id is read only.

portal: forms en transition

As part of the default Portal, the re-open transition now prompts the user to provide information in the Caselog. It's optional, as the user may have provided it already in the Ticket form before re-opening.

New Backup format

zip library for php is limited to 4Gb backup size.
As a result, if your iTop database backup file exceed 4Gb, you will never be able to restore your data as the generated backup file is unreadable. So to address this known issue, we have decided to switch to tar.gz format which has no size limitation. This means that you will have to install phar and zlib on your iTop server.

It seems to be part of php package on Windows and of php7 on Ubuntu 0.16.04. It can be a library to add or may require a new php version.

Your existing backup files smaller than 4Gb and using zip format, can still be restored by iTop. But new backup file will be generated with tar.gz by defaut.

Legacy portal

Legacy portal is now deprecated and will be removed as of iTop 2.7.0.

Enhanced portal

User Profile Brick

Available from PHP 5.5.16 ONLY, you can hide parts of the form such as preferences, password and profile picture

New Search Brick

Extensions

Some extensions providing new bricks or extending native bricks have been merged into iTop and are now obsolete. Using them in iTop 2.4 and above could result in a conflit. Here are the concerned extensions:

  • itop-portal-create-brick-extended

  • itop-portal-filter-brick

Customizations

DBObject::GetDefaultValue

A new verb on DBObject is available. GetDefaultValue($sAttCode) is overridable and allows to change the default value of an attribute for an object. (One of its use case could be to set default values when creating a new object)

DBObject::Get/Set

DBObject::Get on an attribute of type “link set” now returns an object of the class ormLinkSet whereas it used to return an object of class DBObjectSet.

DBObject::Set accepts either an object of class ormLinkSet (preferred!) or DBObjectSet (deprecated, but kept for backward compatibility).

Here is the supported (though deprecated) pattern:

$oCurrentSet = $oObject->Get('person_list');
$oNewSet = DBObjectSet::FromScratch('lnkSomeClassToPerson');
// Copy the current set
while ($oSomeLink = $oCurrentSet->Fetch())
{
        $oNewLink = MetaModel::NewObject('lnkSomeClassToPerson');
        $oNewLink->Set('name', $oSomeLink->Get('name'));
        $oNewLink->Set('firstname', $oSomeLink->Get('firstname'));
        $oNewSet->AddObject($oNewLink);
 
}
// Add an item
$oNewLink = MetaModel::NewObject('lnkSomeClassToPerson');
$oNewLink->Set('name', 'Doe');
$oNewLink->Set('firstname', 'John');
$oNewSet->AddObject($oNewLink);
$oObject->Set('person_list', $oNewSet);

Here is the recommended (simpler and more efficient) pattern:

$oCurrentSet = $oObject->Get('person_list');
$oNewLink = MetaModel::NewObject('lnkSomeClassToPerson');
$oNewLink->Set('name', 'Doe');
$oNewLink->Set('firstname', 'John');
$oCurrentSet->AddItem($oNewLink);
$oObject->Set('person_list', $oNewSet);

UILinksWidget/UILinksWidgetDirect::Display

In iTop 2.4.x, UILinksWidget::Display and UILinksWidgetDirect::Display methods have not been updated according to the new ormLinkSet object, it only accepts DBObjectSet as $oValue parameter.

This means that you can use a ormLinkSet object (eg. from a DBObject::Get on a link set attribute like said on the previous point) directly, you have a convert it to the legacy DBObjectSet format. To do so, just use the ormLinkSet::ToDBObjectSet method.

Here is an example of a non working code:

// Prepare links widget
$oWidget = new UILinksWidget(...);
 
// Retrieve links
$oSet = $oObject->Get('person_list');
 
// Display widget
$oWidget->Display(..., $oSet, ...);

Here is the correction for the example above:

// Prepare links widget
$oWidget = new UILinksWidget(...);
 
// Retrieve links
$oSet = $oObject->Get('person_list');
$oLegacySet = $oSet->ToDBObjectSet(utils::ShowObsoleteData());
 
// Display widget
$oWidget->Display(..., $oLegacySet, ...);

MetaModel::GetObject

An object can be archived before it is used by a module. As archiving is equivalent to a “soft deletion”, by default an archived object won't be returned by MetaModel::GetObject when archive mode is disabled. If it is enabled, then all archived objects are visible and there are no change to the previous behavior.

Here are the different behaviors depending on the $mustBeFound parameter values, when archive mode is disabled :

Object type$mustBeFound valuereturn
Non archived objecttrueobject
Non archived objectfalseobject
Archived objecttrueArchivedObjectException
Archived objectfalsenull
Non existing objecttrueCoreException
Non existing objectfalsenull

Before 2.4 the method was already throwing a CoreException. As ArchivedObjectException extends this object, then you don't have to modify your existing catch statements.

If you need to get the object even if it is archived, then you should use the new method MetaModel::GetObjectWithArchive.

Backup/Restore

DBBackup::CreateZip is deprecated (remains available for a while) in favor of DBBackup::CreateCompressedBackup which produces a tar.gz.

DBRestore::RestoreFromZip is deprecated (remains available for a while) in favor of DBRestore::RestoreFromCompressedFile (which autodetects the format for backward compatibility).

Details: keep existing value

When a field A (model) is dependent on a field B (brand) and there is a filter on A (SELECT Model WHERE brand=this→brand), when you edit the object:

  • if the existing value of A is not coherent with the filter and the B value, it is no more removed

This new behavior is on purpose. Exemple: Parent ticket was lost if the parent was closed and closed status is not allowed in the filter

  • if the field B is modified, A is reset as before

Lifecycle

On 'resolved' ticket on Portal the caller can only Re-open or Close, no more modify by default

Attachment

New parameters available in Configuration File, to prevent adding/removing attachment on closed ticket.

Data Synchro

Starting with version 2.3.4, the Replica Table created by a dataSynchro, use a VARCHAR(10) format instead of DATE for date columns.

This change was made to enable the possibility to empty a date column using synchro_import when MySQL setup does not accept 0000-00-00 date value.

In the Replica Table

  • a NULL value has the meaning Ignore this column so don't update the destination object.

  • an empty string means empty the destination object field (force a reset of a value),

  • a 0000-00-00 date value meant reset the date value, but this does not work with many MySQL setup (so we switch to string format)

标签:
由 superadmin 在 2020/08/27, 15:58 创建
    

需要帮助?

如果您需要有关XWiki的帮助,可以联系:

深圳市艾拓先锋企业管理咨询有限公司