Adding and deleting files that cause over quota

Here you can submit your bug reports.

Re: Adding and deleting files that cause over quota

Postby mellul » Fri May 27, 2011 9:06 am

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.
mellul
 
posts 77
 
joined Mon Nov 16, 2009 2:00 pm

Re: Adding and deleting files that cause over quota

Postby FTP » Fri May 27, 2011 9:32 am

I have modified that script, please copy/paste it again.
FTP
Site Admin
 
posts 1236
 
joined Tue Sep 29, 2009 6:09 am

Re: Adding and deleting files that cause over quota

Postby mellul » Fri May 27, 2011 12:25 pm

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?
mellul
 
posts 77
 
joined Mon Nov 16, 2009 2:00 pm

Re: Adding and deleting files that cause over quota

Postby FTP » Fri May 27, 2011 1:15 pm

please change this line:

Code: Select all
tableUser.current_quota = tableUser.max_quota - filesize/1024


into

Code: Select all
tableUser.current_quota = tableUser.max_quota - filesize/1024
if tableUser.current_quota < 0 then
    tableUser.current_quota = 0
end


And small deviation is normal.
FTP
Site Admin
 
posts 1236
 
joined Tue Sep 29, 2009 6:09 am

Re: Adding and deleting files that cause over quota

Postby mellul » Mon May 30, 2011 12:49 pm

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
mellul
 
posts 77
 
joined Mon Nov 16, 2009 2:00 pm

Re: Adding and deleting files that cause over quota

Postby mellul » Mon May 30, 2011 1:04 pm

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
mellul
 
posts 77
 
joined Mon Nov 16, 2009 2:00 pm

Re: Adding and deleting files that cause over quota

Postby FTP » Mon May 30, 2011 1:47 pm

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")
FTP
Site Admin
 
posts 1236
 
joined Tue Sep 29, 2009 6:09 am

Previous

Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests