* change for ajax save log.

This commit is contained in:
wangyidong
2016-10-21 10:29:12 +08:00
parent 7d57150231
commit 5a95dcb1db
3 changed files with 65 additions and 6 deletions
+13 -4
View File
@@ -370,12 +370,14 @@ class gitModel extends model
public function iconvComment($comment)
{
/* Get encodings. */
$encoding = str_replace(' ', '', $this->config->git->encodings);
if($encoding == '') return $comment;
$encodings = str_replace(' ', '', isset($this->config->git->encodings) ? $this->config->git->encodings : '');
if($encodings == '') return $comment;
$encodings = explode(',', $encodings);
/* Try convert. */
if($encoding != 'utf-8')
foreach($encodings as $encoding)
{
if($encoding == 'utf-8') continue;
$result = @iconv($encoding, 'utf-8', $comment);
if($result) return $result;
}
@@ -556,7 +558,14 @@ class gitModel extends model
if($changes)
{
$historyID = $this->dao->findByAction($record->id)->from(TABLE_HISTORY)->fetch('id');
$this->dao->update(TABLE_HISTORY)->data($changes)->where('id')->eq($historyID)->exec();
if($historyID)
{
$this->dao->update(TABLE_HISTORY)->data($changes)->where('id')->eq($historyID)->exec();
}
else
{
$this->action->logHistory($record->id, array($changes));
}
}
}
else