News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Error in attachments, value 0 cannot be set

Started by cieplutki, January 27, 2023, 03:36:29 AM

Previous topic - Next topic

cieplutki

smf 2.1.3
i found a bug in the attachments, can't set value 0 for:
The maximum size of the folder with attachments
Maximum size of attachments per message
Maximum size of one attachment
how to fix it?
minimum value 1 not 0




.

Sir Osis of Liver

Not a bug, that was changed in 2.1 to require a value other than no limit.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Aleksi "Lex" Kilpinen

Quote from: Sir Osis of Liver on January 27, 2023, 11:43:17 AMNot a bug, that was changed in 2.1 to require a value other than no limit.

I don't think so. Or if it was, then there's still a bug - Just in the help text.
EDIT: To be more precise, the file sizes do need a limit - but the folder size does not. I read the question a bit hastily at first.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Yes, max attachment directory space accepts 0 for no limit.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

cieplutki

yes the error is in the help file. informs that the minimum value to 1




.

Sesquipedalian

Quote from: cieplutki on January 27, 2023, 03:36:29 AMMaximum size of attachments per message
Maximum size of one attachment

In SMF 2.0, setting these values to 0 meant "unlimited." This sometimes caused problems, because people would try to upload files that were larger than PHP would accept. SMF would not show any warning about this in advance or any explanation when the upload failed, which was frustrating for users.

To fix this problem, SMF 2.1 only allows values between 1 and whatever maximum value PHP allows. So instead of setting these to 0, set them to the largest number the input field will accept.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

I think there should be a max value for maximum number of files per directory for two reasons.  The first is I've seen /attachment directories containing 20-30,000 files, and you know forum owner never backs them up because it takes so long.  The other is that some ftp servers will not report more than 9998 files, regardless of how many more are in the directory.  Makes it very difficult to manage files. 
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sesquipedalian

Hm. I see your point about difficulties managing massive numbers of files in external tools.

But I am not sure that that it is appropriate for SMF to force specific practices for file management. Ultimately, it is up to the file system and the user to decide how to manage files, and up to FTP clients and servers to decide how to handle FTP operations.

SMF could decide to force the use of multiple directories and limits on the number of files in each. I would not be opposed if the SMF dev team decided to do that. But it is not a decision to be made without careful consideration and consultation with the community. It is entirely possible that removing the option to use a single, limitless directory for attachments would break things for a number of users.

Perhaps instead of removing the option for a single directory, it would be better to change SMF's default to use the multiple directory system. Then admins would have to intentionally choose the single directory method. Most admins would not do so unless they had a specific reason to.

But these are just musings from someone who is no longer on the development team, so place no stock in them. ;)
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

Quote from: Sesquipedalian on January 28, 2023, 06:11:32 PMSMF could decide to force the use of multiple directories and limits on the number of files in each.

That's really not a bad idea, if a new directory is automatically created when current one reaches specified limit.  I think that would be very beneficial for most forums.  I've seen this ftp file limit several times on different hosts.  In one case host support  tweaked the ftp server config, in another we were directed to use sftp.  I have tried loading /attachments directory containing over 25k files in cpanel file manager, it didn't go well.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Aleksi "Lex" Kilpinen

As long as it would remain an option to revert to the old default behaviour, I agree that could make some sense. Many shared hosts have some hidden limits regarding filehandling, and this could be a tool to help with that.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: