当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Helper::normalizeLineBreaks方法代码示例

本文整理汇总了PHP中Tinebase_Helper::normalizeLineBreaks方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Helper::normalizeLineBreaks方法的具体用法?PHP Tinebase_Helper::normalizeLineBreaks怎么用?PHP Tinebase_Helper::normalizeLineBreaks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Helper的用法示例。


在下文中一共展示了Tinebase_Helper::normalizeLineBreaks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: manageConcurrentUpdatesByTimestamp

 /**
  * merges changes made to local storage on concurrent updates into the new record 
  * 
  * @param  Tinebase_Record_Interface $_newRecord record from user data
  * @param  Tinebase_Record_Interface $_curRecord record from storage
  * @param  string $_model
  * @param  string $_backend
  * @param  string $_id
  * @return Tinebase_Record_RecordSet with resolved concurrent updates (Tinebase_Model_ModificationLog records)
  * @throws Tinebase_Timemachine_Exception_ConcurrencyConflict
  * 
  * @deprecated this should be removed when all records have seq(uence)
  */
 public function manageConcurrentUpdatesByTimestamp(Tinebase_Record_Interface $_newRecord, Tinebase_Record_Interface $_curRecord, $_model, $_backend, $_id)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Calling deprecated method. Model ' . $_model . ' should get a seq property.');
     }
     list($appName, $i, $modelName) = explode('_', $_model);
     $resolved = new Tinebase_Record_RecordSet('Tinebase_Model_ModificationLog');
     // handle concurrent updates on unmodified records
     if (!$_newRecord->last_modified_time instanceof DateTime) {
         if ($_curRecord->creation_time instanceof DateTime) {
             $_newRecord->last_modified_time = clone $_curRecord->creation_time;
         } else {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Something went wrong! No creation_time was set in current record: ' . print_r($_curRecord->toArray(), TRUE));
             return $resolved;
         }
     }
     if ($_curRecord->last_modified_time instanceof DateTime && !$_curRecord->last_modified_time->equals($_newRecord->last_modified_time)) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " concurrent updates: current record last updated '" . $_curRecord->last_modified_time . "' where record to be updated was last updated '" . $_newRecord->last_modified_time . "'");
         }
         $loggedMods = $this->getModifications($appName, $_id, $_model, $_backend, $_newRecord->last_modified_time, $_curRecord->last_modified_time);
         // effective modifications made to the record after current user got his record
         $diffs = $this->computeDiff($loggedMods);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " during the concurrent update, the following changes have been made: " . print_r($diffs->toArray(), true));
         }
         // we loop over the diffs! -> changes over fields which have no diff in storage are not in the loop!
         foreach ($diffs as $diff) {
             $newUserValue = isset($_newRecord[$diff->modified_attribute]) ? Tinebase_Helper::normalizeLineBreaks($_newRecord[$diff->modified_attribute]) : NULL;
             if (isset($_newRecord[$diff->modified_attribute]) && $newUserValue == Tinebase_Helper::normalizeLineBreaks($diff->new_value)) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " User updated to same value for field '" . $diff->modified_attribute . "', nothing to do.");
                 }
                 $resolved->addRecord($diff);
             } elseif (!isset($_newRecord[$diff->modified_attribute]) || $newUserValue == Tinebase_Helper::normalizeLineBreaks($diff->old_value)) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Merge current value into update data, as it was not changed in update request.");
                 }
                 $_newRecord[$diff->modified_attribute] = $diff->new_value;
                 $resolved->addRecord($diff);
             } else {
                 Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . " Non resolvable conflict for field '" . $diff->modified_attribute . "'!");
                 throw new Tinebase_Timemachine_Exception_ConcurrencyConflict('concurrency conflict!');
             }
         }
     }
     return $resolved;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:61,代码来源:ModificationLog.php


注:本文中的Tinebase_Helper::normalizeLineBreaks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。