Optimise BoardIndex queries

Separate moderator and moderator_group fetching into separate queries each. This allows proper usage of table indexes and normalised forms as well as results in speed improvements

Signed-off-by: Shitiz Garg <mail@dragooon.net>
Explicitly sort boards instead of relying on sorted database tables

Previously boards were sorted within the table and were not sorted on runtime when being fetched, this behaviour is broken in MySQL 5.6+ as well as PostgreSQL, SQLite. Adding a simple ORDER BY into the query is heavy and slows things down.

Instead cache the sorted order into a long term cache and use it to sort the fetched boards array, any board or category list that needs to be sorted has to be passed via sortCategories() or sortBoards() functions

Signed-off-by: Shitiz Garg <mail@dragooon.net>
Remove unrequited alter_table_boards definition for alternate DB systems

Signed-off-by: Shitiz Garg <mail@dragooon.net>
Remove child boards from the list of boards to fetch moderators

Signed-off-by: Shitiz Garg <mail@dragooon.net>
Typo (sortBoards vs sortboards)

Signed-off-by: Shitiz Garg <mail@dragooon.net>
Minor code cleanup

Signed-off-by: Shitiz Garg <mail@dragooon.net>
Merge pull request #1637 from Dragooon/boards-optimise

Optimise and improve board queries and sorting