What This IsThis is a replacement for ULib's UCL storage system. The current system saves and reads all stored users and their accesses from a single text file. This works fine, unless you have multiple servers or a LOT of information in that file.
What This DoesThis overrides the Save and Load functions in UCL. Instead of loading and saving your users to the users.txt file, it will instead load and save them from a database.
What This Doesn't DoThis only handles users. It doesn't store groups or group permissions. Those are still going to be stored in the groups.txt
This doesn't handle banning. There are plenty of MySQL banning modules out there.
What Is ModifiedYou will need to *replace* your ucl.lua file in addons\ULib\lua\ulib\server\ucl.lua
We typically NEVER recommend that you replace any of our stock files as this could cause issues or the changes will be reverted the next time you update ULib.. However, due to the nature of this kind of modification simply writing it into an addon wouldn't work because of the way modules are loaded. If you choose to install this, I HIGHLY recommend making a backup of your ULib addon first.
Inside the ucl.lua file I added some MySQL functions. I also modified the SaveFile function as well as completely commented out the LoadFromFile function. I also slightly modified addUser and removeUser functions.
How To Install1. Install the MySQLoo module. If you don't know where/how to get this I suggest Google.
2. Download the copy of ucl.lua from this post (YOU NEED TO BE LOGGED IN TO SEE IT)
3. Replace Addons\ULib\lua\server\ucl.lua with the one I provided.
4. Create a database in your MySQL called 'ulibsql' and set up a user to have permissions for it. (Don't create any tables inside of it, my code will handle that)
5. Edit the information at the top of the file to suit your MySQL database.
6. To be sure the table generated: run 'lua_run ULib_SQL_CreateTable()' from your server console.
7. From your server console or in game (if you are a superadmin) run ulib_loadlegacy to load your users from your users.txt and load them into your database.
WARNING/CAUTIONThis is ONLY for people who know how to use the MySQLOO module. I will not provide support for getting that installed or configured.
This is not for server owners who do not know enough about lua or modifying files to at least edit the SQL configuration at the top of the file.
If you update ULib this modification will be lost and you'll have to reinstall it.
This comes as-is and while I did to testing, there is no way for me to know if it'll work in every situation. Please make a backup of your ULib files before installing this.
Help/SupportI am not going to help you install MySQLOO.
If you have MySQLOO installed and configured properly and are having trouble with this modification, please feel free to post here and I will try and assist you the best I can.
Please let me know how this works for you.