Closed annProg closed 5 years ago
检查以下项目
toolkit
到最新版2.6新功能
Attribute TagSet https://www.itophub.io/wiki/page?id=2_6_0%3Afeature%3Atag
ToArrayOfValues()
已经不能使用,Get link set返回ormLinkSet
,不在返回DBObjectSet
,但是ormLinkSet
提供了ToDBObjectSet
方法。或者use foreach($this as $oItem){} instead
。涉及大量修改,需测试:
新版本部分翻译缺失,需补全
不补翻译了,2.5.1翻译缺失似乎会自动调用英文翻译,不影响使用
整理patch
'show_obsolete_data' => true,
opcache
)问题的关键是 data/cache-production
目录
expressioncache.php
文件,那么无论apc缓存是否启用,都会有问题expressioncache.php
文件,会产生warning报错信息。能够正确显示friendlyname,如果启用了display error,restapi接口返回数据也会包含warning,导致不能正确工作core/expressioncache.class.inc.php
中
static private function GetSerializedExpression($sClass, $sAttCode)
{
$sKey = static::GetKey($sClass, $sAttCode);
$oExpr = DBObjectSearch::GetPolymorphicExpression($sClass, $sAttCode);
$oExpr = DBObjectSearch::GetPolymorphicExpression('Deployment', 'friendlyname');
print_r($oExpr);die();
return "'".$sKey."' => '".serialize($oExpr)."',\n";
}
发现只有英文翻译生效,中文翻译中定义的Name无效
DBObjectSearch::GetPolymorphicExpression
MetaModel:GetAttributeDef(($sSubClass, 'friendlyname)
返回AttributeFriendlyName对象
AttributeFriendlyName
的 GetOQLExpression
MetaModel::GetNameExpression
MetaModel::GetNameSpec
Dict::S
中GetUserLanguage
获取到的结果是错误的Dict::S
中添加如下代码
$trace = debug_backtrace();
print_r($trace);
print_r(self::GetUserLanguage() . "\n");
发现 expressioncache.class.inc.php
在Dologin之前就执行了,这时获取的语言是EN US
。Dologin之后才获取到当前语言是ZH CN
, 在pages/UI.php
中添加如下代码可以验证
require_once(APPROOT.'/application/loginwebpage.class.inc.php');
var_dump(Dict::GetUserLanguage());die();
$sLoginMessage = LoginWebPage::DoLogin(); // Check user rights and prompt if needed
var_dump(Dict::GetUserLanguage());die();
expressioncache.class.inc.php
的GetCacheFileName
方法,让不同语言生成不同的缓存文件metamodel.class.php
的Starup()
函数中的ExpressionCache::Warmup
注释掉,并在pages/UI.php
的DoLogin之后加上ExpressionCache::Warmup
,实现登录后在读取缓存出现英文正常,中文白屏问题。取消 expresscache.class.inc.php
中@include_once (static::GetCacheFileName());
前的@
符号,打印出报错信息:
Fatal error: Cannot declare class ExpressionCacheData, because the name is already in use in /home/wwwroot/default/cmdb/2.5.1/data/cache-production/expressioncache-ZH-CN.php on line 5
function GetCachedExpression(
函数里添加如下代码
if($sClass == "Deployment" && $sAttCode == "friendlyname") {
$trace = debug_backtrace();
print_r("###################################\n");
foreach($trace as $k => $v) {
print_r("In " . $v['file'] . " Line " . $v['line'] . "; Function " . $v['function'] . "; Class " . $v['class'] . "; Type " . $v['type'] . "\n");
}
print_r("###################################\n");
//var_dump($oExpr);
var_dump($className);
}
获取缓存只在RenderContent
函数调用时
###################################
--
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 2319; Function GetCachedExpression; Class ExpressionCache; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1869; Function GetPolymorphicExpression; Class DBObjectSearch; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1721; Function MakeSQLObjectQuery; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1687; Function BuildSQLQueryStruct; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbsearch.class.php Line 613; Function GetSQLQueryStructure; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbsearch.class.php Line 579; Function GetSQLQuery; Class DBSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectset.class.php Line 778; Function MakeSelectQuery; Class DBSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/application/displayblock.class.inc.php Line 617; Function CountWithLimit; Class DBObjectSet; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/application/displayblock.class.inc.php Line 232; Function GetRenderContent; Class DisplayBlock; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/application/displayblock.class.inc.php Line 213; Function GetDisplay; Class DisplayBlock; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/application/menunode.class.inc.php Line 905; Function Display; Class DisplayBlock; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/application/menunode.class.inc.php Line 871; Function RenderOQLSearch; Class OQLMenuNode; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/pages/UI.php Line 1749; Function RenderContent; Class OQLMenuNode; Type ->
| ###################################
| string(23) "ExpressionCacheDataZHCN"
sClass
换成Person
,发现DoLogin时就开始调用缓存
###################################
--
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 2319; Function GetCachedExpression; Class ExpressionCache; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1869; Function GetPolymorphicExpression; Class DBObjectSearch; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 2246; Function MakeSQLObjectQuery; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1958; Function MakeSQLObjectQuerySingleTable; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1721; Function MakeSQLObjectQuery; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectsearch.class.php Line 1687; Function BuildSQLQueryStruct; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbsearch.class.php Line 613; Function GetSQLQueryStructure; Class DBObjectSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbsearch.class.php Line 579; Function GetSQLQuery; Class DBSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectset.class.php Line 700; Function MakeSelectQuery; Class DBSearch; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectset.class.php Line 637; Function _makeSelectQuery; Class DBObjectSet; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/dbobjectset.class.php Line 817; Function Load; Class DBObjectSet; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/userrights.class.inc.php Line 1304; Function Fetch; Class DBObjectSet; Type ->
| In /home/wwwroot/default/cmdb/2.5.1/core/userrights.class.inc.php Line 1269; Function FindUser; Class UserRights; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/core/userrights.class.inc.php Line 634; Function FindUser; Class UserRights; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/application/loginwebpage.class.inc.php Line 487; Function Login; Class UserRights; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/application/loginwebpage.class.inc.php Line 742; Function Login; Class LoginWebPage; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/application/loginwebpage.class.inc.php Line 722; Function DoLoginEx; Class LoginWebPage; Type ::
| In /home/wwwroot/default/cmdb/2.5.1/pages/UI.php Line 359; Function DoLogin; Class LoginWebPage; Type ::
| ###################################
| string(23) "ExpressionCacheDataENUS"
if条件改为if($sAttCode == "friendlyname")
,可以看到在DoLogin执行完成之前,以下3个类用了EN US
string(38) "UserInternal - ExpressionCacheDataENUS"
string(32) "Person - ExpressionCacheDataENUS"
string(38) "Organization - ExpressionCacheDataENUS"
基本可以合并,工单问题可以留待以后解决。目前用处不大。
merged #85
最新版本用户体验有提高,特别是搜索方式,考虑升级到最新版本(2.5)。
目前的问题是插件有不兼容,部分函数变化。需要认真测试