mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°1420 - Performances enhancement
SVN:trunk[5833]
This commit is contained in:
@@ -638,6 +638,20 @@ abstract class MetaModel
|
||||
return reset($aAttributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of attributes composing the friendlyname
|
||||
*
|
||||
* @param $sClass
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
final static public function GetFriendlyNameAttributeCodeList($sClass)
|
||||
{
|
||||
$aNameSpec = self::GetNameSpec($sClass);
|
||||
$aAttributes = $aNameSpec[1];
|
||||
return $aAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
*
|
||||
@@ -5034,6 +5048,7 @@ abstract class MetaModel
|
||||
// Check that any defined field exists
|
||||
//
|
||||
$aTableInfo['Fields'][$sKeyField]['used'] = true;
|
||||
$aFriendlynameAttcodes = self::GetFriendlyNameAttributeCodeList($sClass);
|
||||
foreach(self::ListAttributeDefs($sClass) as $sAttCode => $oAttDef)
|
||||
{
|
||||
if (!$oAttDef->CopyOnAllTables())
|
||||
@@ -5050,6 +5065,14 @@ abstract class MetaModel
|
||||
$aTableInfo['Fields'][$sField]['used'] = true;
|
||||
|
||||
$bIndexNeeded = $oAttDef->RequiresIndex();
|
||||
if (!$bIndexNeeded)
|
||||
{
|
||||
// Add an index on the columns of the friendlyname
|
||||
if (in_array($sField, $aFriendlynameAttcodes))
|
||||
{
|
||||
$bIndexNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
$sFieldDefinition = "`$sField` $sDBFieldSpec";
|
||||
if (!CMDBSource::IsField($sTable, $sField))
|
||||
|
||||
Reference in New Issue
Block a user