This in filefield_upload_limit_filefield() looks wrong to me:

      foreach ($user->roles as $rid => $name) {
        $uploadsize = variable_get("upload_uploadsize_$rid", variable_get('upload_uploadsize_default', 1)) * 1024 * 1024;
      }

There's no max here. We're just clobbering the variable each time and so the value that gets used is simply the last role in the array. Can't be right surely?

Comments

greg.harvey’s picture

Category: bug » task
Priority: Critical » Normal

You're right, it isn't. The problem was knowing WHICH of the user's roles to pick, if they have many. I guess it makes sense to check all the roles and use the highest limit, but I was pushed for time and lazy, so I didn't do that (and then forgot all about it). Need to write the code that checks which role has the highest limit.

joachim’s picture

I don't know when I'll have time to look into this -- not till after conference, I'd say.
Should we make a release with the existing fixes and leave this until either of us has a spare few hours?

Plus I reckon we could do to refactor the code so filefield_upload_limit_get_field_upload_limit() is always used, in which case filefield_upload_limit_is_set() becomes a helper function for that alone.

greg.harvey’s picture

I agree, let's make a release now.

And starting another issue for the refactoring would seem sensible to me - here it is:
#555688: Refactor the code so filefield_upload_limit_get_field_upload_limit() is always used

greg.harvey’s picture

Status: Active » Closed (won't fix)

Closing this, as realistically this will never happen - D5 end of life imminent, no further support will be given unless someone else takes it over.