gosora/database.go
Azareal 2557eb935b Added the GroupStore.
Renamed the *Store methods.
Added more functionality to some of the DataStores.
Added DataCache interfaces in addition to the DataStores to help curb their unrelenting growth and confusing APIs.
Fixed a crash bug in the ForumStore getters.
Fixed three tests.
Added more tests.
Temporary Group permissions should now be applied properly.
Improved the Tempra Conflux theme.
Moved the topic deletion logic into the TopicStore.
Tweaked the permission checks on the member routes to make them more sensible.
2017-09-15 23:20:01 +01:00

56 lines
962 B
Go

package main
import "log"
import "database/sql"
var db *sql.DB
var dbVersion string
var dbAdapter string
// ErrNoRows is an alias of sql.ErrNoRows, just in case we end up with non-database/sql datastores
var ErrNoRows = sql.ErrNoRows
func initDatabase() (err error) {
// Engine specific code
err = _initDatabase()
if err != nil {
return err
}
log.Print("Loading the usergroups.")
gstore = NewMemoryGroupStore()
err = gstore.LoadGroups()
if err != nil {
return err
}
log.Print("Loading the forums.")
fstore = NewMemoryForumStore()
err = fstore.LoadForums()
if err != nil {
return err
}
log.Print("Loading the forum permissions.")
err = buildForumPermissions()
if err != nil {
return err
}
log.Print("Loading the settings.")
err = LoadSettings()
if err != nil {
return err
}
log.Print("Loading the plugins.")
err = LoadPlugins()
if err != nil {
return err
}
log.Print("Loading the themes.")
return LoadThemes()
}