3.2.4 2.4.x向2.5.x升级

iTop的版本2.5.0与先前的2.x版本(2.4.2、2.4.1、2.4.0、2.3.4、2.3.3,...,2.2.1、2.2.0、2.1 .0、2.0.3、2.0.2…),但是此版本引入了许多重大更改。

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

升级前检查

对于开发人员

2.5.3版开始,对于大多数操作,现在仅将对pagesajax.render.php端点的调用限制为后台办公室UI。请调整您将创建的任何门户扩展,并使用自己的终结点。

配置参数可用于禁用此保护,请在配置文件中添加以下内容:

'disable_attachments_download_legacy_portal' => false,

适用于设计师的Meta标签

对于确实在XML中包含标签<meta>的Combodo客户(如果有疑问,请询问Combodo),该标签已添加到标准数据模型中。结果,您的增量XML中的_delta =“ define”必须替换为_delta =“ must_exist”。 Combodo必须为您做到。

新的PHP和MySQL要求

适用于MySQL和PHP的需求已更改:

  • 最低PHP 5.6,推荐PHP 7.1(也支持PHP 7.2)
  • 最低MySQL 5.5.3(或MariaDB 5.5),推荐MySQL 5.7

迁移到MySQL 5.6及更高版本时,默认情况下现在存在STRICT_MODE,例如,防止将诸如0000-00-00的价值用作有效日期。为此,您将不得不批量修改数据。
下面是日期时间批量SQL更新的示例:

UPDATE IGNORE MyClass SET date_field = NULL 
WHERE MyClass.date_field = '0000-00-00 00:00:00' 

这些要求列在安装指南

如果:

  • 您已经在数据模型中定义了AttributeEncryptedString类型的属性(iTop标准中没有任何属性)
  • 您正在使用mcrypt
  • 您想将升级转换为PHP7.2,

然后请注意,升级之前,您必须:

  1. CSV或excel导出这些属性中包含的值(以明文形式)。
  2. 升级您的系统de PHP7.2(不支持mcrypt)
  3. 次使用CSV导入值(如果不使用mcrypt,则其编码将有所不同并且不那么强)

新的数据库字符集和排序规则

为了能够在BMP,iTop现在使用版本5.5.3中引入的utf8mb4 MySQL字符集。

在迁移流程中,iTop将:

  • 删除所有最大长度> 95个字符的varchar索引
  • 重新创建数据模型中定义的varchar索引,最大长度为95个字符。

这意味着:

  • 在迁移上,设置将花费额外的时间才能创建新索引
    • 在大型数据库上,这可能需要几分钟。
    • 建议您使用测试环境来了解持续时间。
  • 在大多数情况下,对于使用那些较短索引的查询,这应该以更大的性能结尾。
  • 如果您是手动创建额外的索引,则每次运行安装程序时它们可能会丢失
    • 解决方案显然是在数据模型中定义索引

如果您的数据库完全相同,则可以在迁移测试机器时重新使用记录的SQL查询并存储在loggsetup-queries-xxxxxxx.sql中,以在迁移到2.5之前独立迁移生产数据库。

更多技术细节:最古老的MySQL版本无法管理utf8mb4中varchar列上的索引:自动索引将大于允许的最大值(4 * 255 +2,大于支持的索引大小:767字节)。为防止这种情况,iTop现在将为varchar列上的索引强制设置最大长度。该最大长度为95个字符。

如果您直接在MySQL中创建索引,请注意升级会将其删除到2.5.0

REST Web服务

现在,只有具有简档REST服务用户的用户才能访问REST Web服务(具有管理员简档不足以访问REST Web服务,您还必须具有REST服务用户描述)。
确保您的脚本使用具有该简档的用户调用REST Web服务。

在没有REST服务用户描述的情况下,即使具有管理员简档的用户默认也无法访问REST Web服务

如果要保留以前的行为(即允许任何用户访问REST Web服务),请添加配置参数secure_rest_services并将其设置为false。

备份参数变更

如果将check_backup.php与参数check_ticket_itop一起使用,它将损坏!

由于安全的原因,不应再使用“ check_ticket_itop”参数。

  • 现在,此URL必须存储在模块参数的配置文件中的“ itop_root”键下。
  • 在iTop 2.5.2中,有一个参数itop_root,现在是itop_backup_incident
  • 调用check_backup.php.时,从cron中使用的“参数文件”中删除参数check_ticket_itop。
  • 并将先前位于check_ticket_itop中的价值放入配置文件itop_root参数
  • 警告:从2.6.0开始,参数itop_root被重命名为“ itop_backup_incident”。

数据模型变更

搜索默认条件

如果自定义数据模型并从头开始创建新类,则需要指定默认搜索标准。如果未在子类级别定义,则默认的搜索标准将从搜索类继承。

对于标准类,默认的搜索字段 已经定义。确保没有从您自己的数据模型中删除这些字段,否则,请在XML中重新定义表示的这一部分。

通过显示有用的标准,可以降低对新型搜索的变更的抵抗力,因此请在您自己的课堂上仔细进行设置。

现在,工单编号上的默认搜索正在检查精确匹配(相等且不再包含)。这变更改进大大性能在大型数据库(> 50K工单)上。但是,您可以通过删除此字段的XML中定义的索引来复原的先前行为。

工单上的索引编号

在工单编号上添加了定义为索引的数据模型,如果您已经在数据模型的自定义中添加了索引,请在升级之前将其删除,否则安装程序将失败并显示以下错误消息:

卸下工单上的废弃规则

由于性能问题,​​默认情况下,我们已删除工单类上的废弃规则。

如果需要,可以再次定义一个,但请记住,任何基于日期职能的规则都会使查询缓存机制无效并严重影响性能。

搜索&性能

默认情况下,每次搜索设置搜索搜索时,新的搜索自动运行搜索。如果某些类包含大量用户,则可能会出现问题,在这种情况下,可以使用配置参数禁用一个或多个类的默认行为:

Configuration
 
    'high_cardinality_classes' =>  (
      0 => 'Contact',
      1 => 'Person',
      2 => 'UserRequest',
    ),

您还可以改为使用以下方法一次对所有类强制这种行为:

Configuration
 
      'search_manual_submit' => true,
        ),

在此示例中,对于UserRequest,用户必须明确按搜索图标以使结果列表与设置的标准对齐。有一条警告消息提醒用户有关此不同的行为。

https://www.itophub.io/wiki/media?media=2_7_0%3Ainstall%3Asearchmanual.png

点击通话

在标准数据模型中将“人”类的“电话”和“移动电话”更改为使用新的AttributePhoneNumber,该属性可以使集成与IP电话应用程序(如Skype)顺利通信

检查3个新的参数配置到调优的所需行为。

参数类型可见吗?描述默认价值
phone_number_validation_pattern没有常规表达式以验证检测电话号码的格式[0-9.\-\ \+\(\)]+
phone_number_url_pattern没有电话号码网址的格式,将%1 $ s用作价值的占位符。例如。常规电话应用程序为“ tel:%1 $ s”,Skype为“ callto:%1 $ s”。默认值为“ tel:%1 $ s”tel:%1 $ s
phone_number_decoration_class没有用作属性的HTML渲染装饰的CSS类。例如。 “ fa fa-phone”将放电话图标fa fa-phone

如果您的用户的PC上没有IP电话,则可以将此价值设置为禁用链接(但这将关闭单击以呼叫每个用户)。

为确保电话号码格式无效,不会阻止Person对象的修改,请使用审计查找它们

将服务,联系人和文档添加到合同

表单预选 特性主要是为了解决合同类的特定问题而开发的。因此,我们修改了合同相关对象的搜索的默认行为:

  • 现在,服务来自提供者(而不再是客户)
  • 联系人和文档属于客户或提供者

门户的变化

  • 默认情况下,根据“进行中”和已关闭请求,门户用户现在可以在导出中以超越其用户请求的形式(仅限于他们在屏幕上看到的字段)使用导出。
  • 选项卡的显示方式对进行中的请求进行了稍微的更改。

工具包

iTop会检测从数据模型中删除但仍存在于数据库中的列。由于删除它们很危险,因此iTop仅更改其表定义以使这些列可为空。这仍然是正确的,但是,此外,iTop的工具包现在建议删除它们:

-推荐的功能:ALTER TABLE`Foo` DROP`Bar`“;

该特性由iTop核心带来,因此工具包2.3可用。

默认发件人发送邮件

当iTop发送未定义发件人的发送邮件时,它将假装该发件人为目标用户。这种机制的缺点是某些发送邮件服务器会将那些消息作为垃圾邮件丢弃。对于发送邮件,我们在配置文件中添加了2个新参数:

  • email_default_sender_address
  • email_default_sender_label

当同步发生故障时,iTop发送忘记的密码,测试通知或错误报告就是这种情况。

内联图像松动

默认情况下,如果带有附件和行内嵌入式图像的对象在1h内未保存,则附件和嵌入式图像将丢失。 1h延迟是硬编码的,从2.5.0开始是配置参数:

Configuration
 
'draft_attachments_lifetime' => 3600,

设置少一点是没有用的,因为删除那些临时文件的垃圾采集器流程是每小时运行的后台任务。

迁移之后

如果您已经创建了自己的类,请使用以下命令定义/presentation/defaut_search :默认搜索这些类的标准。

对于开发人员

改进性能

在2.5.0中,类DBOjectSet上有一个新方法CountExceeds($ iLimit),出于某种目的,它比计数()效率更高。

此方法应用于检查一组对象的计数是否高于参数$ iLimit。检查计数是否超出给定的限制,而不从数据库提取计数的整个列表。当计数的目的只是要知道我们将显示一个下拉列表还是自动完成的数据时,这很有用。

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


2.4.x to 2.5.0 Migration Notes

The version 2.5.0 of iTop is fully backward compatible with the previous 2.x versions (2.4.2, 2.4.1, 2.4.0, 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

For developers

From 2.5.3, calls to the /pages/ajax.render.php endpoint are now restricted to the backoffice UI for most of the operations. Please adjust any portal extension you would have created and use your own endpoint.

A configuration parameter is available to disable this protection, add the following to the configuration file:

'disable_attachments_download_legacy_portal' => false,

Meta tag for Designer

For Combodo customers which do have a tag <meta> in their XML (ask Combodo, if you have a doubt), that tag has been added to the Standard Datamodel. As a result, the _delta=“define” in your delta XML must be replaced by _delta=“must_exist”. Combodo must do it for you.

New PHP and MySQL requirements

Requirement for MySQL and PHP have changed:

  • Minimum PHP 5.6, recommended ​PHP 7.1 (PHP 7.2 is also supported)

  • Minimum MySQL 5.5.3 (or MariaDB 5.5), recommended MySQL 5.7

When migrating to MySQL 5.6 and above, there is now by default a STRICT_MODE which prevents for example value such as 0000-00-00 to be used as a valid date. You will have to bulk modify your data for this.
Here an example with a Date-time bulk SQL update:

  UPDATE IGNORE MyClass SET date_field = NULL 
  WHERE MyClass.date_field = '0000-00-00 00:00:00' 

Those requirements are listed in the Installation Guide

If:

  • you have defined in your datamodel attributes of type AttributeEncryptedString (There is none in iTop Standard)

  • and you are using mcrypt

  • and you want to upgrade to a PHP7.2,

Then be aware that before upgrading you must:

  1. CSV or excel export the values (in clear text) contained in those attributes.

  2. upgrade your system de PHP7.2 (which does not support mcrypt)

  3. CSV import again the values (without mcrypt their encoding will be different and not as strong)

New DB charset and collation

In order to be able to use characters outside of the BMP, iTop now uses the utf8mb4 MySQL charset that was introduced in version 5.5.3.

During the migration processus, iTop will:

  • drop all varchar indexes with a max length > 95 chars

  • re-create varchar indexes defined in the datamodel with a max length of 95 chars.

This mean that:

  • At migration, setup will take extra time in order to create the new indexes

    •  

    on huge databases, this could take several minutes.

    •  

    It is recommended that you use a testing environment in order to know the duration.

  • in most case this should end in greater performance for queries using those shorter indexes.

  • if you had created extra indexes “by hand” they may be lost each time you run the setup

    •  

    the solution is obviously to define your indexes in the datamodel

If your databases are strictly identical, you can reuse the SQL queries logged while migrating your test machine and stored in /log/setup-queries-xxxxxxx.sql, to migrate the production database independently before migrating to 2.5.

More technical details: Oldest MySQL version have trouble managing indexes on columns varchar in utf8mb4: automatic index would be greater than the maximum allowed (4*255 +2 which is greater than the support index size: 767 bytes). To prevent this, iTop will now force a max length for indexes on varchar columns. This max length is 95 chars.

If you have created indexes directly in MySQL, be aware that they will be deleted by the upgrade to 2.5.0

REST Web services

The access to the REST web services is now restricted to the users having the profile REST Services User (having the Administrator profile is not enough to access the REST Web services, you must have also the REST Services User profile).
Make sure that your scripts call REST web services with a user having that profile.

Even users with Administrator profile don't have access by default to REST webservices without REST Services User profile

If you want to keep the previous behavior (i.e. allow any user to access REST web services), then add the Configuration parameter secure_rest_services and set it to false.

Backup parameter change

If you use check_backup.php with this parameter check_ticket_itop, it will break!

For security reasons, the “check_ticket_itop” parameter should not be used anymore.

  • This URL must now be stored in the module parameters, in the config file, under the “itop_root” key.

  • In iTop 2.5.2 there was a param itop_root which is now itop_backup_incident

  • Remove the param check_ticket_itop from the “param file” used in your cron when calling check_backup.php.

  • and put the value previously located in check_ticket_itop, into the Configuration file itop_root parameter

  • Warning : the parameter itop_root is renamed “itop_backup_incident” starting from 2.6.0.

Datamodel changes

Search default criterion

If you have customize your datamodel and created new classes from scratch, then you will need to specify default search criterion. Those default searchcriterion are inherited from parent classes if not defined at the child class level.

For standard classes, default search fields have been defined. Ensure that those fields have not been removed from your own datamodel, otherwise redefined this part of the presentation in the XML.

Resistance to change on the New Search, can be reduced by displaying useful criterion, so set them carefully on your own classes.

The default search on Ticket ref is now checking an exact match (equal and no more contains). This change improve greatly performance on large database (> 50K Tickets). Nevertheless, you may restore the previous behavior by removing the index defined in XML on this field.

Index on Ticket ref

A datamodel defined index was added on Ticket ref, if you have already done so in a customization of your datamodel, remove it before upgrading, or Setup will fail with this error message:

Failed to issue SQL query: query = ALTER TABLE `ticket` ADD INDEX `ref` (`ref`), 
mysql_errno = 1061, mysql_error = Duplicate key name 'ref'

Remove obsolescence criteria on ticket

Because of performance issue we have removed the obsolescence criteria on Ticket class, by default.

You may define one again if you want but remember that any criteria based on a date function, invalidate the query caching mechanism and affect badly performance.

Search & performance

By default, the new search, automatically run the search each time a user set a search criteria. If you have some classes with large amount of data, this can be an issue, in that case you can disable the default behavior for one or multiples classes with a Configuration parameter:

Configuration
 
    'high_cardinality_classes' =>  (
      0 => 'Contact',
      1 => 'Person',
      2 => 'UserRequest',
    ),

You can also instead, force this behavior for all classes at once, using this:

Configuration
 
      'search_manual_submit' => true,
        ),

In this example, for UserRequest, users must explicitly press the search icon to get the resulting list aligned with the set criterion. There is a warning message to remind users about this different behavior.https://www.itophub.io/wiki/media?media=2_7_0%3Ainstall%3Asearchmanual.png

Click-to-call

The Phone and Mobile Phone of the class Person were changed in the standard Datamodel to use the new AttributePhoneNumber which allows smooth integration with IP phone applications, such as Skype

Check the 3 new Configuration parameters to fine-tune the desired behavior.

ParameterTypeVisible ?DescriptionDefault Value
phone_number_validation_patternstringNoRegular expression to validate/detect the format of a phone number[0-9.\-\ \+\(\)]+
phone_number_url_patternstringNoFormat for phone number url, use %1$s as a placeholder for the value. eg. “tel:%1$s” for regular phone applications or “callto:%1$s” for Skype. Default is “tel:%1$s”tel:%1$s
phone_number_decoration_classstringNoCSS class(es) to use as decoration for the HTML rendering of the attribute. eg. “fa fa-phone” will put a phone iconfa fa-phone

If your users have no IP phone on their PCs, you can set this value to disable the link (but this will turn off click to call for every user).

 'phone_number_url_pattern' => '#',

To guarantee that phone numbers with invalid format, will not prevent Person object modification, look for them with an audit

Adding Services, Contacts and Documents to a Contract

Form prefill feature was mainly developed to address the particular issue of the Contract class. Thanks to this we have modified the default behavior of the search of Contract related objects:

  • Services are now those from the Provider (and no more the Customer)

  • Contacts and Documents are those belonging to the Customer or the Provider

Portal changes

  • By default on Ongoing and Closed requests, portal users can now export in excel their User Requests limited to the fields which they can see on the screen.

  • The Ongoing requests has been slightly changed in the way the tabs are displayed.

Toolkit

iTop detect columns removed from the datamodel but still present in database. Since it is hazardous to drop them, iTop only changes their table definition to make those columns nullable. This is still true, but, in addition, iTop's Toolkit will now suggest to remove them :

-- Recommended action: ALTER TABLE `Foo` DROP `Bar`"; 

This feature is brought by iTop core and so is available with Toolkit 2.3.

Default sender email

When the iTop sends email with no defined sender, it will pretends that the sender is the destination user. The drawback of such mechanism is that some email servers will drop those messages as spam. To workaround this, we have added 2 new parameters in the Configuration file:

  • email_default_sender_address

  • email_default_sender_label

This is the case when iTop sends a forgotten password, a test notification or an error report when synchro is failing.

Loosing in-line images

By default, if an object with attachment and/or inline images, is not saved within 1h, then the attachments and in-line images will be lost. That 1h delay was hardcoded and from 2.5.0 it is a Configuration parameter:

Configuration
 
'draft_attachments_lifetime' => 3600,

It's useless to set less, as the garbage collector process which delete those temporary files is a Background task running hourly.

After migration

If you have created your own classes, define /presentation/defaut_search with the default search criterion on those classes.

For Developers

Improve performance

With 2.5.0 there is a new method CountExceeds($iLimit) on class DBOjectSet which for some purpose is much more efficient than Count().

This method shall be used to check if the count of a set of object is higher than a parameter $iLimit. Check if the count exceeds a given limit without fetching the whole list of data from database. This is useful when the purpose of counting is just to know if we will display a drop-down list or an auto-complete form.

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

需要帮助?

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

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