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


PHP LogModel::logChange方法代码示例

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


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

示例1: save


//.........这里部分代码省略.........
             $Fields = $this->Validation->schemaValidationFields();
             // Check for spam.
             $spam = SpamModel::isSpam('Discussion', $Fields);
             if ($spam) {
                 return SPAM;
             }
             // Get DiscussionID if one was sent
             $DiscussionID = intval(val('DiscussionID', $Fields, 0));
             // Remove the primary key from the fields for saving.
             unset($Fields['DiscussionID']);
             $StoredCategoryID = false;
             if ($DiscussionID > 0) {
                 // Updating
                 $Stored = $this->getID($DiscussionID, DATASET_TYPE_OBJECT);
                 // Block Format change if we're forcing the formatter.
                 if (c('Garden.ForceInputFormatter')) {
                     unset($Fields['Format']);
                 }
                 // Clear the cache if necessary.
                 $CacheKeys = array();
                 if (val('Announce', $Stored) != val('Announce', $Fields)) {
                     $CacheKeys[] = $this->getAnnouncementCacheKey();
                     $CacheKeys[] = $this->getAnnouncementCacheKey(val('CategoryID', $Stored));
                 }
                 if (val('CategoryID', $Stored) != val('CategoryID', $Fields)) {
                     $CacheKeys[] = $this->getAnnouncementCacheKey(val('CategoryID', $Fields));
                 }
                 foreach ($CacheKeys as $CacheKey) {
                     Gdn::cache()->remove($CacheKey);
                 }
                 self::serializeRow($Fields);
                 $this->SQL->put($this->Name, $Fields, array($this->PrimaryKey => $DiscussionID));
                 setValue('DiscussionID', $Fields, $DiscussionID);
                 LogModel::logChange('Edit', 'Discussion', (array) $Fields, $Stored);
                 if (val('CategoryID', $Stored) != val('CategoryID', $Fields)) {
                     $StoredCategoryID = val('CategoryID', $Stored);
                 }
             } else {
                 // Inserting.
                 if (!val('Format', $Fields) || c('Garden.ForceInputFormatter')) {
                     $Fields['Format'] = c('Garden.InputFormatter', '');
                 }
                 if (c('Vanilla.QueueNotifications')) {
                     $Fields['Notified'] = ActivityModel::SENT_PENDING;
                 }
                 // Check for approval
                 $ApprovalRequired = checkRestriction('Vanilla.Approval.Require');
                 if ($ApprovalRequired && !val('Verified', Gdn::session()->User)) {
                     LogModel::insert('Pending', 'Discussion', $Fields);
                     return UNAPPROVED;
                 }
                 // Create discussion
                 $this->serializeRow($Fields);
                 $DiscussionID = $this->SQL->insert($this->Name, $Fields);
                 $Fields['DiscussionID'] = $DiscussionID;
                 // Update the cache.
                 if ($DiscussionID && Gdn::cache()->activeEnabled()) {
                     $CategoryCache = array('LastDiscussionID' => $DiscussionID, 'LastCommentID' => null, 'LastTitle' => Gdn_Format::text($Fields['Name']), 'LastUserID' => $Fields['InsertUserID'], 'LastDateInserted' => $Fields['DateInserted'], 'LastUrl' => DiscussionUrl($Fields));
                     CategoryModel::setCache($Fields['CategoryID'], $CategoryCache);
                     // Clear the cache if necessary.
                     if (val('Announce', $Fields)) {
                         Gdn::cache()->remove($this->getAnnouncementCacheKey(val('CategoryID', $Fields)));
                         if (val('Announce', $Fields) == 1) {
                             Gdn::cache()->remove($this->getAnnouncementCacheKey());
                         }
                     }
开发者ID:RodSloan,项目名称:vanilla,代码行数:67,代码来源:class.discussionmodel.php


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