Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001098 [CubeCart v4] Admin Control Panel major always 2008-06-18 03:14 2008-08-19 04:22
Reporter estelle View Status public  
Assigned To martin
Priority normal Resolution fixed  
Status closed   Product Version 4.2.2
Summary 0001098: Image Management - hash comparison some images are not found/displayed
Description I have just spent a long time trying to figure out why some images were not being found and added to the database by the buildDatabase() function.

The following code is causing the problem, and it occurs when the same image exists in more than one folder. I don't understand why you would exclude images from being added to the database when they clearly exist in the filesystem and may be used for some of the products.

If you want to prevent duplicate images in different folders, wouldn't you add the check to the file upload area instead of the manage images page?


                    ## Hash comparison
                    $checksql = sprintf("SELECT COUNT(`file_id`) as Count FROM %sCubeCart_filemanager WHERE md5hash = %s;", $this->_config['dbprefix'], $record['md5hash']);
                    $checkquery = $this->_db->select($checksql);
                    if ($checkquery[0]['Count'] == 0) {
                        $this->_db->insert($this->_config['dbprefix'].'CubeCart_filemanager', $record);
                        $count++;
                    }
Additional Information
Tags No tags attached.
Browser N/A
Install Method N/A
MySQL Version Unknown
PHP Version Unknown
Server OS Linux/Unix
Skin
Attached Files

- Relationships

-  Notes
User avatar (0002271)
martin (developer)
2008-06-19 09:48

the idea behind this was to prevent any duplicate images existing in the user's store, as a potential way to prevent the image folders from becoming accidentally bloated with duplicate images.

there are two possible fixes. either we remove the hash checking, or extend the functionality to check the filepath

the latter:
$checksql = sprintf("SELECT COUNT(`file_id`) as Count FROM %sCubeCart_filemanager WHERE md5hash = %s AND filepath = %s;", $this->_config['dbprefix'], $record['md5hash'], $record['filepath']);

will only prevent the uploading of files with the same hash AND name
(0002274)
estelle (reporter)
2008-06-19 10:40

I understand. I feel it is a check that, if anywhere, should be done during file upload.

The buildDatabase function should show what is stored in the filesystem, rather than cutting out some images because they are the same image but have a different filename or filepath.

Consider backwards compatibility. Doesn't the Admin -> View Products -> Manage Images popup window now list the contents of the database (rather than filesystem), hence it would be impossible to unlink an image from a product if the image happened to be a duplicate and therefore wasn't listed?
User avatar (0002374)
martin (developer)
2008-08-05 04:26

I've been investigating this issue, and I think, as an interim measure, the best solution is to disable the hash checking, until we can find a means to check for duplicates during upload, which is currently difficult using the FCKEditor filemanager

the updated SQL is:

$checksql = sprintf("SELECT COUNT(`file_id`) as Count FROM %sCubeCart_filemanager WHERE filepath = %s;", $this->_config['dbprefix'], $record['md5hash'], $record['filepath']);

- Issue History
Date Modified Username Field Change
2008-06-18 03:14 estelle New Issue
2008-06-18 03:14 estelle PHP Version => Unknown
2008-06-18 03:14 estelle MySQL Version => Unknown
2008-06-18 03:14 estelle Install Method => N/A
2008-06-18 03:14 estelle Server OS => Linux/Unix
2008-06-18 03:14 estelle Browser => N/A
2008-06-19 09:48 martin Note Added: 0002271
2008-06-19 10:40 estelle Note Added: 0002274
2008-06-19 13:38 martin Status new => assigned
2008-06-19 13:38 martin Assigned To => martin
2008-06-24 09:14 martin Target Version => 4.2.3
2008-08-05 04:26 martin Status assigned => resolved
2008-08-05 04:26 martin Fixed in Version => 4.2.3
2008-08-05 04:26 martin Resolution open => fixed
2008-08-05 04:26 martin Note Added: 0002374
2008-08-19 04:22 martin Status resolved => closed


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker