Adding and deleting files that cause over quota

Here you can submit your bug reports.
mellul
Posts: 77
Joined: Mon Nov 16, 2009 2:00 pm

Re: Adding and deleting files that cause over quota

Post by mellul »

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.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Adding and deleting files that cause over quota

Post by FTP »

I have modified that script, please copy/paste it again.
mellul
Posts: 77
Joined: Mon Nov 16, 2009 2:00 pm

Re: Adding and deleting files that cause over quota

Post by mellul »

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?
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Adding and deleting files that cause over quota

Post by FTP »

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

Re: Adding and deleting files that cause over quota

Post by mellul »

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

Post by mellul »

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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Adding and deleting files that cause over quota

Post by FTP »

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")
Post Reply