本文整理汇总了PHP中Tinebase_Backend_Sql_Abstract::checkETag方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Backend_Sql_Abstract::checkETag方法的具体用法?PHP Tinebase_Backend_Sql_Abstract::checkETag怎么用?PHP Tinebase_Backend_Sql_Abstract::checkETag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Backend_Sql_Abstract
的用法示例。
在下文中一共展示了Tinebase_Backend_Sql_Abstract::checkETag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCalendar
/**
* update calendar
*
* @param string $calUri
* @param array $calICSs
*/
protected function updateCalendar($calUri, $calICSs)
{
$updateResult = array('ics' => array(), 'toupdate' => 0, 'toadd' => 0, 'todelete' => array());
$serverEtags = $this->_fetchServerEtags($calUri, $calICSs);
// get current tine20 id/etags of records
$defaultCalendarsName = $this->_getDefaultCalendarsName();
$container = $this->findContainerForCalendar($calUri, $this->calendars[$calUri]['displayname'], $defaultCalendarsName);
$containerEtags = $this->_recordBackend->getEtagsForContainerId($container->getId());
$otherComponentIds = $this->_getOtherComponentIds($container);
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . ' Got ' . count($serverEtags) . ' server etags for container ' . $container->name);
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' server etags: ' . print_r($serverEtags, true));
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' tine20 etags: ' . print_r($containerEtags, true));
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' other comp ids: ' . print_r($otherComponentIds, true));
}
// handle add/updates
$existingIds = array();
foreach ($serverEtags as $ics => $data) {
if (in_array($data['id'], $otherComponentIds)) {
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' record already added to other app (VEVENT/VTODO): ' . $data['id']);
}
continue;
}
if (isset($containerEtags[$data['id']])) {
$tine20Etag = $containerEtags[$data['id']]['etag'];
// remove from $containerEtags list to be able to tell deletes
unset($containerEtags[$data['id']]);
$existingIds[] = $data['id'];
if ($tine20Etag == $data['etag']) {
continue;
// same
} else {
if (empty($tine20Etag)) {
// event has been added in tine -> don't overwrite/delete
continue;
}
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' Record needs update: ' . $data['id']);
}
} else {
try {
if (!$this->_allowDuplicateEvents) {
$this->_recordBackend->checkETag($data['id'], $data['etag']);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' Ignoring event from another container/organizer: ' . $data['id']);
}
continue;
}
} catch (Tinebase_Exception_NotFound $tenf) {
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' Found new record: ' . $data['id']);
}
}
}
if (!isset($this->existingRecordIds[$calUri])) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . ' Found changed event(s) for container ' . $container->name);
}
$this->existingRecordIds[$calUri] = array();
}
$updateResult['ics'][] = $ics;
if (in_array($data['id'], $existingIds)) {
$this->existingRecordIds[$calUri][] = $data['id'];
$updateResult['toupdate']++;
} else {
$updateResult['toadd']++;
}
}
// handle deletes/exdates
foreach ($containerEtags as $id => $data) {
if (in_array($data['uid'], $existingIds)) {
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . ' Record ' . $id . ' is exdate of ' . $data['uid']);
}
continue;
}
if (!empty($data['etag'])) {
// record has been deleted on server
$updateResult['todelete'][] = $id;
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . ' Record has been added in tine: ' . $id);
}
}
}
return $updateResult;
//.........这里部分代码省略.........