47963e10a9
Renamed the rrow_assign hook to topic_reply_row_assign and gave it access to more data. Fixed a bug where the topic store wouldn't fetch the last reply time for a topic. Refactored the process of adding and removing topics from and to a *Forum. Fixed a bug where editing the opening post of a topic would yield a vast number of <br>s instead of blank lines. Selecting text in Shadow now has it's own CSS instead of falling back onto the browser defaults. Fixed a bug in Shadow where not all the headers filled up the space they should. Fixed a bug in Shadow where the footer is broken on mobile. Added an ARIA Label to the topic list. Refactored the last poster logic to reduce the number of bugs. Renamed ReplyShort to Reply and Reply to ReplyUser. Added a Copy method to Reply, Group, Forum, User, and Topic. Rewrote Hello World into something slightly more useful for new plugin devs to learn off. Added the GetLength() method to ForumCache.
66 lines
1.3 KiB
Go
66 lines
1.3 KiB
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
|
|
}
|
|
|
|
// We have to put this here, otherwise LoadForums() won't be able to get the last poster data when building it's forums
|
|
log.Print("Initialising the user and topic stores")
|
|
if config.CacheTopicUser == CACHE_STATIC {
|
|
users = NewMemoryUserStore(config.UserCacheCapacity)
|
|
topics = NewMemoryTopicStore(config.TopicCacheCapacity)
|
|
} else {
|
|
users = NewSQLUserStore()
|
|
topics = NewSQLTopicStore()
|
|
}
|
|
|
|
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 = initExtend()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
log.Print("Loading the themes.")
|
|
return LoadThemes()
|
|
}
|