From: Philipp Schüle Date: Wed, 4 Feb 2015 16:56:49 +0000 (+0100) Subject: skips already deleted exdates during event update X-Git-Tag: 2015.07.5~1^2^2^2~45 X-Git-Url: http://git.tine20.org/?p=tine20;a=commitdiff_plain;h=cfc62edcb25651fd4ce4a6a667ea0148cbc122b9 skips already deleted exdates during event update * adds a new param skipMissing to Tinebase_Record_RecordSet::setByIndices() Change-Id: I6f986395011a91deb73e898ed62f213eedb12bf9 Reviewed-on: http://gerrit.tine20.com/customers/1609 Tested-by: Jenkins CI (http://ci.tine20.com/) Reviewed-by: Philipp Schüle --- diff --git a/tine20/Calendar/Controller/MSEventFacade.php b/tine20/Calendar/Controller/MSEventFacade.php index 2122da0..0b8e489 100644 --- a/tine20/Calendar/Controller/MSEventFacade.php +++ b/tine20/Calendar/Controller/MSEventFacade.php @@ -941,14 +941,7 @@ class Calendar_Controller_MSEventFacade implements Tinebase_Controller_Record_In // get ids for toUpdate $idxIdMap = $this->_filterEventsByDTStarts($_currentPersistentExceptions, $toUpdateDtSTart)->getId(); - try { - $migration['toUpdate']->setByIndices('id', $idxIdMap); - } catch (Tinebase_Exception_Record_NotDefined $ternd) { - // some debugging for 0008182: event with lots of exceptions breaks calendar sync - if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($idxIdMap, TRUE)); - if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($migration['toUpdate']->toArray(), TRUE)); - throw $ternd; - } + $migration['toUpdate']->setByIndices('id', $idxIdMap, /* $skipMissing = */ true); // filter exceptions marked as don't touch foreach ($migration['toUpdate'] as $toUpdate) { diff --git a/tine20/Tinebase/Record/RecordSet.php b/tine20/Tinebase/Record/RecordSet.php index b423d05..4e6d9c5 100644 --- a/tine20/Tinebase/Record/RecordSet.php +++ b/tine20/Tinebase/Record/RecordSet.php @@ -278,13 +278,20 @@ class Tinebase_Record_RecordSet implements IteratorAggregate, Countable, ArrayAc * * @param string $_name property name * @param array $_values index => property value + * @param boolean $skipMissing * @throws Tinebase_Exception_Record_NotDefined */ - public function setByIndices($_name, array $_values) + public function setByIndices($_name, array $_values, $skipMissing = false) { foreach ($_values as $index => $value) { if (! (isset($this->_listOfRecords[$index]) || array_key_exists($index, $this->_listOfRecords))) { - throw new Tinebase_Exception_Record_NotDefined('Could not find record with index ' . $index); + if ($skipMissing) { + if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ + . ' Skip missing record ' . $index . ' => ' . $value . ' property: ' . $_name); + continue; + } else { + throw new Tinebase_Exception_Record_NotDefined('Could not find record with index ' . $index); + } } $this->_listOfRecords[$index]->$_name = $value; }