Преглед изворни кода

Do not perform time consuming computations for building the menus if there are too many objects in a list (limit is configurable).

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@2345 a333f486-631f-4898-b8df-5754b55c2be0
dflaven пре 12 година
родитељ
комит
0472aa6794
2 измењених фајлова са 13 додато и 1 уклоњено
  1. 4 1
      application/displayblock.class.inc.php
  2. 9 0
      core/config.class.inc.php

+ 4 - 1
application/displayblock.class.inc.php

@@ -1411,7 +1411,10 @@ class MenuBlock extends DisplayBlock
 
 
 				// Stimuli
 				// Stimuli
 				$aStates = MetaModel::EnumStates($sClass);
 				$aStates = MetaModel::EnumStates($sClass);
-				if (count($aStates) > 0)
+				// Do not perform time consuming computations if there are too may objects in the list
+				$iLimit = MetaModel::GetConfig()->Get('complex_actions_limit');
+				
+				if ((count($aStates) > 0) && (($iLimit == 0) || ($oSet->Count() < $iLimit)))
 				{
 				{
 					// Life cycle actions may be available... if all objects are in the same state
 					// Life cycle actions may be available... if all objects are in the same state
 					$oSet->Rewind();
 					$oSet->Rewind();

+ 9 - 0
core/config.class.inc.php

@@ -536,6 +536,15 @@ class Config
 			'source_of_value' => '',
 			'source_of_value' => '',
 			'show_in_conf_sample' => true,
 			'show_in_conf_sample' => true,
 		),
 		),
+		'complex_actions_limit' => array(
+			'type' => 'integer',
+			'description' => 'Display the "actions" menu items that require long computation only if the list of objects is contains less objects than this number (0 means no limit)',
+			// examples... not used
+			'default' => 50,
+			'value' => 50,
+			'source_of_value' => '',
+			'show_in_conf_sample' => false,
+		),
 		'synchro_prevent_delete_all' => array(
 		'synchro_prevent_delete_all' => array(
 			'type' => 'bool',
 			'type' => 'bool',
 			'description' => 'Stop the synchro if all the replicas of a data source become obsolete at the same time.',
 			'description' => 'Stop the synchro if all the replicas of a data source become obsolete at the same time.',