diff --git a/core/displayablegraph.class.inc.php b/core/displayablegraph.class.inc.php index 94933a7f1..7ba48188c 100644 --- a/core/displayablegraph.class.inc.php +++ b/core/displayablegraph.class.inc.php @@ -702,10 +702,13 @@ class DisplayableGraph extends SimpleGraph { $oNewGraph = new DisplayableGraph(); $oNewGraph->bDirectionDown = $bDirectionDown; + $iPreviousTimeLimit = ini_get('max_execution_time'); + $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); $oNodesIter = new RelationTypeIterator($oGraph, 'Node'); foreach($oNodesIter as $oNode) { + set_time_limit($iLoopTimeLimit); switch(get_class($oNode)) { case 'RelationObjectNode': @@ -753,6 +756,7 @@ class DisplayableGraph extends SimpleGraph $oEdgesIter = new RelationTypeIterator($oGraph, 'Edge'); foreach($oEdgesIter as $oEdge) { + set_time_limit($iLoopTimeLimit); $oSourceNode = $oNewGraph->GetNode($oEdge->GetSourceNode()->GetId()); $oSinkNode = $oNewGraph->GetNode($oEdge->GetSinkNode()->GetId()); $oNewEdge = new DisplayableEdge($oNewGraph, $oEdge->GetId(), $oSourceNode, $oSinkNode); @@ -763,6 +767,7 @@ class DisplayableGraph extends SimpleGraph $aEdgeKeys = array(); foreach($oEdgesIter as $oEdge) { + set_time_limit($iLoopTimeLimit); $sSourceId = $oEdge->GetSourceNode()->GetId(); $sSinkId = $oEdge->GetSinkNode()->GetId(); if ($sSourceId == $sSinkId) @@ -788,6 +793,7 @@ class DisplayableGraph extends SimpleGraph $oNodesIter = new RelationTypeIterator($oNewGraph, 'Node'); foreach($oNodesIter as $oNode) { + set_time_limit($iLoopTimeLimit); if ($oNode->GetProperty('source')) { $oNode->GroupSimilarNeighbours($oNewGraph, $iGroupingThreshold, true, true); @@ -798,6 +804,7 @@ class DisplayableGraph extends SimpleGraph $iGroupIdx = 0; foreach($oIterator as $oNode) { + set_time_limit($iLoopTimeLimit); if ($oNode instanceof DisplayableGroupNode) { $aGroups[] = $oNode->GetObjects(); @@ -811,6 +818,7 @@ class DisplayableGraph extends SimpleGraph $aEdgeKeys = array(); foreach($oEdgesIter as $oEdge) { + set_time_limit($iLoopTimeLimit); $sSourceId = $oEdge->GetSourceNode()->GetId(); $sSinkId = $oEdge->GetSinkNode()->GetId(); if ($sSourceId == $sSinkId) @@ -832,7 +840,8 @@ class DisplayableGraph extends SimpleGraph } } } - + set_time_limit($iPreviousTimeLimit); + return $oNewGraph; } diff --git a/core/relationgraph.class.inc.php b/core/relationgraph.class.inc.php index b7dbddeca..e13d98867 100644 --- a/core/relationgraph.class.inc.php +++ b/core/relationgraph.class.inc.php @@ -385,6 +385,8 @@ class RelationGraph extends SimpleGraph $oObjectNode->SetProperty('developped', true); $oObject = $oObjectNode->GetProperty('object'); + $iPreviousTimeLimit = ini_get('max_execution_time'); + $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); foreach (MetaModel::EnumRelationQueries(get_class($oObject), $sRelCode, $bDown) as $sDummy => $aQueryInfo) { $sQuery = $bDown ? $aQueryInfo['sQueryDown'] : $aQueryInfo['sQueryUp']; @@ -403,6 +405,8 @@ class RelationGraph extends SimpleGraph { do { + set_time_limit($iLoopTimeLimit); + $sObjectRef = RelationObjectNode::MakeId($oRelatedObj); $oRelatedNode = $this->GetNode($sObjectRef); if (is_null($oRelatedNode)) @@ -426,11 +430,11 @@ class RelationGraph extends SimpleGraph } // Recurse $this->AddRelatedObjects($sRelCode, $bDown, $oRelatedNode, $iMaxDepth - 1, $bEnableRedundancy); - } while ($oRelatedObj = $oObjSet->Fetch()); } } + set_time_limit($iPreviousTimeLimit); } } } diff --git a/pages/UI.php b/pages/UI.php index 071a66381..f54480c97 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -220,11 +220,16 @@ function DisplayMultipleSelectionForm($oP, $oFilter, $sNextOperation, $oChecker, $oP->add_ready_script("$('#1 table.listResults').trigger('check_all');"); } -function DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj) +function DisplayNavigatorListTab($oP, $aResults, $sRelation, $sDirection, $oObj) { $oP->SetCurrentTab(Dict::S('UI:RelationshipList')); $oP->add("
| ".MetaModel::GetClassIcon($sListClass, true, 'width: 24px; height: 24px;')." ".Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', $oSet->Count(), Metamodel::GetName($sListClass))." |