From 11d0e9f52b1988ab71b173eebe6e1b106c349387 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 24 Oct 2012 14:04:57 +0000 Subject: [PATCH] Do not perform time consuming computations for building the menus if there are too many objects in a list (limit is configurable). SVN:1.2[2344] --- application/displayblock.class.inc.php | 5 ++++- core/config.class.inc.php | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index d89dc6817..4a89ab329 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -1179,7 +1179,10 @@ class MenuBlock extends DisplayBlock // Stimuli $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 $oSet->Rewind(); diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 2fa6f1cd7..25a32a6c3 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -471,6 +471,15 @@ class Config 'source_of_value' => '', '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, + ), ); public function IsProperty($sPropCode)