|
|
@@ -6,12 +6,14 @@ |
|
|
|
package models |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.gitea.io/gitea/modules/blockchain" |
|
|
|
"context" |
|
|
|
"crypto/md5" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"html/template" |
|
|
|
"sync" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/blockchain" |
|
|
|
|
|
|
|
// Needed for jpeg support |
|
|
|
_ "image/jpeg" |
|
|
@@ -208,6 +210,9 @@ type Repository struct { |
|
|
|
Balance int64 `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
BlockChainStatus RepoBlockChainStatus `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
// git clone total count |
|
|
|
CloneCnt int64 `xorm:"NOT NULL DEFAULT 0"` |
|
|
|
|
|
|
|
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` |
|
|
|
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` |
|
|
|
} |
|
|
@@ -2397,6 +2402,15 @@ func (repo *Repository) GetTreePathLock(treePath string) (*LFSLock, error) { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
|
|
|
|
var lck sync.Mutex |
|
|
|
|
|
|
|
func (repo *Repository) IncreaseCloneCnt() { |
|
|
|
lck.Lock() |
|
|
|
defer lck.Unlock() |
|
|
|
repo.CloneCnt++ |
|
|
|
_ = UpdateRepositoryCols(repo, "clone_cnt") |
|
|
|
} |
|
|
|
|
|
|
|
func updateRepositoryCols(e Engine, repo *Repository, cols ...string) error { |
|
|
|
_, err := e.ID(repo.ID).Cols(cols...).Update(repo) |
|
|
|
return err |
|
|
|