current situation:
When using phpBBs builtin-function for uploading attachments, all attachments are currently stored in one subfolder, defaulted to "files", under the phpBB root directory.
Having a big number of attachments, there are quite a few limitations for board owners to deal with the attachments:
- ftp server setting often allow only a certain number of files to operate with (very often defaulted to 2,000), without allowing the board owner to change this setting
- backing up the board is difficult, also because of the random files names assigned by phpBB, so there is no "natural order" of files and identification of uploaded files since last backup needs a sorting by file-time when no synchronising/backup tool other than ftp can be used
- modern file systems have no limitations on the number of files stored in one subfolder, but handling a huge number of files in one folder may have performance impacts on browsing, sorting etc.
based on the mod described at http://www.phpbbchina.com/forum/viewtop ... =23&t=3337, i would suggest to add the following features to attachment management:
- give board owners the ability to organise attachments in subfolders based on their requirements:
- do nothing (current behaviour)
- by attachment owner (user-id)
- by upload date (using php date() function)
- by attachment type (extention groups or file type)
- by attachment id (eg. defining a maximum number of files per folder)
- by file-name, eg. the first two characters of the generated "physical_file_name"
- automatic creation of subfolders when necessary using php-function mkdir()
Benefits:
- access to attachments is not limited by server settings
- backup of attachments or migration to a new server can be easier
- mkdir() has some restrictions when safe-mode enabled, but this is the same for other php-functions used in phpBB http://de.php.net/manual/en/features.sa ... ctions.php
as a fallback, mkdir() can use ftp-functions to create the subfolders instead of native OS functions: http://de.php.net/manual/en/function.mkdir.php#104752 or can completly be replaced by ftp functions: http://de.php.net/manual/en/function.mkdir.php#104301 - depending on host or host OS, the phpBB-scripts may not have the rights to create folders
Code: Select all
0
- 0
- 1
- 2
- 3
- ...
- D
- E
- F
1
- 0
- 1
- 2
- 3
- ...
- D
- E
- F
2
3
...
D
E
F
- 0
- 1
- 2
- 3
- ...
- D
- E
- F
Location in acp:
General -> Board configuration -> Attachment setting
the different options can be created as a dropdown, opening additional input fields via javascript (eg. for date based folders a input field for the date string) when necessary.
Database changes
the column "physical_filename" in table "attachments" is currently defined as varchar(255), the filename is generated as a 32-character hash value prepended by numerical userid and a dash, so for longer pathnames (more than 200 characters) it is too short. We can solve this in 2 ways:
- Change the field length
- con: altering field length may not work on all database systems
- Add an extra column ("path_name" as text)