diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 665b3e6c4..eab185bac 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -1,5 +1,5 @@ UpdateObjectFromPostedForm(''); $bResult = (count($aErrors) == 0); @@ -3244,6 +3246,7 @@ EOF $oObj->DBUpdate(); } } + set_time_limit($iPreviousTimeLimit); $oP->Table($aHeaders, $aRows); if ($bPreview) { diff --git a/core/bulkchange.class.inc.php b/core/bulkchange.class.inc.php index 1fb9e8aae..6bb7ab651 100644 --- a/core/bulkchange.class.inc.php +++ b/core/bulkchange.class.inc.php @@ -1,5 +1,5 @@ m_aData as $iRow => $aRowData) { + set_time_limit(5); if (isset($aResult[$iRow]["__STATUS__"])) { // An issue at the earlier steps - skip the rest @@ -908,11 +910,13 @@ class BulkChange $iObj = $oObj->GetKey(); if (!in_array($iObj, $aVisited)) { + set_time_limit(5); $iRow++; $this->UpdateMissingObject($aResult, $iRow, $oObj, $oChange); } } } + set_time_limit($iPreviousTimeLimit); // Fill in the blanks - the result matrix is expected to be 100% complete // diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 8bdcc6521..3ce468ed5 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -1,5 +1,5 @@ ListDeletes() as $sClass => $aToDelete) { foreach ($aToDelete as $iId => $aData) @@ -1753,6 +1757,7 @@ abstract class DBObject // As a temporary fix: delete only the objects that are still to be deleted... if ($oToDelete->m_bIsInDB) { + set_time_limit(5); $oToDelete->DBDeleteSingleObject(); } } @@ -1766,10 +1771,13 @@ abstract class DBObject foreach ($aData['attributes'] as $sRemoteExtKey => $aRemoteAttDef) { $oToUpdate->Set($sRemoteExtKey, $aData['values'][$sRemoteExtKey]); + set_time_limit(5); $oToUpdate->DBUpdate(); } } } + + set_time_limit($iPreviousTimeLimit); } return $oDeletionPlan; @@ -2236,10 +2244,17 @@ abstract class DBObject $oDeletionPlan->SetDeletionIssues($this, $this->m_aDeleteIssues, $this->m_bSecurityIssue); $aDependentObjects = $this->GetReferencingObjects(true /* allow all data */); + + // Getting and setting time limit are not symetric: + // www.php.net/manual/fr/function.set-time-limit.php#72305 + $iPreviousTimeLimit = ini_get('max_execution_time'); + foreach ($aDependentObjects as $sRemoteClass => $aPotentialDeletes) { foreach ($aPotentialDeletes as $sRemoteExtKey => $aData) { + set_time_limit(5); + $oAttDef = $aData['attribute']; $iDeletePropagationOption = $oAttDef->GetDeletionPropagationOption(); $oDepSet = $aData['objects']; @@ -2269,6 +2284,7 @@ abstract class DBObject } } } + set_time_limit($iPreviousTimeLimit); } /** diff --git a/core/deletionplan.class.inc.php b/core/deletionplan.class.inc.php index 5cd079bbd..23024f082 100644 --- a/core/deletionplan.class.inc.php +++ b/core/deletionplan.class.inc.php @@ -1,5 +1,5 @@ m_aToUpdate as $sClass => $aToUpdate) { foreach($aToUpdate as $iId => $aData) { + set_time_limit(5); $this->m_iToUpdate++; $oObject = $aData['to_reset']; @@ -134,9 +139,9 @@ class DeletionPlan $this->m_bFoundSecurityIssue = true; } } - } } + set_time_limit($iPreviousTimeLimit); } public function GetIssues()