|
|
@@ -210,9 +210,12 @@ type Repository struct { |
|
|
|
Balance string `xorm:"NOT NULL DEFAULT '0'"` |
|
|
|
BlockChainStatus RepoBlockChainStatus `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
// git clone total count |
|
|
|
// git clone and git pull total count |
|
|
|
CloneCnt int64 `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
// only git clone total count |
|
|
|
GitCloneCnt int64 `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` |
|
|
|
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` |
|
|
|
|
|
|
@@ -2473,6 +2476,24 @@ func (repo *Repository) IncreaseCloneCnt() { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (repo *Repository) IncreaseGitCloneCnt() { |
|
|
|
sess := x.NewSession() |
|
|
|
defer sess.Close() |
|
|
|
|
|
|
|
if err := sess.Begin(); err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
if _, err := sess.Exec("UPDATE `repository` SET git_clone_cnt = git_clone_cnt + 1 WHERE id = ?", repo.ID); err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if err := sess.Commit(); err != nil { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func UpdateRepositoryCommitNum(repo *Repository) error { |
|
|
|
if _, err := x.Exec("UPDATE `repository` SET num_commit = ? where id = ?", repo.NumCommit, repo.ID); err != nil { |
|
|
|
return err |
|
|
|