[RC] Attachments in subfolders

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
Locked
I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Wed Aug 10, 2011 11:52 pm

digioz wrote:... you wouldn't have to rely on any counting to determine when a new folder needs to be created
This is not exactly the true... on "_attachments" table you have the "filetime" field that is an integer, so you have to calculate the year, the month and the day and check if each folder/subfolder exists... so is more or less the same thing (probably it could be a bit more complicated).

Anyway the "YYYY/MM/DD/{hashed_file_name}" could be a good method... but I still prefer use the ID, because you have less folders...For example, if you have only one new attachment per day, but you have a new attachment each day, at the end of the year with your method you have 1 first level folder, 12 second level subfolders, 365 third level subfolders and 365 files... with my method you have only 1 first level folder, 4 second level folders and 365 files.

:)

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Tue Aug 16, 2011 9:47 pm

Letus2001 wrote:just a small notice ... I guess you expect, in your migration script, that the numbering of the attach_ids starts from zero and that its number equals the number of attachments totally, which is not true, if you migrate or do whatever with your attachments (mine att_ids starts at 200000, as it was previously one forum, that has been split into two :) )

use this SQL in your migration script instead

$sql = 'SELECT attach_id,
physical_filename
FROM '.ATTACHMENTS_TABLE.'
limit '.$ais_first_id.', 100';


else, I thank you for this script, I was hoping someone will do this :)
I've posted right now the version 1.0.1 to the MOD Team (and I updated thee .zip archive on the first post) that fixes this bug.

:)

Letus2001
Registered User
Posts: 22
Joined: Thu Nov 04, 2004 8:22 pm

Re: [RC] Attachments in subfolders

Post by Letus2001 » Tue Aug 23, 2011 11:04 am

great :) just so you know, with your script I migrated our forum having 630 thousand attachments (multiply by two for the thumbnails ...) and about 113gb of data in about 4 hours :D it works great now with this patch ! thanks alot !

Two minor experiences

- if you are using some older phpBB version, you have to replace the "basename" function within the affected pages with "utf8_basename" (just find and replace). After the mod is installed, you can replace it back :) (there are some users who do not have their phpBB up to date, for various reasons, and the mod will not install automaticly for them as the FIND part is not working :) )

- if you are using other language then EN or IT, just copy and paste the file from folder

languages/en/mods/move_attachments_in_subfolders_lang.php

to

languages/YOURLANGUAGE/mods/move_attachments_in_subfolders_lang.php

to make it work :) else the script complaints about language file not found :D

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Tue Aug 23, 2011 12:06 pm

Letus2001 wrote:... our forum having 630 thousand attachments (multiply by two for the thumbnails ...) and about 113gb of data...
:o

... wow... :shock:

Out of curiosity, can you tell me (even via PM) your board address... 630.000 attachments are... a lot!!!
Letus2001 wrote:- if you are using some older phpBB version, you have to replace the "basename" function within the affected pages with "utf8_basename" (just find and replace). After the mod is installed, you can replace it back :) (there are some users who do not have their phpBB up to date, for various reasons, and the mod will not install automaticly for them as the FIND part is not working :) )
I written this mod for PHPBB3 ver 3.0.8 (and 3.0.9)... unfortunately I don't know the old versions, so this is a good tip... thank you.
Letus2001 wrote:- if you are using other language then EN or IT, just copy and paste the file from folder

languages/en/mods/move_attachments_in_subfolders_lang.php

to

languages/YOURLANGUAGE/mods/move_attachments_in_subfolders_lang.php

to make it work :) else the script complaints about language file not found :D
As far as I know the English language is the default language, so I was believe that if you are using other language then EN or IT, the system was able to use the EN file anyway... so this is another good tip.

:)

lkkevin
Registered User
Posts: 38
Joined: Tue Feb 16, 2010 7:40 pm

Re: [RC] Attachments in subfolders

Post by lkkevin » Wed Sep 21, 2011 1:13 am

Hi I-FR70,

Do you have a file move_attachments_in_subfolders.html for subsilver2?
I would like to install yr MOD on my board and it uses subsilver2.
Thanks I-FR70.

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Wed Sep 21, 2011 7:19 am

Hi,
you can use the same file for subsilver2 (my forum has aa subsilver based template).

Ciao.

:)

lkkevin
Registered User
Posts: 38
Joined: Tue Feb 16, 2010 7:40 pm

Re: [RC] Attachments in subfolders

Post by lkkevin » Wed Sep 21, 2011 3:02 pm

Thanks I-FR70 -

Muchas Gracia

User avatar
digioz
Registered User
Posts: 297
Joined: Thu Feb 05, 2004 9:20 pm
Location: Chicago, IL
Name: DigiOz Multimedia
Contact:

Re: [RC] Attachments in subfolders

Post by digioz » Tue Nov 15, 2011 9:34 pm

I-FR70 wrote:... Anyway the "YYYY/MM/DD/{hashed_file_name}" could be a good method... but I still prefer use the ID, because you have less folders...For example, if you have only one new attachment per day, but you have a new attachment each day, at the end of the year with your method you have 1 first level folder, 12 second level subfolders, 365 third level subfolders and 365 files... with my method you have only 1 first level folder, 4 second level folders and 365 files.

:)
Since I wasn't able to talk you into supporting this idea :) , I just want to let everyone who was interested in my idea know, I created a Mod which uses the folder structure "YYYY/MM/DD" to store files. It can be viewed here:

http://www.phpbb.com/community/viewtopi ... &t=2144165

Thanks,
Pete
DigiOz Multimedia
http://www.digioz.com

lkkevin
Registered User
Posts: 38
Joined: Tue Feb 16, 2010 7:40 pm

Re: [RC] Attachments in subfolders

Post by lkkevin » Sat Nov 19, 2011 1:42 am

I-FR70,

I have installed yr MOD on my board (3.0.9). It worked but all of my avatars were not displayed.
Somehow links of avatars were corrupted. Do you have any idea what caused this problem?
TIA.

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Sat Nov 19, 2011 10:15 am

Hi lkkevin,
the MOD is absolutely not related to avatars, unless you changed the default avatar folders:

images/avatars/upload
images/avatars/gallery

as

"files/avatars/upload"
"files/avatars/gallery"

or something similar.

I suggest you to check this, and check again all MOD related files and eventually fix any error occurred during the MOD installation process.

:)
Last edited by I-FR70 on Sat Nov 19, 2011 11:01 am, edited 1 time in total.

User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: [RC] Attachments in subfolders

Post by Oyabun1 » Sat Nov 19, 2011 10:45 am

You can check the avatar paths in
Admin Control Panel > General tab > Board configuration > Avatar settings
  • Avatar storage path:
    Avatar gallery path:
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests

lkkevin
Registered User
Posts: 38
Joined: Tue Feb 16, 2010 7:40 pm

Re: [RC] Attachments in subfolders

Post by lkkevin » Tue Jan 10, 2012 12:57 am

I-FR70 and Oyabun1 : Thanks for your suggestion to check the path.

Yes, i still use the default avatar path. They both are:

images/avatars/upload
and
images/avatars/gallery

My attachment folder is getting so big now. I really need this mod. I am going to create another backup site to test this mod again. Thank you very much I-RF70.

lkkevin
Registered User
Posts: 38
Joined: Tue Feb 16, 2010 7:40 pm

Re: [RC] Attachments in subfolders

Post by lkkevin » Fri Jan 13, 2012 1:29 am

Hi I-FR70,

Today i tested your MOD on my cloned live forum (3.0.9 - subsilver2). It tooks about 13 min. I checked under the \Files\ folder and saw the script move all my attachment to 2 subfolder named 00 and 01, and under 00, there are subfolder from 00 to 99
under 01, there are subfolder from 00 to 86

I checked on my forum, all the old attachments display correctly. However, i observed 2 problems:

1. I attached a new image. A new image saved directly to the \Files\ folder, but that image didnot display on my forum. It shows like this: 1.jpg instead of the picture of the image.
I have installed a MOD that takes out the attachment frame for the image. It was 2 years ago, i forgot what the mod named. I think this might caused a problem. But dont know how to fix it.

2. I have been logged out all the time when going through pages on my forum.

In sum, the structure of a new folder \Files\ looks like this (after i attached 1 new image):

\Files\00\00 .... to 99
\Files\01\00 .... to 86
\Files\2_23232esdsd34343434sadsdsadasdsadsa (this is a new image i just attached for testing)


I hope you or other can help to fix this problem. I realy think this is very very important and great MOD that many people need. Thank you very much I-FR70

TIA.
Last edited by lkkevin on Sat Jan 14, 2012 1:59 am, edited 1 time in total.

I-FR70
Registered User
Posts: 58
Joined: Wed Mar 17, 2010 2:13 pm
Name: Fabio Rambaudi

Re: [RC] Attachments in subfolders

Post by I-FR70 » Fri Jan 13, 2012 11:08 am

Hi lkkevin,
the second problem is not related to the MOD but it happens because surely you didn't change the PHPBB cookie name for test installation. You can care nothing for this in a test environment.

The first problem is surely an incompatibility with the previous MOD you've installed 2 years ago. But if you don't remember the MOD name, it's quite impossible to help you.

Anyway in this period I'm quite overloaded... but you can try to send me via email the related PHP pages you've modified and, if you are absolutely not in rush, when I have time I can try to help you.

:)

lkkevin
Registered User
Posts: 38
Joined: Tue Feb 16, 2010 7:40 pm

Re: [RC] Attachments in subfolders

Post by lkkevin » Sat Jan 14, 2012 2:23 am

Hi I-FR70,

I have sent you a PM with the attached files that i modified. Please, when and if you have spare time, could you take a look at them. No, i am not in hurry. We all know, you and many great developers have spent and used a lot of your valuable time to develop those MODs, to contribute for the community. I am really appreciate those contributions, i really do. Thanks I-FR70.

LKkevin

Locked

Return to “[3.0.x] MODs in Development”