Is it possible to be certain that the %FileSize is retrieving the value it should be retrieving? Because I really do not understand why the percentage should turn negative. Your script makes complete sense to me.
Just a quick note on what I am doing - I have set the maximum quota to 10MB and tried to upload a 21.4MB file with your script (without my addition) in the OnQuotaExceeded under the HTTP events, Lua Script Enabled.
I get the Upload Error: Exceeded quota error as it should be, but the quota ends up with the quota bar at -102939.57% and the Quota: -10793996288 Bytes / 10MB
Any help is greatly appreciated.
Adding and deleting files that cause over quota
-
- Posts: 77
- Joined: Mon Nov 16, 2009 2:00 pm
-
- Site Admin
- Posts: 2107
- Joined: Tue Sep 29, 2009 6:09 am
Re: Adding and deleting files that cause over quota
I have modified that script, please copy/paste it again.
-
- Posts: 77
- Joined: Mon Nov 16, 2009 2:00 pm
Re: Adding and deleting files that cause over quota
It is much better - but for some reason, it is not consistent. I keep uploading the same file to check and sometimes it goes to 0%, now it went to -0.93%, another time -0.3%, another time -0.62%...
Strange - any reason for this?
Strange - any reason for this?
-
- Site Admin
- Posts: 2107
- Joined: Tue Sep 29, 2009 6:09 am
Re: Adding and deleting files that cause over quota
please change this line:
into
And small deviation is normal.
Code: Select all
tableUser.current_quota = tableUser.max_quota - filesize/1024
Code: Select all
tableUser.current_quota = tableUser.max_quota - filesize/1024
if tableUser.current_quota < 0 then
tableUser.current_quota = 0
end
-
- Posts: 77
- Joined: Mon Nov 16, 2009 2:00 pm
Re: Adding and deleting files that cause over quota
I have been testing this thoroughly and every now and again something seems to change the ftp users password.
Any idea why this could be so? Also could it be because I am testing on an unregistered copy?
Thanks again
Any idea why this could be so? Also could it be because I am testing on an unregistered copy?
Thanks again
-
- Posts: 77
- Joined: Mon Nov 16, 2009 2:00 pm
Re: Adding and deleting files that cause over quota
I have found that the password changes to the hashed version when it runs the AddUser line.
How can I fix this please? I can't seem to find I had done anything special when I used this AddUser function before.
Thanks
How can I fix this please? I can't seem to find I had done anything special when I used this AddUser function before.
Thanks
-
- Site Admin
- Posts: 2107
- Joined: Tue Sep 29, 2009 6:09 am
Re: Adding and deleting files that cause over quota
mellul wrote:I have been testing this thoroughly and every now and again something seems to change the ftp users password.
Any idea why this could be so? Also could it be because I am testing on an unregistered copy?
Thanks again
Please use the following Lua script:
Code: Select all
local tableUser = c_GetUser("%Domain","%Name")
for k,v in pairs(tableUser) do
if type(v) == "boolean" then
if v == true then
tableUser[k] = 1
else
tableUser[k] = 0
end
end
end
local filesize = tonumber("%FileSize")
tableUser.current_quota = tableUser.max_quota - filesize/1024
if tableUser.current_quota < 0 then
tableUser.current_quota = 0
end
tableUser.oldpassword = tableUser.password
AddUser("%Domain",tableUser)
c_RemoveFileDir("%PathName")