[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
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [RC] Attachments in subfolders

Post by 4_seven » Wed May 25, 2011 4:33 pm

I also think, that the Base phpBB3 [attachment] Orphan System in ACP do this very well.
If a complete forum-id is in the tray, just click the [attachment] Orphan Function and all is gone in a rush.
Current Mods | Mod Base | php(BB) programming | No help via PM

ibelphegor
Registered User
Posts: 453
Joined: Wed Oct 24, 2007 8:37 am

Re: [RC] Attachments in subfolders

Post by ibelphegor » Wed May 25, 2011 9:06 pm

Yes Oyabun1 Thank you very much for the explanation.
English not my strong side... :P

But, i think Forum folder will be enough and then I-FR70 method.
Topic id will make a very big list + attachments folder (I-FR70 method).

In this why you can clean forum or make backup to important forum.
I think it will be very useful.

Anyway good mod and thank you for your work 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 May 25, 2011 9:52 pm

ibelphegor wrote:...English not my strong side... :P
Don't worry... I have the same problem... :roll: ;)
ibelphegor wrote:But, i think Forum folder will be enough and then I-FR70 method...I think it will be very useful.
So you think about a folder structure with the forum id and then my method, for example forum_id = 23, attachment_id = 1, the folder becomes /files/23/00/00/ ... this could have sense.
The only one negative aspect that I can see is that you could have a lot of fragmentation... because if you have in forum 1 one attachment with ID between 1 and 99, and if you have in forum 2 one attachment with ID between 1 and 99, and if you have in forum 3 one attachment with ID between 1 and 99 and so on, you have the entirely subfolder structure duplicated among the forum subfolders... but this is acceptable (for my point of view).

Now I want to release the version 1.0.0, and I think could be this RC version... then I can try to write another parallel version that uses your idea about the division method (and another one that uses 4_seven method), so each user can choose the best solution for his specific case.
ibelphegor wrote:Anyway good mod and thank you for your work I-FR70 ;)
Thank you to you, you're welcome. ;)

:)

farazhamzaa
Registered User
Posts: 128
Joined: Tue Mar 24, 2009 7:37 pm

Re: [RC] Attachments in subfolders

Post by farazhamzaa » Mon May 30, 2011 8:27 am

respected Sir,

i have already running phpbb 3.0.8 (upgraded version) andi have already more then 4500 attachments. if i will install this mod then all attachments will automaticaly adjusts in subfolders? or they remain as it is. but new attachments will goes in subfolders?

2ndly if i will install this mod on my Live board then it will work pefectly? without harming my board?

it is tested on 3.0.8???

thx in advance for you on developing such great mod. i realy appriciate on ur efforts :)

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 » Mon May 30, 2011 9:49 am

Hi farazhamzaa and thank you to you.

This is a RC version, so even though I performed a lot of test, I don't suggest to use it in your live board (as I don't use it in my live board, for safety sake).

I'm going to submit the MOD to be certificated as a stable version, so please be patience and wait a couple of week... after the check of the PHPBB3 team, I think you can use it without problem.

About your question, the MOD was developed for version 3.0.8 and when you install it, you have to run a php file that copy (or move) the existing attachments within the new subfolder structure.

:)

farazhamzaa
Registered User
Posts: 128
Joined: Tue Mar 24, 2009 7:37 pm

Re: [RC] Attachments in subfolders

Post by farazhamzaa » Mon May 30, 2011 1:09 pm

oh okayz. Sir,

hope so soon i will be able to be utilized with your great effort.

Keep it up dear. Wish you best of luck for its finilized version

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 » Mon May 30, 2011 1:20 pm

Thank you, I've posted right now the version 1.0.0 to the MOD Team (and I updated thee .zip archive on the first post).

If you want to try it, this is a test forum I've prepared:

http://www.rambaudi.net/test/forum/

:)

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

Re: [RC] Attachments in subfolders

Post by lkkevin » Sun Jul 31, 2011 3:15 pm

I-FR70 wrote:..... when you install it, you have to run a php file that copy (or move) the existing attachments within the new subfolder structure.

:)
Hi I-FR70, thanks for a very useful MOD -

Afre running a php file to copy the existing attachments within the new subfolder structure, does it effect the old/current links (of the attachments) on the board? Thanks.

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 » Sun Jul 31, 2011 6:59 pm

Hi lkkevin,
yes, it does.

When you upload the MOD, the old/current links don't work, then you have to run the php script that copies (or moves, if you prefer, but you have to change a parameter within the script) the old attachments within the new structure.

At the end, the old/current links working again.

Then you can delete the old attachment structure, marked as "_old"; for instance, if your attachment folder is named "files" (the default name), at the end you can delete the "files_old" folder.

:)

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

Re: [RC] Attachments in subfolders

Post by lkkevin » Sun Jul 31, 2011 8:37 pm

I-FR70,
Thanks for your explain.

I am just a beginner php .... So if your MOD completed and verified, we can follow the install instruction
for example running the php script, etc.... that will move all attached files to the subfolders/new structures.
At the end, the old/current links will work fine.

My question is if i have coulle hundreds attachment on my board, at the end those attachments will work?
or do i have to change anything on my board?

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 » Sun Jul 31, 2011 9:21 pm

lkkevin wrote:...if i have coulle hundreds attachment on my board, at the end those attachments will work?
or do i have to change anything on my board?
You don't have to do anything, the old attachments will work ;)

:)

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

Re: [RC] Attachments in subfolders

Post by lkkevin » Tue Aug 02, 2011 4:25 am

I-FR70

Thank you very much for this wonderful MOD.

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

Re: [RC] Attachments in subfolders

Post by Letus2001 » Thu Aug 04, 2011 10:12 am

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-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 » Thu Aug 04, 2011 1:44 pm

Hi Letus2001,

What you stated is true, I written the MOD with the idea that the numbering starts from zero... so thank you for your advice.

I'll do a 1.01 version of my MOD to fix this. ;)

:)

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 » Wed Aug 10, 2011 3:14 pm

Thank you for the great Mod. I was wondering (like many before me here) if the folder structure wouldn't make more sense if you store the attachments as:

"YYYY/MM/DD/{hashed_file_name}"

This way you would be able to clearly identify where all attachments made on a certain date reside within the folder structure inside "files" folder and you wouldn't have to rely on any counting to determine when a new folder needs to be created.

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

Locked

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