Ejemplo n.º 1
0
	"io/ioutil"
	"strings"
	"time"

	"github.com/go-xorm/xorm"
	gouuid "github.com/satori/go.uuid"

	api "github.com/gogits/go-gogs-client"

	"github.com/go-gitea/gitea/modules/httplib"
	"github.com/go-gitea/gitea/modules/log"
	"github.com/go-gitea/gitea/modules/setting"
	"github.com/go-gitea/gitea/modules/sync"
)

var HookQueue = sync.NewUniqueQueue(setting.Webhook.QueueLength)

type HookContentType int

const (
	JSON HookContentType = iota + 1
	FORM
)

var hookContentTypes = map[string]HookContentType{
	"json": JSON,
	"form": FORM,
}

// ToHookContentType returns HookContentType by given name.
func ToHookContentType(name string) HookContentType {
Ejemplo n.º 2
0
import (
	"fmt"
	"strings"
	"time"

	"github.com/Unknwon/com"
	"github.com/go-xorm/xorm"
	"gopkg.in/ini.v1"

	"github.com/go-gitea/gitea/modules/log"
	"github.com/go-gitea/gitea/modules/process"
	"github.com/go-gitea/gitea/modules/setting"
	"github.com/go-gitea/gitea/modules/sync"
)

var MirrorQueue = sync.NewUniqueQueue(setting.Repository.MirrorQueueLength)

// Mirror represents mirror information of a repository.
type Mirror struct {
	ID          int64 `xorm:"pk autoincr"`
	RepoID      int64
	Repo        *Repository `xorm:"-"`
	Interval    int         // Hour.
	EnablePrune bool        `xorm:"NOT NULL DEFAULT true"`

	Updated        time.Time `xorm:"-"`
	UpdatedUnix    int64
	NextUpdate     time.Time `xorm:"-"`
	NextUpdateUnix int64

	address string `xorm:"-"`