-
Notifications
You must be signed in to change notification settings - Fork 10
/
version_checker.lua
81 lines (69 loc) · 4.37 KB
/
version_checker.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local version = '1.0.8'
local versionurl = "https://raw.githubusercontent.com/utility-library/utility_lib/master/version"
PerformHttpRequest(versionurl, function(error, _version, header)
_version = _version:gsub("\n", "")
if version ~= _version then
print("^1——————————————————————| Attention |—————————————————————")
print(" ^0New version available [^1".._version.."^0]")
print(" ^5https://github.com/utility-library/utility_lib")
print("^1——————————————————————| Attention |—————————————————————^0")
else
print([[
^5,ggg, gg
^5dP""Y8a 88 I8 ,dPYb, I8
^5Yb, `88 88 I8 IP'`Yb I8
^5 `" 88 88 88888888 gg I8 8I gg 88888888
^5 88 88 I8 "" I8 8' "" I8
^5 88 88 I8 gg I8 dP gg I8 gg gg
^5 88 88 I8 88 I8dP 88 I8 I8 8I
^5 88 88 ,I8, 88 I8P 88 ,I8, I8, ,8I
^5 Y8b,____,d88, ,d88b, _,88,_,d8b,_ _,88,_ ,d88b, ,d8b, ,d8I
^5 "Y888888P"Y888P""Y888P""Y88P'"Y888P""Y888P""Y88P""Y88P"888
^5 ,d8I'
^0All is updated, have a good day!^5 ,dP'8I
^5 ———————————————————————————————————————————— ,8" 8I
^5 I8 8I
^5 `8, ,8I
^5 `Y8P" ^0]])
if Config.CleanDBOnServerStart.enabled then
function print_clean(msg)
if Config.CleanDBOnServerStart.log then
print(msg)
end
end
-- Clean DB
print_clean("[^2CLEANED^0] table user_inventory...")
MySQL.Async.execute('DELETE FROM user_inventory WHERE count=@count', {['@count'] = 0})
Citizen.Wait(200)
print_clean("[^2CLEANED^0] table addon_account_data...")
MySQL.Async.execute('DELETE FROM addon_account_data WHERE money=@money', {['@money'] = 0})
Citizen.Wait(200)
print_clean("[^2CLEANED^0] table trunk_inventory...")
MySQL.Async.execute('DELETE FROM trunk_inventory WHERE data=@data', {['@data'] = "{}"})
MySQL.Async.execute('DELETE FROM trunk_inventory WHERE data=@data', {['@data'] = '{"coffre":[]}'})
Citizen.Wait(200)
print_clean("[^2CLEANED^0] table datastore_data...")
MySQL.Async.execute('DELETE FROM datastore_data WHERE data=@data', {['@data'] = "{}"})
Citizen.Wait(200)
print_clean("[^2CLEANED^0] table user_accounts...")
MySQL.Async.execute('DELETE FROM user_accounts WHERE money=@money', {['@money'] = 0})
Citizen.Wait(200)
print_clean("[^2CLEANED^0] table phone_calls...\n")
MySQL.Async.execute('DELETE FROM phone_calls')
if Config.CleanDBOnServerStart.clean_users_table.enabled then
MySQL.Async.execute('DELETE FROM users WHERE money=@money AND bank=@bank AND job=@job', {
['@money'] = Config.CleanDBOnServerStart.clean_users_table.start_money,
['@bank'] = Config.CleanDBOnServerStart.clean_users_table.start_bank,
['@job'] = Config.CleanDBOnServerStart.clean_users_table.start_job
})
print_clean("[^2CLEANED^0] table users from inactive user...")
end
for i=1, #Config.CleanDBOnServerStart.table_to_optimize do
print_clean("[^2OPTIMIZED^0] table "..Config.CleanDBOnServerStart.table_to_optimize[i].."...")
MySQL.Async.execute('OPTIMIZE TABLE '..Config.CleanDBOnServerStart.table_to_optimize[i])
Citizen.Wait(200)
end
print("\n[^2OK^0] Daily cleaning finished!^0")
end
end
end)