Move attachments from DB-->filesystem (DISK)

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
lccpu
Posts: 4
Joined: 15 Feb 2013, 20:00

Move attachments from DB-->filesystem (DISK)

Post by lccpu »

Is there an easy/good way to move all your attachments from the database to the disk?

I've downloaded most of the attachments from issues so I can upload them again once I've changed to DISK storage if necessary. But is there anyway other than downloading them all then uploading them all again?
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Move attachments from DB-->filesystem (DISK)

Post by atrol »

Check admin/system_utils.php

I recommend a database backup before running "Move attachments stored in database schema to disk files."
If anything goes wrong you might loose your attachments.

Set $g_absolute_path_default_upload_folder or set the upload file path per project in project admin page before running the script.
Please use Search before posting and read the Manual
lccpu
Posts: 4
Joined: 15 Feb 2013, 20:00

Re: Move attachments from DB-->filesystem (DISK)

Post by lccpu »

Great, atrol, thanks for the pointer to admin/system_utils.php I'll check it out... unfortunately I'm getting stuck now!

"#503" errors no matter what/where/permissions I use for the folders, regardless if I have the default global value set or I am setting it individuall for projects!

the value of $g_absolute_path_default_upload_folder doesn't make a difference whether it has a trailing "/" or not. One of the different directories I tried I forgot to put it on, and check.php told me it was bad, but didn't make a difference. Trying to talk to directories inside public_html, it's subfolders, outside public_html, or inside public_html/mantisroot has had no effect.

I have changed write perms to 775 and changed both owner and group to "nobody" which is the stated user/group of root-child processes on my server.
I have also tried setting perms to root:root 777... still 503 errors!
I get this error when I try to update the path on the project window, or when I try to upload a file from an issues window.


Running Mantis 1.2.14 on

CentOS 5.9 (Final)
Apache version 2.2.23
PHP version 5.2.17
MySQL version 5.1.66-cll
Architecture x86_64
Kernel version 2.6.18-308.13.1.el5


Here is the full output of the text:
APPLICATION ERROR #503

Invalid upload path. Directory either does not exist or not writable to webserver.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Move attachments from DB-->filesystem (DISK)

Post by atrol »

Have a look at http://www.mantisbt.org/bugs/view.php?id=15496
Seems there are various issues around it, but using an individual setting should work http://www.mantisbt.org/bugs/view.php?id=15496#c35215
I know you wrote that it didn't work for you, maybe you want to check again (try absolute and relative paths)
Please use Search before posting and read the Manual
lccpu
Posts: 4
Joined: 15 Feb 2013, 20:00

Re: Move attachments from DB-->filesystem (DISK)

Post by lccpu »

Thanks for the reference atrol, it turned out what I needed to do was make the path relative!

I guess I should have thought to try that...

but since the variable begins with "$g_ABSOLUTE...." I was thinking absolute, as in... absolute... unfortunately nowhere in the documentation does it clarify this point...

This variable doesn't even show up in the admin guide....

and the files :
config_defaults_inc.php
config_inc.php.sample

both just say "this is the absolute path".

Should I make a bug-report to include this in documentation?
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Move attachments from DB-->filesystem (DISK)

Post by atrol »

lccpu wrote: Should I make a bug-report to include this in documentation?
You should report a bug report that absolute paths are not working.

Could you please check your PHP setting safe_mode in php.ini http://www.php.net/manual/en/ini.sect.safe-mode.php
Maybe this settings affects also the functionality.
Please use Search before posting and read the Manual
lccpu
Posts: 4
Joined: 15 Feb 2013, 20:00

Re: Move attachments from DB-->filesystem (DISK)

Post by lccpu »

PHP Settings have been verified as having Safe Mode OFF.

The bug report is located here:
http://www.mantisbt.org/bugs/view.php?id=15996

Thanks again.
Post Reply