2017-06-05 11:57:27 +00:00
/* WIP Under Construction */
package main
import "log"
2017-06-13 07:12:58 +00:00
import "./lib"
2017-06-05 11:57:27 +00:00
func main ( ) {
log . Println ( "Running the query generator" )
2017-06-13 07:12:58 +00:00
for _ , adapter := range qgen . DB_Registry {
log . Println ( "Building the queries for the " + adapter . GetName ( ) + " adapter" )
2017-07-12 11:05:18 +00:00
qgen . Install . SetAdapterInstance ( adapter )
2017-06-05 11:57:27 +00:00
write_statements ( adapter )
2017-07-12 11:05:18 +00:00
qgen . Install . Write ( )
2017-06-13 07:12:58 +00:00
adapter . Write ( )
2017-06-05 11:57:27 +00:00
}
}
2017-06-13 07:12:58 +00:00
func write_statements ( adapter qgen . DB_Adapter ) error {
2017-07-12 11:05:18 +00:00
err := create_tables ( adapter )
if err != nil {
return err
}
err = seed_tables ( adapter )
if err != nil {
return err
}
err = write_selects ( adapter )
2017-06-10 07:58:15 +00:00
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-12 09:03:14 +00:00
err = write_left_joins ( adapter )
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-12 09:03:14 +00:00
err = write_inner_joins ( adapter )
2017-06-10 07:58:15 +00:00
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-10 07:58:15 +00:00
err = write_inserts ( adapter )
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-10 07:58:15 +00:00
err = write_replaces ( adapter )
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-10 07:58:15 +00:00
err = write_updates ( adapter )
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-12 09:03:14 +00:00
err = write_deletes ( adapter )
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
2017-06-14 07:09:44 +00:00
err = write_simple_counts ( adapter )
if err != nil {
return err
}
2017-06-19 08:06:54 +00:00
err = write_insert_selects ( adapter )
if err != nil {
return err
}
err = write_insert_left_joins ( adapter )
if err != nil {
return err
}
err = write_insert_inner_joins ( adapter )
if err != nil {
return err
}
2017-06-10 07:58:15 +00:00
return nil
}
2017-07-12 11:05:18 +00:00
func create_tables ( adapter qgen . DB_Adapter ) error {
qgen . Install . CreateTable ( "users" , "utf8mb4" , "utf8mb4_general_ci" ,
[ ] qgen . DB_Table_Column {
qgen . DB_Table_Column { "uid" , "int" , 0 , false , true , "" } ,
qgen . DB_Table_Column { "name" , "varchar" , 100 , false , false , "" } ,
qgen . DB_Table_Column { "password" , "varchar" , 100 , false , false , "" } ,
qgen . DB_Table_Column { "salt" , "varchar" , 80 , false , false , "''" } ,
qgen . DB_Table_Column { "group" , "int" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "active" , "boolean" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "is_super_admin" , "boolean" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "createdAt" , "createdAt" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "lastActiveAt" , "datetime" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "session" , "varchar" , 200 , false , false , "''" } ,
qgen . DB_Table_Column { "last_ip" , "varchar" , 200 , false , false , "0.0.0.0.0" } ,
qgen . DB_Table_Column { "email" , "varchar" , 200 , false , false , "''" } ,
qgen . DB_Table_Column { "avatar" , "varchar" , 100 , false , false , "''" } ,
qgen . DB_Table_Column { "message" , "text" , 0 , false , false , "''" } ,
qgen . DB_Table_Column { "url_prefix" , "varchar" , 20 , false , false , "''" } ,
qgen . DB_Table_Column { "url_name" , "varchar" , 100 , false , false , "''" } ,
qgen . DB_Table_Column { "level" , "smallint" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "score" , "int" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "posts" , "int" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "bigposts" , "int" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "megaposts" , "int" , 0 , false , false , "0" } ,
qgen . DB_Table_Column { "topics" , "int" , 0 , false , false , "0" } ,
2017-07-17 10:23:42 +00:00
//qgen.DB_Table_Column{"penalty_count","int",0,false,false,"0"},
2017-07-12 11:05:18 +00:00
} ,
[ ] qgen . DB_Table_Key {
qgen . DB_Table_Key { "uid" , "primary" } ,
qgen . DB_Table_Key { "name" , "unique" } ,
} ,
)
2017-08-13 11:22:34 +00:00
// Coming Soon!
2017-07-17 10:23:42 +00:00
// What should we do about global penalties? Put them on the users table for speed? Or keep them here?
// Should we add IP Penalties?
2017-08-13 11:22:34 +00:00
/ * qgen . Install . CreateTable ( "users_penalties" , "" , "" ,
2017-07-17 10:23:42 +00:00
[ ] qgen . DB_Table_Column {
qgen . DB_Table_Column { "uid" , "int" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "element_id" , "int" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "element_type" , "varchar" , 50 , false , false , "" } , //global,forum,profile?,social_group
qgen . DB_Table_Column { "overrides" , "text" , 0 , false , false , "{}" } , // Perm overrides. Coming Soon
qgen . DB_Table_Column { "mod_queue" , "boolean" , 0 , false , false , "0" } , // All of this user's posts will go through the mod_queue. Coming Soon
// TO-DO: Add a mod-queue and other basic auto-mod features. This is needed for awaiting activation and the mod_queue penalty flag
// TO-DO: Add a penalty type where a user is stopped from creating plugin_socialgroups social groups
qgen . DB_Table_Column { "shadow_ban" , "boolean" , 0 , false , false , "0" } , // Coming Soon. CanShadowBan permission.
qgen . DB_Table_Column { "no_avatar" , "boolean" , 0 , false , false , "0" } , // Coming Soon. Should this be a perm override instead?
//qgen.DB_Table_Column{"posts_per_hour","int",0,false,false,"0"}, // Rate-limit penalty type. Coming soon
//qgen.DB_Table_Column{"topics_per_hour","int",0,false,false,"0"}, // Coming Soon
//qgen.DB_Table_Column{"posts_count","int",0,false,false,"0"}, // Coming soon
//qgen.DB_Table_Column{"topic_count","int",0,false,false,"0"}, // Coming Soon
//qgen.DB_Table_Column{"last_hour","int",0,false,false,"0"}, // UNIX Time, as we don't need to do anything too fancy here. When an hour has elapsed since that time, reset the hourly penalty counters.
qgen . DB_Table_Column { "issued_by" , "int" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "issued_at" , "createdAt" , 0 , false , false , "" } ,
qgen . DB_Table_Column { "expiry" , "duration" , 0 , false , false , "" } , // TO-DO: Implement the duration parsing code on the adapter side
} ,
[ ] qgen . DB_Table_Key { } ,
2017-08-13 11:22:34 +00:00
) * /
2017-07-17 10:23:42 +00:00
2017-07-12 11:05:18 +00:00
return nil
}
func seed_tables ( adapter qgen . DB_Adapter ) error {
return nil
}
2017-06-13 07:12:58 +00:00
func write_selects ( adapter qgen . DB_Adapter ) error {
2017-06-05 11:57:27 +00:00
// url_prefix and url_name will be removed from this query in a later commit
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user" , "users" , "name, group, is_super_admin, avatar, message, url_prefix, url_name, level" , "uid = ?" , "" , "" )
2017-06-05 11:57:27 +00:00
2017-06-13 08:56:48 +00:00
// Looking for get_topic? Your statement is in another castle
2017-06-05 11:57:27 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_reply" , "replies" , "tid, content, createdBy, createdAt, lastEdit, lastEditBy, ipaddress, likeCount" , "rid = ?" , "" , "" )
2017-06-14 07:09:44 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user_reply" , "users_replies" , "uid, content, createdBy, createdAt, lastEdit, lastEditBy, ipaddress" , "rid = ?" , "" , "" )
2017-06-06 08:47:33 +00:00
2017-06-25 09:56:39 +00:00
adapter . SimpleSelect ( "get_password" , "users" , "password,salt" , "uid = ?" , "" , "" )
2017-06-06 08:47:33 +00:00
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_settings" , "settings" , "name, content, type" , "" , "" , "" )
2017-06-05 11:57:27 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_setting" , "settings" , "content, type" , "name = ?" , "" , "" )
2017-06-06 08:47:33 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_full_setting" , "settings" , "name, type, constraints" , "name = ?" , "" , "" )
2017-06-06 08:47:33 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_full_settings" , "settings" , "name, content, type, constraints" , "" , "" , "" )
2017-06-14 07:09:44 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
adapter . SimpleSelect ( "get_groups" , "users_groups" , "gid, name, permissions, plugin_perms, is_mod, is_admin, is_banned, tag" , "" , "" , "" )
2017-06-14 07:09:44 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
adapter . SimpleSelect ( "get_forums" , "forums" , "fid, name, desc, active, preset, parentID, parentType, topicCount, lastTopic, lastTopicID, lastReplyer, lastReplyerID, lastTopicTime" , "" , "fid ASC" , "" )
2017-06-14 07:09:44 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_forums_permissions" , "forums_permissions" , "gid, fid, permissions" , "" , "gid ASC, fid ASC" , "" )
2017-06-14 07:09:44 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
adapter . SimpleSelect ( "get_plugins" , "plugins" , "uname, active, installed" , "" , "" , "" )
2017-06-14 07:09:44 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_themes" , "themes" , "uname, default" , "" , "" , "" )
2017-06-14 07:09:44 +00:00
2017-06-19 08:06:54 +00:00
adapter . SimpleSelect ( "get_widgets" , "widgets" , "position, side, type, active, location, data" , "" , "position ASC" , "" )
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "is_plugin_active" , "plugins" , "active" , "uname = ?" , "" , "" )
2017-06-06 08:47:33 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
//adapter.SimpleSelect("is_plugin_installed","plugins","installed","uname = ?","","")
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_users" , "users" , "uid, name, group, active, is_super_admin, avatar" , "" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "is_theme_default" , "themes" , "default" , "uname = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_modlogs" , "moderation_logs" , "action, elementID, elementType, ipaddress, actorID, doneAt" , "" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_reply_tid" , "replies" , "tid" , "rid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_topic_fid" , "topics" , "parentID" , "tid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user_reply_uid" , "users_replies" , "uid" , "rid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "has_liked_topic" , "likes" , "targetItem" , "sentBy = ? and targetItem = ? and targetType = 'topics'" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "has_liked_reply" , "likes" , "targetItem" , "sentBy = ? and targetItem = ? and targetType = 'replies'" , "" , "" )
2017-06-07 10:07:40 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user_name" , "users" , "name" , "uid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user_rank" , "users" , "group, is_super_admin" , "uid = ?" , "" , "" )
2017-06-12 09:03:14 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user_active" , "users" , "active" , "uid = ?" , "" , "" )
2017-06-12 09:03:14 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_user_group" , "users" , "group" , "uid = ?" , "" , "" )
2017-06-12 09:03:14 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_emails_by_user" , "emails" , "email, validated, token" , "uid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_topic_basic" , "topics" , "title, content" , "tid = ?" , "" , "" )
2017-06-12 09:03:14 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleSelect ( "get_activity_entry" , "activity_stream" , "actor, targetUser, event, elementType, elementID" , "asid = ?" , "" , "" )
2017-06-16 10:41:30 +00:00
adapter . SimpleSelect ( "forum_entry_exists" , "forums" , "fid" , "name = ''" , "fid ASC" , "0,1" )
2017-06-15 11:40:35 +00:00
2017-06-16 10:41:30 +00:00
adapter . SimpleSelect ( "group_entry_exists" , "users_groups" , "gid" , "name = ''" , "gid ASC" , "0,1" )
2017-06-12 09:03:14 +00:00
2017-08-06 15:22:18 +00:00
adapter . SimpleSelect ( "get_forum_topics_offset" , "topics" , "tid, title, content, createdBy, is_closed, sticky, createdAt, lastReplyAt, lastReplyBy, parentID, postCount, likeCount" , "parentID = ?" , "sticky DESC, lastReplyAt DESC, createdBy DESC" , "?,?" )
2017-06-10 07:58:15 +00:00
return nil
}
2017-06-13 07:12:58 +00:00
func write_left_joins ( adapter qgen . DB_Adapter ) error {
2017-06-15 11:40:35 +00:00
adapter . SimpleLeftJoin ( "get_topic_replies_offset" , "replies" , "users" , "replies.rid, replies.content, replies.createdBy, replies.createdAt, replies.lastEdit, replies.lastEditBy, users.avatar, users.name, users.group, users.url_prefix, users.url_name, users.level, replies.ipaddress, replies.likeCount, replies.actionType" , "replies.createdBy = users.uid" , "tid = ?" , "" , "?,?" )
adapter . SimpleLeftJoin ( "get_topic_list" , "topics" , "users" , "topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.parentID, users.name, users.avatar" , "topics.createdBy = users.uid" , "" , "topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy DESC" , "" )
2017-06-05 11:57:27 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleLeftJoin ( "get_topic_user" , "topics" , "users" , "topics.title, topics.content, topics.createdBy, topics.createdAt, topics.is_closed, topics.sticky, topics.parentID, topics.ipaddress, topics.postCount, topics.likeCount, users.name, users.avatar, users.group, users.url_prefix, users.url_name, users.level" , "topics.createdBy = users.uid" , "tid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleLeftJoin ( "get_topic_by_reply" , "replies" , "topics" , "topics.tid, topics.title, topics.content, topics.createdBy, topics.createdAt, topics.is_closed, topics.sticky, topics.parentID, topics.ipaddress, topics.postCount, topics.likeCount, topics.data" , "replies.tid = topics.tid" , "rid = ?" , "" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleLeftJoin ( "get_topic_replies" , "replies" , "users" , "replies.rid, replies.content, replies.createdBy, replies.createdAt, replies.lastEdit, replies.lastEditBy, users.avatar, users.name, users.group, users.url_prefix, users.url_name, users.level, replies.ipaddress" , "replies.createdBy = users.uid" , "tid = ?" , "" , "" )
2017-06-05 11:57:27 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleLeftJoin ( "get_forum_topics" , "topics" , "users" , "topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, users.name, users.avatar" , "topics.createdBy = users.uid" , "topics.parentID = ?" , "topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy desc" , "" )
2017-06-06 14:41:06 +00:00
2017-06-15 11:40:35 +00:00
adapter . SimpleLeftJoin ( "get_profile_replies" , "users_replies" , "users" , "users_replies.rid, users_replies.content, users_replies.createdBy, users_replies.createdAt, users_replies.lastEdit, users_replies.lastEditBy, users.avatar, users.name, users.group" , "users_replies.createdBy = users.uid" , "users_replies.uid = ?" , "" , "" )
2017-06-12 09:03:14 +00:00
return nil
}
2017-06-13 07:12:58 +00:00
func write_inner_joins ( adapter qgen . DB_Adapter ) error {
2017-06-15 11:40:35 +00:00
adapter . SimpleInnerJoin ( "get_watchers" , "activity_stream" , "activity_subscriptions" , "activity_subscriptions.user" , "activity_subscriptions.targetType = activity_stream.elementType AND activity_subscriptions.targetID = activity_stream.elementID AND activity_subscriptions.user != activity_stream.actor" , "asid = ?" , "" , "" )
2017-06-12 09:03:14 +00:00
2017-06-10 07:58:15 +00:00
return nil
}
2017-06-13 07:12:58 +00:00
func write_inserts ( adapter qgen . DB_Adapter ) error {
2017-08-06 15:22:18 +00:00
adapter . SimpleInsert ( "create_topic" , "topics" , "parentID,title,content,parsed_content,createdAt,lastReplyAt,lastReplyBy,ipaddress,words,createdBy" , "?,?,?,?,UTC_TIMESTAMP(),UTC_TIMESTAMP(),?,?,?,?" )
2017-06-05 11:57:27 +00:00
2017-07-17 10:23:42 +00:00
adapter . SimpleInsert ( "create_report" , "topics" , "title,content,parsed_content,createdAt,lastReplyAt,createdBy,data,parentID,css_class" , "?,?,?,UTC_TIMESTAMP(),UTC_TIMESTAMP(),?,?,1,'report'" )
2017-06-07 10:07:40 +00:00
2017-07-17 10:23:42 +00:00
adapter . SimpleInsert ( "create_reply" , "replies" , "tid,content,parsed_content,createdAt,ipaddress,words,createdBy" , "?,?,?,UTC_TIMESTAMP(),?,?,?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "create_action_reply" , "replies" , "tid,actionType,ipaddress,createdBy" , "?,?,?,?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "create_like" , "likes" , "weight, targetItem, targetType, sentBy" , "?,?,?,?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "add_activity" , "activity_stream" , "actor,targetUser,event,elementType,elementID" , "?,?,?,?,?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "notify_one" , "activity_stream_matches" , "watcher,asid" , "?,?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "add_email" , "emails" , "email, uid, validated, token" , "?,?,?,?" )
2017-06-12 09:03:14 +00:00
2017-07-17 10:23:42 +00:00
adapter . SimpleInsert ( "create_profile_reply" , "users_replies" , "uid, content, parsed_content, createdAt, createdBy, ipaddress" , "?,?,?,UTC_TIMESTAMP(),?,?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "add_subscription" , "activity_subscriptions" , "user,targetID,targetType,level" , "?,?,?,2" )
2017-06-12 09:03:14 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "create_forum" , "forums" , "name, desc, active, preset" , "?,?,?,?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "add_forum_perms_to_forum" , "forums_permissions" , "gid,fid,preset,permissions" , "?,?,?,?" )
2017-06-10 07:58:15 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
adapter . SimpleInsert ( "add_plugin" , "plugins" , "uname, active, installed" , "?,?,?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "add_theme" , "themes" , "uname,default" , "?,?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleInsert ( "create_group" , "users_groups" , "name, tag, is_admin, is_mod, is_banned, permissions" , "?,?,?,?,?,?" )
2017-06-10 07:58:15 +00:00
2017-07-17 10:23:42 +00:00
adapter . SimpleInsert ( "add_modlog_entry" , "moderation_logs" , "action, elementID, elementType, ipaddress, actorID, doneAt" , "?,?,?,?,?,UTC_TIMESTAMP()" )
2017-06-07 10:07:40 +00:00
2017-07-17 10:23:42 +00:00
adapter . SimpleInsert ( "add_adminlog_entry" , "administration_logs" , "action, elementID, elementType, ipaddress, actorID, doneAt" , "?,?,?,?,?,UTC_TIMESTAMP()" )
2017-06-10 07:58:15 +00:00
return nil
}
2017-06-13 07:12:58 +00:00
func write_replaces ( adapter qgen . DB_Adapter ) error {
adapter . SimpleReplace ( "add_forum_perms_to_group" , "forums_permissions" , "gid,fid,preset,permissions" , "?,?,?,?" )
2017-06-10 07:58:15 +00:00
return nil
}
2017-06-13 07:12:58 +00:00
func write_updates ( adapter qgen . DB_Adapter ) error {
2017-08-06 15:22:18 +00:00
adapter . SimpleUpdate ( "add_replies_to_topic" , "topics" , "postCount = postCount + ?, lastReplyBy = ?, lastReplyAt = UTC_TIMESTAMP()" , "tid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "remove_replies_from_topic" , "topics" , "postCount = postCount - ?" , "tid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "add_topics_to_forum" , "forums" , "topicCount = topicCount + ?" , "fid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "remove_topics_from_forum" , "forums" , "topicCount = topicCount - ?" , "fid = ?" )
2017-06-07 10:07:40 +00:00
2017-07-17 10:23:42 +00:00
adapter . SimpleUpdate ( "update_forum_cache" , "forums" , "lastTopic = ?, lastTopicID = ?, lastReplyer = ?, lastReplyerID = ?, lastTopicTime = UTC_TIMESTAMP()" , "fid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "add_likes_to_topic" , "topics" , "likeCount = likeCount + ?" , "tid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "add_likes_to_reply" , "replies" , "likeCount = likeCount + ?" , "rid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "edit_topic" , "topics" , "title = ?, content = ?, parsed_content = ?, is_closed = ?" , "tid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "edit_reply" , "replies" , "content = ?, parsed_content = ?" , "rid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "stick_topic" , "topics" , "sticky = 1" , "tid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "unstick_topic" , "topics" , "sticky = 0" , "tid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_last_ip" , "users" , "last_ip = ?" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_session" , "users" , "session = ?" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "set_password" , "users" , "password = ?, salt = ?" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "set_avatar" , "users" , "avatar = ?" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "set_username" , "users" , "name = ?" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "change_group" , "users" , "group = ?" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "activate_user" , "users" , "active = 1" , "uid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_user_level" , "users" , "level = ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "increment_user_score" , "users" , "score = score + ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "increment_user_posts" , "users" , "posts = posts + ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "increment_user_bigposts" , "users" , "posts = posts + ?, bigposts = bigposts + ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "increment_user_megaposts" , "users" , "posts = posts + ?, bigposts = bigposts + ?, megaposts = megaposts + ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "increment_user_topics" , "users" , "topics = topics + ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "edit_profile_reply" , "users_replies" , "content = ?, parsed_content = ?" , "rid = ?" )
2017-06-10 07:58:15 +00:00
//delete_forum_stmt, err = db.Prepare("delete from forums where fid = ?")
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "delete_forum" , "forums" , "name= '', active = 0" , "fid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_forum" , "forums" , "name = ?, desc = ?, active = ?, preset = ?" , "fid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_setting" , "settings" , "content = ?" , "name = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_plugin" , "plugins" , "active = ?" , "uname = ?" )
2017-06-10 07:58:15 +00:00
Added the Social Groups plugin. This is still under construction.
Made a few improvements to the ForumStore, including bringing it's API closer in line with the other datastores, adding stubs for future subforum functionality, and improving efficiency in a few places.
The auth interface now handles all the authentication stuff.
Renamed the debug config variable to debug_mode.
Added the PluginPerms API.
Internal Errors will now dump the stack trace in the console.
Added support for installable plugins.
Refactored the routing logic so that the router now handles the common PreRoute logic(exc. /static/)
Added the CreateTable method to the query generator. It might need some tweaking to better support other database systems.
Added the same CreateTable method to the query builder.
Began work on PostgreSQL support.
Added the string-string hook type
Added the pre_render hook type.
Added the ParentID and ParentType fields to forums.
Added the get_forum_url_prefix function.
Added a more generic build_slug function.
Added the get_topic_url_prefix function.
Added the override_perms and override_forum_perms functions for bulk setting and unsetting permissions.
Added more ExtData fields in a few structs and removed them on the Perms struct as the PluginPerms API supersedes them there.
Plugins can now see the router instance.
The plugin initialisation handlers can now throw errors.
Plugins are now initialised after all the forum's subsystems are.
Refactored the unit test logic. For instance, we now use the proper .Log method rather than fmt.Println in many cases.
Sorry, we'll have to break Github's generated file detection, as the build instructions aren't working, unless I put them at the top, and they're far, far more important than getting Github to recognise the generated code as generated code.
Fixed an issue with mysql.go's _init_database() overwriting the dbpassword variable. Not a huge issue, but it is a "gotcha" for those not expecting a ':' at the start.
Fixed an issue with forum creation where the forum permissions didn't get cached.
Fixed a bug in plugin_bbcode where negative numbers in rand would crash Gosora.
Made the outputs of plugin_markdown and plugin_bbcode more compliant with the tests.
Revamped the phrase system to make it easier for us to add language pack related features in the future.
Added the WidgetMenu widget type.
Revamped the theme again. I'm experimenting to see which approach I like most.
- Excuse the little W3C rage. Some things about CSS drive me crazy :p
Tests:
Added 22 bbcode_full_parse tests.
Added 19 bbcode_regex_parse tests.
Added 27 markdown_parse tests.
Added four UserStore tests. More to come when the test database functionality is added.
Added 18 name_to_slug tests.
Hooks:
Added the pre_render hook.
Added the pre_render_forum_list hook.
Added the pre_render_view_forum hook.
Added the pre_render_topic_list hook.
Added the pre_render_view_topic hook.
Added the pre_render_profile hook.
Added the pre_render_custom_page hook.
Added the pre_render_overview hook.
Added the pre_render_create_topic hook.
Added the pre_render_account_own_edit_critical hook.
Added the pre_render_account_own_edit_avatar hook.
Added the pre_render_account_own_edit_username hook.
Added the pre_render_account_own_edit_email hook.
Added the pre_render_login hook.
Added the pre_render_register hook.
Added the pre_render_ban hook.
Added the pre_render_panel_dashboard hook.
Added the pre_render_panel_forums hook.
Added the pre_render_panel_delete_forum hook.
Added the pre_render_panel_edit_forum hook.
Added the pre_render_panel_settings hook.
Added the pre_render_panel_setting hook.
Added the pre_render_panel_plugins hook.
Added the pre_render_panel_users hook.
Added the pre_render_panel_edit_user hook.
Added the pre_render_panel_groups hook.
Added the pre_render_panel_edit_group hook.
Added the pre_render_panel_edit_group_perms hook.
Added the pre_render_panel_themes hook.
Added the pre_render_panel_mod_log hook.
Added the pre_render_error hook.
Added the pre_render_security_error hook.
Added the create_group_preappend hook.
Added the intercept_build_widgets hook.
Added the simple_forum_check_pre_perms hook.
Added the forum_check_pre_perms hook.
2017-07-09 12:06:04 +00:00
adapter . SimpleUpdate ( "update_plugin_install" , "plugins" , "installed = ?" , "uname = ?" )
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_theme" , "themes" , "default = ?" , "uname = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_user" , "users" , "name = ?, email = ?, group = ?" , "uid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_group_perms" , "users_groups" , "permissions = ?" , "gid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_group_rank" , "users_groups" , "is_admin = ?, is_mod = ?, is_banned = ?" , "gid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleUpdate ( "update_group" , "users_groups" , "name = ?, tag = ?" , "gid = ?" )
2017-06-10 07:58:15 +00:00
2017-06-14 07:09:44 +00:00
adapter . SimpleUpdate ( "update_email" , "emails" , "email = ?, uid = ?, validated = ?, token = ?" , "email = ?" )
adapter . SimpleUpdate ( "verify_email" , "emails" , "validated = 1, token = ''" , "email = ?" ) // Need to fix this: Empty string isn't working, it gets set to 1 instead x.x
2017-06-05 11:57:27 +00:00
return nil
}
2017-06-13 07:12:58 +00:00
func write_deletes ( adapter qgen . DB_Adapter ) error {
adapter . SimpleDelete ( "delete_reply" , "replies" , "rid = ?" )
2017-06-07 10:07:40 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleDelete ( "delete_topic" , "topics" , "tid = ?" )
2017-06-12 09:03:14 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleDelete ( "delete_profile_reply" , "users_replies" , "rid = ?" )
2017-06-12 09:03:14 +00:00
2017-06-13 07:12:58 +00:00
adapter . SimpleDelete ( "delete_forum_perms_by_forum" , "forums_permissions" , "fid = ?" )
2017-06-12 09:03:14 +00:00
return nil
2017-06-14 07:09:44 +00:00
}
func write_simple_counts ( adapter qgen . DB_Adapter ) error {
2017-06-19 08:06:54 +00:00
adapter . SimpleCount ( "report_exists" , "topics" , "data = ? AND data != '' AND parentID = 1" , "" )
return nil
}
func write_insert_selects ( adapter qgen . DB_Adapter ) error {
adapter . SimpleInsertSelect ( "add_forum_perms_to_forum_admins" ,
qgen . DB_Insert { "forums_permissions" , "gid,fid,preset,permissions" , "" } ,
qgen . DB_Select { "users_groups" , "gid, ? AS fid, ? AS preset, ? AS permissions" , "is_admin = 1" , "" , "" } ,
)
2017-06-25 09:56:39 +00:00
adapter . SimpleInsertSelect ( "add_forum_perms_to_forum_staff" ,
qgen . DB_Insert { "forums_permissions" , "gid,fid,preset,permissions" , "" } ,
qgen . DB_Select { "users_groups" , "gid, ? AS fid, ? AS preset, ? AS permissions" , "is_admin = 0 AND is_mod = 1" , "" , "" } ,
)
adapter . SimpleInsertSelect ( "add_forum_perms_to_forum_members" ,
qgen . DB_Insert { "forums_permissions" , "gid,fid,preset,permissions" , "" } ,
qgen . DB_Select { "users_groups" , "gid, ? AS fid, ? AS preset, ? AS permissions" , "is_admin = 0 AND is_mod = 0 AND is_banned = 0" , "" , "" } ,
)
2017-06-19 08:06:54 +00:00
return nil
}
func write_insert_left_joins ( adapter qgen . DB_Adapter ) error {
return nil
}
func write_insert_inner_joins ( adapter qgen . DB_Adapter ) error {
adapter . SimpleInsertInnerJoin ( "notify_watchers" ,
qgen . DB_Insert { "activity_stream_matches" , "watcher, asid" , "" } ,
qgen . DB_Join { "activity_stream" , "activity_subscriptions" , "activity_subscriptions.user, activity_stream.asid" , "activity_subscriptions.targetType = activity_stream.elementType AND activity_subscriptions.targetID = activity_stream.elementID AND activity_subscriptions.user != activity_stream.actor" , "asid = ?" , "" , "" } ,
)
2017-06-14 07:09:44 +00:00
return nil
}