View Issue Details

IDProjectCategoryView StatusLast Update
0009905mantisbtadministrationpublic2019-01-11 06:33
Reportervboctor Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.2.0a2 
Target Version1.2.0rc1Fixed in Version1.2.0a3 
Summary0009905: Simplify the process of moving the attachments folder
Description

In the case of using DISK for attachments / projects documents, the database stores the full path to the attachments and hence if the folder is moved due to migration or some other reasons, the attachments are broken and it is required to change all the references in the database.

The change is as follows:

  1. Do not store the full path in the database.
  2. For existing attachments, if found, return the path as is.
  3. If not found, locate using project path, if found return.
  4. If not found, locate using default path, if found return.

This issue includes two focus points:

  1. Fix the problem for new attachments.
  2. Attempt to ignore paths that are already stored in the database for existing attachments.
TagsNo tags attached.

Activities

grangeway

grangeway

2008-11-27 06:08

reporter   ~0020079

  • $t_unique_name = file_generate_unique_name( $t_file_hash . '-' . $t_file_name, $t_file_path );
  • $t_disk_file_name = $t_file_path . $t_unique_name;
  • $c_unique_name = db_prepare_string( $t_unique_name );

    $t_file_size = filesize( $t_tmp_file );
    if( 0 == $t_file_size ) {
    @@ -624,7 +713,7 @@ function file_add( $p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc
    $query = "INSERT INTO $t_file_table
    (" . $p_table . "_id, title, description, diskfile, filename, folder, filesize, file_type, date_added, content)
    VALUES

  • ($c_id, '$c_title', '$c_desc', '$c_disk_file_name', '$c_new_file_name', '$c_file_path', $c_file_size, '$c_file_type', '" . db_now() . "', $c_content)";
  • ($c_id, '$c_title', '$c_desc', '$c_unique_name',
    +'$c_new_file_name', '$c_file_path', $c_file_size, '$c_file_type', '" .
    +db_now() . "', $c_content)";

This to me looks like we still store path information in the database - given we put all attachments in 1 folder and a project configuration specifies the location of that folder, we should only store the filename itself in the database, and no absolute/relative path information.

Paul

grangeway

grangeway

2008-12-04 17:03

reporter   ~0020237

Reminder sent to: vboctor

Victor,

Am I correct with the thoughts I added to bug tracker?

Paul

vboctor

vboctor

2008-12-04 17:56

manager   ~0020243

At the moment we store a folder field in the database that I believe is not currently used. I was planning to review that and remove the field as part of a separate issue. For some reason in the past we use to store the full path to the file, then the folder path. Now we only store the file name and the folder path.

Related Changesets

MantisBT: master e0d3b361

2008-11-27 04:58

vboctor


Details Diff
Fixes 0009905: Simplify the process of moving the attachments folder. Affected Issues
0009894, 0009905
mod - core/print_api.php Diff File
mod - docbook/adminguide/en/configuration.sgml Diff File
mod - config_defaults_inc.php Diff File
mod - core/file_api.php Diff File
mod - core/utility_api.php Diff File
mod - file_download.php Diff File

MantisBT: master 55e3c60b

2008-11-27 05:09

vboctor


Details Diff
Fixes 0009905: Simplify the process of moving the attachments folder --- handle existing attachments with full path. Affected Issues
0009905
mod - core/file_api.php Diff File