When the parameter user_limit is 0, we dont need to call file_space_used.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drewish’s picture

Version: 6.x-dev » 7.x-dev
lilou’s picture

FileSize
1.23 KB

Reroll.

drewish’s picture

Status: Needs review » Reviewed & tested by the community

a small change to help avoid an extra query.

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
1.31 KB

Looks like you're missing a closing brace on that if statement. Also please use cvs diff -uP so we can get the relevant function name in the diff. Here's a revised patch that also fixes the PHP doc for $user_limit.

c960657’s picture

Status: Needs work » Needs review
FileSize
1.89 KB

Reroll. file_validate_size() is already covered by unit tests.

Status: Needs review » Needs work

Patch failed to apply. More information can be found at http://testing.drupal.org/node/14498. If you need help with creating patches please look at http://drupal.org/patch/create

drewish’s picture

Status: Needs work » Needs review
drewish’s picture

Status: Needs review » Reviewed & tested by the community

just re-ran the tests, they're still good. simple enough patch too.

webchick’s picture

Version: 7.x-dev » 6.x-dev

Thanks, committed! Looks like this could go in 6.x too.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Looks like a good improvement. However (1) it does not apply to Drupal 6 (2) I'd add a comment to the if() which would explain that the function call is in there to help performance a bit. Otherwise someone might go and "prettify" if later on.

$ patch -p0 < 197266-2.patch.txt 
patching file includes/file.inc
Hunk #1 FAILED at 728.
Hunk #2 succeeded at 652 (offset -94 lines).
1 out of 2 hunks FAILED -- saving rejects to file includes/file.inc.rej
drewish’s picture

Status: Needs work » Needs review
FileSize
2.01 KB

how's this look?

c960657’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Gábor Hojtsy’s picture

Version: 6.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Quick fix

Committed to Drupal 6. Let's get that added comment to Drupal 7 too.

drewish’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.03 KB

here's that comment for D7

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD.

ufku’s picture

According to the comment
"when a limit is provided we save a query by only calling file_space_used()"

Should't we
"save a query by not calling file_space_used when there is no user limit."

I mean the current comment is incoherent.
Or is it time to go to bed for me?

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.