View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0006534 | mantisbt | administration | public | 2005-12-25 11:04 | 2009-12-15 04:48 | 
| Reporter | ManhuntMark | Assigned To | |||
| Priority | normal | Severity | major | Reproducibility | always | 
| Status | acknowledged | Resolution | open | ||
| Product Version | 1.0.0rc4 | ||||
| Summary | 0006534: move_db2disk does not use $g_absolute_path_default_upload_folder | ||||
| Description | I've use the $g_absolute_path_default_upload_folder value to set my site's default upload folder to something other than my Mantis install location. I have about 95 files that got stored in the database before I setup DISK based storage, and I would like to move them to the disk. All newly uploaded attachments are being stored just fine, so I know the directories are setup correctly. When I use the move_db2disk page, it keeps trying to write the files to my Mantis instal's root, which is of course read only. I couldn't find any mention of the global default upload folder in the move_db2disk code.  | ||||
| Tags | No tags attached. | ||||
| Attached Files |  upload_path.patch (538 bytes)   
 
--- mantis-1.0.3/admin/move_db2disk.php.orig	2006-06-05 15:55:27.000000000 -0400
+++ mantis-1.0.3/admin/move_db2disk.php	2006-06-05 15:55:13.000000000 -0400
@@ -98,6 +98,9 @@
 				$t_bug_id = $t_project_id;
 			}
 			$t_file_path = project_get_field( $t_project_id, 'file_path' );
+			if ($t_file_path == '') {
+			    $t_file_path = config_get_global( 'absolute_path_default_upload_folder' );
+			}
 			$prefix = get_prefix( $t_file_path );
 			$t_real_file_path = $prefix . $t_file_path;
 			$c_filename = file_clean_name($v_filename);
 | ||||
| 
	 I added the following to the get_prefix() function, just before the line that returns the dirname(FILE) value. It worked for me, although I had to follow up and manually correct the values in the database. The absolute path wasn't prepended to the diskfile values, but that was easy to identify and fix. $t_default_upload_folder = config_get_global( 'absolute_path_default_upload_folder' );  | 
|
| 
	 I've attached a cleaner patch that checks $t_file_path == '' for the project file path and fetches the global if it is empty.  | 
|