1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-22 22:59:43 +02:00

event handlers framework

This commit is contained in:
Harvey Kandola 2017-05-01 12:13:05 +01:00
parent 740c2ca189
commit bcabe494e3
15 changed files with 1091 additions and 5 deletions

View file

@ -301,3 +301,20 @@ func (p *Persister) ForgotUserPassword(email, token string) (err error) {
return
}
// CountActiveUsers returns the number of active users in the system.
func CountActiveUsers() (c int) {
row := Db.QueryRow("SELECT count(*) FROM user u WHERE u.refid IN (SELECT userid FROM account WHERE active=1)")
err := row.Scan(&c)
if err != nil && err != sql.ErrNoRows {
log.Error("CountActiveUsers", err)
return 0
}
if err == sql.ErrNoRows {
return 0
}
return
}