[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!
Anti-Spam Guide
Locked
User avatar
Frejer Stolz
Registered User
Posts: 19
Joined: Wed Jan 07, 2009 11:22 pm

Re: [RC] Attachments in subfolders

Post by Frejer Stolz »

Hi!

Thank you for mod!

But I have some troubles with it (

When I run move_attachments_in_subfolders.php I see a lot of mistakes like:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 103: mkdir(): Permission denied
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 104: copy(files_new/index.htm): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 109: mkdir(): No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 110: copy(files_new/00/index.htm): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 115: mkdir(): No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 116: copy(files_new/00/02/index.htm): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 124: copy(files_new/00/02/101_d86ab0db3f87c4a6392d9d7dcdae5aba): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 136: copy(files_new/00/02/thumb_101_d86ab0db3f87c4a6392d9d7dcdae5aba): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 103: mkdir(): Permission denied
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 104: copy(files_new/index.htm): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 109: mkdir(): No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 110: copy(files_new/00/index.htm): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 115: mkdir(): No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 116: copy(files_new/00/02/index.htm): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 124: copy(files_new/00/02/101_4196a8aa1ce2b4014760329cdaabf0e3): failed to open stream: No such file or directory
[phpBB Debug] PHP Warning: in file [ROOT]/move_attachments_in_subfolders.php on line 136: copy(files_new/00/02/thumb_101_4196a8aa1ce2b4014760329cdaabf0e3): failed to open stream: No such file or directory
....
.....
.....
.....
.....
.....
.....
What could it be? PhpBB 3.0.11
Thanks in advance!
sti_22
Registered User
Posts: 6
Joined: Tue Feb 12, 2013 10:05 pm

Re: [RC] Attachments in subfolders

Post by sti_22 »

check yours file/folder permissions on "files" folder.
yours httpd server/php can't create folders in it.
wile
Registered User
Posts: 59
Joined: Mon Apr 30, 2007 4:21 pm

Re: [RC] Attachments in subfolders

Post by wile »

I realized what I am missing here.

This MOD reorganizes files into subfolders and I am still afraid of this as it might bring issue with future phpBB updates.. or in case of migration to different forum system (convertors or future releases will count that attachments are in one folder only)

MOD could have also function to revert changes back to old system, how attachments were organized.
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 »

Hi wile,
there is no function to revert changes back, but it's quite easy to do it manually, going through all steps in reverse order and deleting the added code.

About the files, it's quite easy to create a script that scans all subfolders in the "files" folder and moves all files in the main folder.
When I have a bit of time, I'll do it.

Ciao.
wile
Registered User
Posts: 59
Joined: Mon Apr 30, 2007 4:21 pm

Re: [RC] Attachments in subfolders

Post by wile »

Hello,

one more question.

What in case we copy thread ? I was playing with MOD and seems that after copying (and automatic creating of new folder because of another 100 files in DB - because my thread contained files) I am missing some attachments...
Rendy
Registered User
Posts: 10
Joined: Wed Dec 25, 2013 3:22 pm

Re: [RC] Attachments in subfolders

Post by Rendy »

Hi, I have a problem, when I successfully installed this MOD, I get this error in topics with attachments:

Code: Select all

Fatal error: Call to undefined function utf8_basename() in /data/web/virtuals/50672/virtual/www/forum/includes/functions_content.php on line 865
where did I go wrong? :( thx for help
forum: crxklub.cz/forum
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 »

Hi Rendy,
probably you have made a mistake during the copy - paste phase of the installation, since the error you get, "Call to undefined function utf8_basename()", as you can see below is related to a pre-existing function.

Original code:

$thumbnail_filename = $phpbb_root_path . $config['upload_path'] . '/thumb_' . utf8_basename($attachment['physical_filename']);

My code:
$thumbnail_filename = $phpbb_root_path . $config['upload_path'] . $ais_path_to_add . '/thumb_' . utf8_basename($attachment['physical_filename']);

I suggest you to restore the old version of the files and apply again the mod.

:)
Rendy
Registered User
Posts: 10
Joined: Wed Dec 25, 2013 3:22 pm

Re: [RC] Attachments in subfolders

Post by Rendy »

Hi, I fixed it, I removed from the line utf8_basename word utf8_ and work fine :) Does anyone know why this helped? :)
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 »

Either you made a mistake in the edits or your board is seriously out of date. The utf8_basename() function was added in phpBB 3.0.6.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
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 »

wile wrote:Hello,

one more question.

What in case we copy thread ? I was playing with MOD and seems that after copying (and automatic creating of new folder because of another 100 files in DB - because my thread contained files) I am missing some attachments...
Hi wile,
you're right, it seems that the mod doesn't work in case of thread copy, since the attachments get each one a new attachment ID. The solution could be to duplicate the attachments, but I don't know if it's a good idea... I have to think a bit about it.

At this moment I suggest you to not use the copy feature OR to not use this MOD.

:)
Rendy
Registered User
Posts: 10
Joined: Wed Dec 25, 2013 3:22 pm

Re: [RC] Attachments in subfolders

Post by Rendy »

Oyabun1 wrote:Either you made a mistake in the edits or your board is seriously out of date. The utf8_basename() function was added in phpBB 3.0.6.
Board I have 3.0.7 :oops: , but the template may be older, if it matters :)
JerryBruckWill
Registered User
Posts: 6
Joined: Thu Jan 02, 2014 3:39 pm

Re: [RC] Attachments in subfolders

Post by JerryBruckWill »

Hi,

mod has been installed successfully, but I have one problem with attachments.

If I upload new attachment, then it done. Link for attachment is correct, but if I send a post, I'll see a only text. Tag [attachment=0] does not work.

Where is a problem?

Thank's and have a nice day.

Jerry.
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 »

Hi JerryBruckWill,
usually the tag [attachment=0] works perfectly, so I think the problem could be one of this:

1) You have made a mistake during the MOD installation.
2) You have another MOD installed that is not compatible.
3) You've not cleaned the cache
4) Your board is a version too old.

:)
JerryBruckWill
Registered User
Posts: 6
Joined: Thu Jan 02, 2014 3:39 pm

Re: [RC] Attachments in subfolders

Post by JerryBruckWill »

Thank's.

I check the instalation and everythink is OK. I don't have another mod. I clear cache and version is 3.0.11. :(

What permissions for the folder named "files"? What should it be?
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 »

Hi, the permission required are the same PHPBB3 needs without my MOD: installation manual says 777, but I use 755 with success.

:)
Locked

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